Chord Commerce Event Tracking
Guides

Unifying Data Across Sources

2min

Chord’s standard data implementation includes events being sent to the CDP from, at minimum, a website front-end and a server source. To ensure these events are associated to the same user record in the CDP, the website front-end needs to save a few browser identifiers as attributes on the cart or order, so they can be retrieved later by the server source and included in CDP events.

Shopify

For Shopify sites, these identifiers should be added as cart attributes.

If using the Shopify Storefront API in a headless architecture, this can be done using the cartAttributesUpdate mutation.

If you are using the Shopify web pixel in a store that uses a Liquid theme, you'll want to add the following script to your Liquid theme:

HTML


Others

At minimum, a cart attribute named _cdpAnonymousId must be added with the value being the anonymous ID assigned to the user in the browser. When using Segment, this ID can be found by calling window.analytics.user().anonymousId() on any page where Segment’s Javascript is present. It won't be available until after Segment has been initialized, so you may want to wait for the analytics.ready callback.

If using Google destinations, add an attribute named _googleClientId with the value getCookie('_ga').substring(6). Note: getCookie is not a native Javascript function and needs to be implemented. See an example implementation.

Add these attributes to the cart before the customer navigates to checkout. Ideally, if adding these attributes requires an API request, add these attributes at a time that doesn’t block user interaction with your site, like when the cart page loads or after a product is added to the cart.