API Reference
The trackCartViewed method sends a "Cart Viewed" event to the CDP.
The library will call the cart formatter with the cart argument and use the returned object to construct and send the "Cart Viewed" event.
Property | Type | Required | Description |
---|---|---|---|
cart | any | yes | An object representing the current cart. |
The trackCheckoutStarted method sends a "Checkout Started" event to the CDP.
The library will call the checkout formatter with the checkout argument and use the returned object to construct and send the "Checkout Started" event.
Property | Type | Required | Description |
---|---|---|---|
checkout | any | yes | An object representing the current checkout. |
The trackCheckoutStepCompleted method sends a "Checkout Step Completed" event to the CDP.
Property | Type | Required | Description |
---|---|---|---|
checkoutId | string | yes | The ID of the checkout. |
step | number | yes | The checkout step number. |
paymentMethod | string | no | The payment method used. |
shippingMethod | string | no | The shipping method selected. |
The trackCheckoutStepViewed method sends a "Checkout Step Viewed" event to the CDP.
Property | Type | Required | Description |
---|---|---|---|
checkoutId | string | yes | The ID of the checkout. |
step | number | yes | The checkout step number. |
paymentMethod | string | no | The payment method used. |
shippingMethod | string | no | The shipping method selected. |
The trackCouponApplied method sends a "Coupon Applied" event to the CDP. This event should be sent immediately after the coupon has been successfully applied to the cart.
Property | Type | Required | Description |
---|---|---|---|
cartId | string | no | Cart ID, if applicable |
couponId | string | no | Coupon ID |
couponName | string | no | Coupon name |
discount | number | no | Monetary discount applied through the coupon |
orderId | string | no | Order or transaction ID, if applicable |
The trackCouponDenied method sends a "Coupon Denied" event to the CDP. This event should be sent when a coupon could not be applied to the cart.
Property | Type | Required | Description |
---|---|---|---|
cartId | string | no | Cart ID, if applicable |
couponId | string | no | Coupon ID |
couponName | string | no | Coupon name |
orderId | string | no | Order or transaction ID, if applicable |
reason | string | no | Reason the coupon was denied |
The trackCouponEntered method sends a "Coupon Entered" event to the CDP. This event should be sent immediately after the coupon was entered, usually upon the customer clicking a button to submit, but before the coupon was applied or denied.
Property | Type | Required | Description |
---|---|---|---|
cartId | string | no | Cart ID, if applicable |
couponId | string | no | Coupon ID |
couponName | string | no | Coupon name |
orderId | string | no | Order or transaction ID, if applicable |
The trackCouponRemoved method sends a "Coupon Removed" event to the CDP. This event should be sent immediately after the coupon was removed from the cart.
Property | Type | Required | Description |
---|---|---|---|
cartId | string | no | Cart ID, if applicable |
couponId | string | no | Coupon ID |
couponName | string | no | Coupon name |
orderId | string | no | Order or transaction ID, if applicable |
The trackEmailCaptured method sends an "Email Captured" event to the CDP. This event should be sent anywhere a customer enters an email address, like a newsletter sign-up or a product wait list.
Property | Type | Required | Description |
---|---|---|---|
string | no | The email address that was captured. | |
placementComponent | string | no | An identifier for the UI component where the email was captured. For example, footer-newsletter. |
placementPage | string | no | An identifier for the page where the email was captured. For example, homepage. |
The trackLoginStarted method sends a "Login Started" event to the CDP.
Property | Type | Required | Description |
---|---|---|---|
string | no | The email used for login. |
The trackNavigationClicked method sends a "Navigation Clicked" event to the CDP.
Property | Type | Required | Description |
---|---|---|---|
category | string | no | The category of the navigation item. |
label | string | no | The label of the navigation item. |
navigationPlacement | string | no | The placement of the navigation (e.g. header, footer). |
navigationTitle | string | no | The title of the navigation. |
navigationUrl | string | no | The URL of the navigation item. |
The trackPaymentInfoEntered method sends a "Payment Info Entered" event to the CDP.
Property | Type | Required | Description |
---|---|---|---|
checkoutId | string | no | The ID of the checkout. |
coupon | string | no | The coupon code applied to the order. |
currency | string | no | The currency of the order. |
orderId | string | no | The ID of the order. |
paymentMethod | string | no | The payment method used. |
products | array of products | no | The products in the order. |
shippingMethod | string | no | The shipping method selected. |
step | number | yes | The checkout step number. |
value | number | no | The total value of the order. |
The trackProductAdded method sends a "Product Added" event to the CDP. This event should be sent when a product is added to the cart. It should only be sent when the product is initally added, not when the quantity is incremented for an existing cart item.
Property | Type | Required | Description |
---|---|---|---|
cart | any | yes | The current cart. |
product.position | number | no | The position in a list of the product that was added, if relevant. |
product.product | any | yes | Product and variant details, like product name and variant SKUs. |
quantity | number | no | The quantity of the product added to the cart. |
variantId | any | no | The unique identifier of the product variant. |
The trackProductClicked method sends a "Product Clicked" event to the CDP. This event should be sent when a product link is clicked on the site.
Property | Type | Required | Description |
---|---|---|---|
cart | any | yes | The current cart. |
listId | any | no | An identifier for the list where the product was clicked. |
listName | string | no | A name for the list where the product was clicked. |
product.position | number | no | The position in a list of the product that was clicked, if relevant. |
product.product | any | yes | Product and variant details, like product name and variant SKUs. |
quantity | number | no | The quantity of the product clicked, if relevant. |
variantId | any | no | The unique identifier of the product variant. |
The trackProductListFiltered method sends a "Product List Filtered" event to the CDP. This event should be sent when a filter is applied to a list of products.
Property | Type | Required | Description |
---|---|---|---|
category | string | no | Product category being viewed |
listId | string | no | The ID of the list in which the item was presented to the user |
listName | string | no | The name of the list in which the item was presented to the user |
filters | array of { type?:string, value?: string} | no | Product filters selected by the customer |
sorts | array of { type?:string, value?: string} | no | Product sorts selected by the customer |
The trackProductListViewed method sends a "Product List Viewed" event to the CDP. This event should be sent when a list of products is viewed.
Property | Type | Required | Description |
---|---|---|---|
category | string | no | Product category being viewed |
listId | string | no | The ID of the list in which the item was presented to the user |
listName | string | no | The name of the list in which the item was presented to the user |
products | array of products | yes | Products being viewed |
The trackProductRemoved method sends a "Product Removed" event to the CDP. This event should be sent when a product is removed from the cart.
Property | Type | Required | Description |
---|---|---|---|
cart | any | yes | An object representing the cart after the line item was removed. |
lineItem | any | yes | An object representing the line item that was removed. |
The trackProductViewed method sends a "Product Viewed" event to the CDP. This event should be sent whenever a product page is viewed.
Property | Type | Required | Description |
---|---|---|---|
cart | any | yes | The current cart. |
product.position | number | no | The position in a list of the product that was added, if relevant. |
product.product | any | yes | Product and variant details, like product name and variant SKUs. |
quantity | number | no | The quantity of the product added to the cart. |
variantId | any | no | The unique identifier of the product variant. |
The trackProductsSearched method sends a "Products Searched" event to the CDP. This event should be sent whenever a search is submitted.
Property | Type | Required | Description |
---|---|---|---|
currency | string | no | Currency of the transaction (must be a valID ISO 4217 three-digit currency code) |
price | number | no | Price ($) of the product searched for |
productId | any | no | Database ID of the product searched for |
quantity | number | no | Quantity of the product searched for |
query | string | no | Query the user searched with |
The trackSignedIn method sends a "Signed In" event to the CDP. This event should be sent when the customer signs in successfully.
Property | Type | Required | Description |
---|---|---|---|
string | no | The user's email | |
method | string | no | The method used |
The trackSignedOut method sends a "Signed Out" event to the CDP. This event should be sent when the customer signs out successfully.
Property | Type | Required | Description |
---|---|---|---|
string | no | The user's email |
The trackSignedUp method sends a "Signed Up" event to the CDP. This event should be sent when the customer signs up successfully.
Property | Type | Required | Description |
---|---|---|---|
string | no | The user's email | |
method | string | no | The method used |
The trackSubscriptionCancelled method sends a "Subscription Cancelled" event to the CDP.
Property | Type | Required | Description |
---|---|---|---|
actionableDate | string | no | The date when the subscription can be actioned. |
address | Address | no | The address associated with the subscription. |
brand | string | no | The brand associated with the subscription. |
string | no | The email associated with the subscription. | |
endDate | string | no | The end date of the subscription. |
intervalLength | number | no | The length of the subscription interval. |
intervalUnits | string | no | The units of the subscription interval (e.g. month, year). |
products | array of products | no | The products in the subscription. |
state | string | no | The state of the subscription (e.g. active, cancelled). |
subscriptionId | string | no | The ID of the subscription. |
currency | string | no | The currency of the subscription. |
The trackVariantClicked method sends a "Variant Clicked" event to the CDP.
Property | Type | Required | Description |
---|---|---|---|
product | any | yes | The product variant that was clicked. |
cart | any | yes | The cart associated with the event. |
lineItemId | string | no | The ID of the line item. |
coupon | string | no | The coupon code applied to the cart. |
The identify method sends an identify event to the CDP:
We recommend sending an identify event whenever the following happens:
- After a user creates an account
- After a user logs into their account
- When a user submits any identifying information, like an email address or a phone number
- When a user adds or updates profile information
It’s not typically necessary to send an identify event on page load.
If you’re sending a track event at the same time as an identify event, we recommend sending identify first and the track event second. Some integrations require an identify event before they can process track events.
The reset method sends a reset event to the CDP tracking library. This does not result in an event appearing in the CDP. It resets the user’s session in the browser, which means the user will receive a new anonymous identifier and any previous user data will be cleared.
We recommend calling the reset method after a user has successfully logged out of their account.
The track method sends a track event to the CDP:
track can be used to send any event to the CDP, including events in the Chord tracking plan. However, we recommend using an event-specific method like trackProductViewed instead if one is available, so that Chord's library can construct the event body to match the tracking plan. See the individual event tracking methods above. track does not use event or object formatters and simply sends the second argument directly to the CDP as the event body.
track does not transform property names from camel case to snake case; event properties will be sent to the CDP exactly as written. We recommend using snake case for all event properties. null values will be stripped by default unless stripNull is set to false in the ChordAnalytics options.