Configuration
Chord's Liquid tracking library can be configured with the following options. To modify the default options, change the options object argument passed to chord.load():
Property | Type | Required | Description |
autoInstrument | boolean | no | Defaults to true. When set to false, track events are not automatically sent. |
autoInstrumentSelectors | object (see Auto-Instrument Selectors below) | no | Provide custom DOM selectors for automatic instrumentation of events. |
baseUrl | string | no | The base URL of the Shopify site, to use in Shopify Ajax API requests. Ex. https://example.myshopify.com. If not provided, the current origin will be used. |
cdp | function or object | yes | A reference to the CDP library, or a function that returns a reference to the CDP library. For example, if using Segment'sΒ analytics.jsΒ library, this could be window.analytics or () => window.analytics. If omitted, no tracking events are sent. |
debug | boolean | no | Defaults to false. When set to true, events are validated against Chord's tracking plan. An error is logged using console.log if the event doesn't match the tracking plan and the enableLogging option is set to true. We recommend enabling debug and enableLogging for development and disabling for production. |
enableLogging | boolean | no | Defaults to true. When set to true, Javascript and debug errors are logged using console.log. We recommend enabling debug and enableLogging for development and disabling for production. |
metadata | object (see Metadata below) | yes | Event metadata. See below for details. |
stripNull | boolean | no | Defaults to true. When set to true, event properties with a null value are removed. CDPs typically treat null and undefined as separate values, so be sure you intend to send null values before setting to false. |
syncIdentifiers | object (see Sync Identifiers below) | no | Enable adding integration identifiers as cart attributes, so they can be included in server-side events. Each integration defaults to false. |
Auto-Instrument Selectors
This optional object allows you to customize the DOM selector that Chord uses to automatically track certain events. Events related to page view, such as "Cart Viewed," aren't configurable here, because they are based on the current URL instead of an interaction with the page.
Each event property can be a boolean or a string. When set to false, Chord won't send that event automatically. To customize the DOM element that triggers the event, set the matching event property to the DOM selector you want to use. That selector will be passed to document.querySelectorAll(selector) and an event listener will be added that the library will use to trigger the event. If the selector is a <form> element, the event will be triggered when the form is submitted. Otherwise, the event will be triggered when the element is clicked.
Property | Type | Required | Description |
autoInstrumentSelectors['Checkout Started'] | string or boolean | no | The default selector is form[action="/cart" i][method="post"]. |
autoInstrumentSelectors['Email Captured'] | string or boolean | no | The default selector is form[action="/contact#contact_form" i][method="post"], form[action="/contact#contactform" i][method="post"]. |
autoInstrumentSelectors['Product Clicked'] | string or boolean | no | The default selector is a[href*="/products/" i]. |
Metadata
This required object provides metadata about the event context that is appended to every event. Chord uses this metadata when providing insights.
Property | Type | Required | Description |
metadata.i18n.currency | string | yes | The order currency in ISO 4217 currency code, uppercase. For example, USD. |
metadata.i18n.locale | string | yes | The order locale. For example, en-US. |
metadata.ownership.omsId | string | yes | A UUID assigned by Chord. This identifier is unique to the store, and will be the same across every environment and Segment source for a given store. |
metadata.ownership.storeId | string | yes | A UUID assigned by Chord. This identifier is unique to the store, and will be the same across every environment and Segment source for a given store. |
metadata.ownership.tenantId | string | yes | A UUID assigned by Chord. This identifier is unique to the store, and will be the same across every environment and Segment source for a given store. |
metadata.platform.name | string | yes | The name of the e-commerce platform used. For example, Shopify. |
metadata.platform.type | string | yes | The type of platform where the event originated. Either web or pos. |
metadata.store.domain | string | yes | The store slug that comes before .myshopify.com. |
Sync Identifiers
This optional object allows Chord's library to save identifiers from other libraries and integrations as attributes on the cart. Chord will use these attributes to connect your front-end website events with your server events. Read more about this in Unifying Data Across Sourcesο»Ώ.
Each integration defaults to false. Set the integration to true if you plan to send both front-end and server events to the integration via the CDP.
Currently, only the Google Analytics 4 identifier is supported. Contact Chord to request help adding more identifiers.
Property | Type | Required | Description |
syncIdentifiers['Google Analytics 4'] | boolean | no | When set to true, adds the client ID from the _ga cookie as a cart attribute. Chord will include this client ID on server events for the order, so sessions can be tied together in GA4. |
ο»Ώ