Tracking contact events
The Bird CRM offers APIs to identify visitors and track events. If you are going to track events on websites, we strongly recommend using our web SDK which simplifies the process. To track events from multiple sources or on the server-side, please follow this tutorial to enable the tracking API endpoints and send events to Bird CRM.
If you have already installed one of the ecommerce platform connectors like the Shopify connector, the web SDK is automatically installed on your store website. You can skip this tutorial entirely.
Installation
Navigate to the Application settings in the Developer Cloud.
Enable an Application by following the on-screen instructions.
Specify your website domain(s) as the allowed domains if events will be emitted from your website directly. For example:
If your website homepage is "https://example.com", use "example.com" as the allowed domain. If there are any subdomains like “shop.example.com”, list them as well.
Multiple domains can be specified with commas separating them.
If events will be emitted from servers, you can leave the allowed domains empty.
Once enabled, you'll see a config page with a snippet similar to:
If you plan to use the API endpoints directly, you just need to remember the config URL in the snippet above. The config is unique to your workspace.
Usage
The typical process of tracking events is to first get the tracking API endpoints and request headers from the config URL, then send the events to Bird CRM.
1. Getting tracking endpoint and headers
Send an HTTP GET request to the config URL to retrieve the workspace-specific tracking information.
Example request:
Example response:
You will need the following information from the response in the subsequent steps,
workspaceId
apiEndpoint
tracking.endpoint
tracking.writeKey
We recommend retrieving the config at the beginning of the session and cache the response for the duration of the tracking session.
2. Tracking events
To tell Bird CRM about the actions your users are performing, you can send the events to Bird CRM via the “/track” endpoint retrieved above.
Bird CRM pre-defines a set of commonly used events in different verticals such as ecommerce, called semantic events. These events have a standard schema that is well integrated into the entire platform without any additional work.
Besides semantic events, Bird CRM also accepts custom events to meet different needs. Custom events can have arbitrary properties. There is no need to define the schema for custom events before ingestion. Bird CRM automatically discovers the schema from ingested events. Custom events can be used to trigger journeys and flows, used for message personalization, and for segmentation.
Regardless of whether you are sending semantic events or custom events to Bird CRM, the following properties must exist at the top level of the event object.
event: For semantic events, the event names must match the pre-defined event names in the appendix. Custom events can have arbitrary names as long as they don’t collide with any semantic event names.
identity: The “identity” object tells Bird CRM which contact the event belongs to. One or more identifiers must be provided. The identifiers will be used to look up the contact in the order presented. The first identifier that matches a contact’s identifier will determine the contact the event will be associated with. Common identifiers to use in events are external user ID or email address. For email address, the identifier key must be “emailaddress” and the value is the actual email address. Phone numbers are generally not a good identifier unless they uniquely identify a contact and are used as contact identifiers already. In that case, the identifier should be “phonenumber”.
messageId: The message ID at the end can be any string as long as they uniquely identify the event across all events in the workspace. A UUID works well here.
The following subsections describe how to send semantic events and custom events to Bird CRM.
Semantic events
Here’s a call to track a page view event of an identified user with the email address “john@example.com”.
Replace the “tracking.endpoint”, “contactId”, “workspaceId”, and “tracking.writeKey” with the values retrieved from the steps above.
The event name must be one of the semantic event names defined in the appendix.
Custom events
Here’s a call to track a custom event called “Book Read” of an identified user with the email address “john@example.com”. Note that the event name in the HTTP request header must be set to “custom”.
Replace the “tracking.endpoint”, “contactId”, “workspaceId”, and “tracking.writeKey” with the values retrieved from the steps above.
Nested event properties are supported no more than five levels deep.
Once you start to track events of identified users, you can verify that they are correctly recorded by checking the contact activity timeline on the contact detail page in Bird CRM.
To help make it easier to test custom event tracking with your workspace, we have built a playground just for this.
For more information on supported semantic event types, please refer to BirdTracker.
Last updated