Exemplo n.º 1
0
class GoogleAnalytics(Adaptor):
    def __init__(self, options):
        super(GoogleAnalytics, self).__init__(options)

        # Required parameters for each payload
        property_id = options.get("property_id", "UA-XXXX-Y")
        client_id = options.get("client_id", '555')

        self.google_analytics = GoogleAnalyticsInterface(
            property_id=property_id, client_id=client_id)

    def http_send(self, event):
        """
        Sends a data payload to the data connection.
        """
        return self.google_analytics.add(event)
Exemplo n.º 2
0
class GoogleAnalytics(Adaptor):

    def __init__(self, options):
        super(GoogleAnalytics, self).__init__(options)

        # Required parameters for each payload
        property_id = options.get("property_id", "UA-XXXX-Y")
        client_id = options.get("client_id", '555')

        self.google_analytics = GoogleAnalyticsInterface(
            property_id=property_id,
            client_id=client_id
        )

    def http_send(self, event):
        """
        Sends a data payload to the data connection.
        """
        return self.google_analytics.add(event)
Exemplo n.º 3
0
from iot_analytics.interfaces import GoogleAnalyticsInterface
from iot_analytics.models import Event
'''
This is an example for how to use the python iot_analytics
package to record data to a self hosted database.
'''

# Create a new interface
interface = GoogleAnalyticsInterface()

# Create an event object
event = Event("ROBOT1-ID", {
    'category': 'button',
    'action': 'pressed',
    'label': 'momentary',
    'value': 10
})

# Add the event via the interface
interface.add(event)
Exemplo n.º 4
0
from iot_analytics.interfaces import GoogleAnalyticsInterface
from iot_analytics.models import Event


'''
This is an example for how to use the python iot_analytics
package to record data to a self hosted database.
'''

# Create a new interface
interface = GoogleAnalyticsInterface()

# Create an event object
event = Event("ROBOT1-ID", {
    'category': 'button',
    'action': 'pressed',
    'label': 'momentary',
    'value': 10
})

# Add the event via the interface
interface.add(event)