API Reference
trackCartViewed
The trackCartViewed method sends a "Cart Viewed" event to the CDP.
chord.trackCartViewed({ cart }): Promise<void>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. |
trackCheckoutStarted
The trackCheckoutStarted method sends a "Checkout Started" event to the CDP.
chord.trackCheckoutStarted({ checkout }): Promise<void>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. |
trackCheckoutStepCompleted
The trackCheckoutStepCompleted method sends a "Checkout Step Completed" event to the CDP.
chord.trackCheckoutStepCompleted({
checkoutId,
step,
paymentMethod,
shippingMethod,
})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. |
trackCheckoutStepViewed
The trackCheckoutStepViewed method sends a "Checkout Step Viewed" event to the CDP.
chord.trackCheckoutStepViewed({
checkoutId,
step,
paymentMethod,
shippingMethod,
})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. |
trackCouponApplied
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.
chord.trackCouponApplied({
cartId,
couponId,
couponName,
discount,
orderId,
})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 |
trackCouponDenied
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.
chord.trackCouponDenied({
cartId,
couponId,
couponName,
orderId,
reason,
})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 |
trackCouponEntered
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.
chord.trackCouponEntered({
cartId,
couponId,
couponName,
discount,
orderId,
})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 |
trackCouponRemoved
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.
chord.trackCouponRemoved({
cartId,
couponId,
couponName,
discount,
orderId,
})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 |
trackEmailCaptured
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.
chord.trackEmailCaptured({
email,
placementComponent,
placementPage
})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. |
trackLoginStarted
The trackLoginStarted method sends a "Login Started" event to the CDP.
chord.trackLoginStarted({
email,
})Property | Type | Required | Description |
|---|---|---|---|
string | no | The email used for login. |
trackNavigationClicked
The trackNavigationClicked method sends a "Navigation Clicked" event to the CDP.
chord.trackNavigationClicked({
category,
label,
navigationPlacement,
navigationTitle,
navigationUrl,
})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. |
trackOrderCompleted
The trackOrderCompleted method sends a "Order Completed" event to the CDP.
chord.trackOrderCompleted({
orderId,
orderDate,
currency,
revenue,
total,
products
})Property | Type | Required | Description |
|---|---|---|---|
orderId | string | yes | The ID of the order. |
orderDate | string | yes | The date order was completed. |
currency | string | yes | The currency of the order. |
revenue | number | yes | The revenue associated with the transaction |
total | number | yes | The revenue with discounts and coupons added in. |
products | array of products | yes | The products in the order. |
trackPaymentInfoEntered
The trackPaymentInfoEntered method sends a "Payment Info Entered" event to the CDP.
chord.trackPaymentInfoEntered({
checkoutId,
coupon,
currency,
orderId,
paymentMethod,
products,
shippingMethod,
step,
value,
})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. |
trackProductAdded
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.
chord.trackProductAdded({
cart,
product: {
position,
product,
quantity,
variantId
}
})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. |
trackProductClicked
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.
chord.trackProductClicked({
cart,
listId,
listName,
product: {
position,
product,
quantity,
variantId
}
})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. |
trackProductListFiltered
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 |
chord.trackProductListFiltered({
category,
listId,
listName,
filters,
sorts
})trackProductListViewed
The trackProductListViewed method sends a "Product List Viewed" event to the CDP. This event should be sent when a list of products is viewed.
chord.trackProductListViewed({
category,
listId,
listName,
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 |
products | array of products | yes | Products being viewed |
trackProductRemoved
The trackProductRemoved method sends a "Product Removed" event to the CDP. This event should be sent when a product is removed from the cart.
chord.trackProductRemoved({
cart,
lineItem
})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. |
trackProductViewed
The trackProductViewed method sends a "Product Viewed" event to the CDP. This event should be sent whenever a product page is viewed.
chord.trackProductViewed({
cart,
product: {
position,
product,
quantity,
variantId
}
})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. |
trackProductsSearched
The trackProductsSearched method sends a "Products Searched" event to the CDP. This event should be sent whenever a search is submitted.
chord.trackProductsSearched({
currency,
price,
productId,
quantity,
query,
})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 |
trackSignedIn
The trackSignedIn method sends a "Signed In" event to the CDP. This event should be sent when the customer signs in successfully.
chord.trackSignedIn({
email,
method
})Property | Type | Required | Description |
|---|---|---|---|
string | no | The user's email | |
method | string | no | The method used |
trackSignedOut
The trackSignedOut method sends a "Signed Out" event to the CDP. This event should be sent when the customer signs out successfully.
chord.trackSignedOut({
email
})Property | Type | Required | Description |
|---|---|---|---|
string | no | The user's email |
trackSignedUp
The trackSignedUp method sends a "Signed Up" event to the CDP. This event should be sent when the customer signs up successfully.
chord.trackSignedUp({
email,
method
})Property | Type | Required | Description |
|---|---|---|---|
string | no | The user's email | |
method | string | no | The method used |
trackSubscriptionCancelled
The trackSubscriptionCancelled method sends a "Subscription Cancelled" event to the CDP.
chord.trackSubscriptionCancelled({
actionableDate,
address,
brand,
email,
endDate,
intervalLength,
intervalUnits,
products,
state,
subscriptionId,
currency,
})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. |
trackVariantClicked
The trackVariantClicked method sends a "Variant Clicked" event to the CDP.
chord.trackVariantClicked({
product,
cart,
lineItemId,
coupon,
})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. |
identify
The identify method sends an identify event to the CDP:
chord.identify(userId, { ...traits })
// or
chord.identify({ ...traits })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.
reset
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.
track
The track method sends a track event to the CDP:
chord.track('Navigation Clicked', {
label: 'Home',
location: 'main nav',
url: '/'
})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.