The track event is a versatile method for recording any actions your users take, along with descriptive properties about those actions. Each track event is identified by a name, such as “User Subscribe,” and can be enriched with properties like “billing plan” to provide context. These events are crucial for understanding user behavior, measuring the effectiveness of features, and optimizing the user experience.

Event fields

The track event collects the following fields:

FieldTypeDescription
namerequiredStringThe name of the action
propertiesoptionalObjectFree-form dictionary of properties of the action

How to collect the track event?

There are two ways to collect the track event:

1 - Automatically with the Edgee Data Layer

Edgee collects the track event automatically each time it receives a Data Layer with a track event.

Here’s a breakdown of how to structure the Data Layer:

<script id="__EDGEE_DATA_LAYER__" type="application/json">
{
  "data_collection": {
    "events": [
      {
        "type": "track",
        "data": {
          "name": "color choice",
          "properties": {
            "color": "blue",
            "category": "shoes",
            "label": "Blue Sneakers"
          }
        },
        "components": {
          "google_analytics": true,
          "amplitude": false
        }
      }
    ]
  }
}
</script>

2 - Manually

The track event can be collected manually by calling the edgee.track() method via the Edgee SDK.

Here’s a breakdown of how to structure a track call:

// Syntax: edgee.track(track_obj, components);
edgee.track({
    "name": "color choice",
    "properties": {
        "color": "blue",
        "category": "shoes",
        "label": "Blue Sneakers"
    }
}, {
    "google_analytics": true,
    "amplitude": false
});

In this example, the track event captures a “color choice” event, detailing the item’s color, category, and label.

Additionally, you can specify the analytics components where this event data should be sent. If the components parameter is not specified, Edgee will look at data_collection.components in the Edgee Data Layer. If not defined, the event will be sent to all your components.

The edgee.track() method expect the following parameters:

fieldtypedescription
track_objrequiredobject|stringA free-form dictionary object containing properties of the track event. This object has to include the name field, and can include the properties field. If a string is passed, it will be considered as the name field.
componentsoptionalobjectSpecifies which analytics components should receive the event data. This allows for targeted data sending based on your configured components within the Edgee platform.

Privacy

The properties field is designed for capturing any data you wish to collect.

If this field doesn’t contain personally identifiable information (PII), collecting the track event is straightforward and secure without requiring user consent. This is because Edgee anonymizes any personal data before it’s transmitted to the components.

However, if PII is included in the properties field, obtaining user consent prior to data collection is imperative. Additionally, your data collection methods must comply with GDPR, CCPA, and any other applicable data protection laws.

Best Practices for track Events

  • Descriptive Event Names: Use clear and descriptive names for your events to ensure that data is easily understandable and actionable.
  • Relevant Properties: Include properties that offer valuable insights into the event. Avoid overloading events with unnecessary data to maintain clarity.
  • Selective Destination Sending: Utilize the components parameter to fine-tune where your data is sent, optimizing for relevance and efficiency.
  • Privacy Considerations: Note that you must ensure that no personally identifiable information (PII) is sent throught the properties field