The identify event is a fundamental aspect of user analytics, enabling Edgee customers to connect users to their actions and capture essential properties about them. This documentation provides detailed guidance on utilizing the identify event to enrich your user data for more personalized and insightful analytics.

You don’t need to fire an identify event for every user action. Instead, you should fire an identify event when you first learn about a user, and then update the user’s information as it changes (for example, when they update their profile, or when they first register).

Event fields

The identify event collects the following fields about the user:

FieldTypeDescription
userIdStringA unique identifier for the user, typically from your own user database.
anonymousIdStringAn alternative identifier used when a userId is not available, ensuring that user actions can still be collected anonymously.
propertiesObjectFree-form dictionary of properties of the user

Privacy Notice: This method and all the fields it collects are subject to data privacy regulations. When collecting user data, always prioritize user privacy and data protection. Ensure that you are compliant with relevant data privacy regulations and obtain user consent before collecting any personal information.

How to collect the identify event?

There are two ways to collect the identify event:

1 - Automatically with the Context Payload

Edgee collects the identify event automatically each time it receives a Context Payload with the identify field. Here’s a breakdown of how to structure the Context Payload:

<script id="__EDGEE_CONTEXT__" type="application/json">
    {
        "page": {
            "name": "With Edgee",
            ...
        },
        "identify": {
            "userId": "abcde",
            "anonymousId": "12345",
            "properties": {
              "email": "me@example.com",
              "name": "John Doe"
            }
        },
        "destinations": {
            "all": false,
            "bigquery": true
        }
    }
</script>

2 - Manually

The identify event can be collected manually by calling the edgee.identify() method. Here’s a breakdown of how to structure an identify call:

// Syntax: edgee.identify(identifyObj, destinations);
edgee.identify({
    "userId": "abcde",
    "anonymousId": "12345",
    "properties": {
      "email": "me@example.com",
      "name": "John Doe"
    }
}, {
    "All": false,
    "BigQuery": true
});

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

As usual, you can optionally specify the destinations where this event data should be sent. If the destinations parameter is not specified, Edgee will look at the Context Payload if destinations are specified. If not, the event will be sent to all your destinations.

The edgee.identify() method expect two optionals parameters:

fieldtypedescription
identifyObjoptionalobject|StringA free-form dictionary object containing details of the identify event. This object can include all the following optional fields: userId, anonymoudId, and properties. You can also provide a string that will be used as the userId field.
destinationsoptionalobjectSpecifies which analytics components should receive the event data. This allows for targeted data sending based on your configured components within the Edgee platform.

Best Practices for identify Events

  • Consistent Identification: Use consistent identifiers across your application to ensure accurate user tracking. Decide on a standard for when to use userId versus anonymousId and stick to it.
  • Relevant Properties: Only include properties that offer actionable insights. Avoid collecting sensitive or unnecessary information to maintain data integrity.
  • Selective Destination Sending: Utilize the destinations parameter to fine-tune where your data is sent, optimizing for relevance and efficiency.
  • Privacy Compliance: Ensure that you are compliant with relevant data privacy regulations when collecting user data. Always prioritize user consent and data protection.