website logo
Navigate through spaces
Chord Commerce
⌘K
Getting Started
CMS
Data
OMS
Integrations
👩‍💻Developer Tools
Shopify
Docs powered by archbee 

useAnalytics

The useAnalytics hook returns a series of methods that fire a tracking event to Segment, our integrated customer data platform.

Most Segment tracking is done automatically by the SDK. For example, when you use the addToCart method (see useCart), a corresponding track API call to Segment is made. However, some track calls need to be closely tied to the UI, as in the case of tracking clicks on elements, and these calls need to be explicitly made from your React components. Methods for making these calls are available via the useAnalytics hook and listed below.

useAnalytics

trackCartViewed()

Results in a Cart Viewed trackevent in Segment.

Example:

trackCartViewed

trackCollectionClicked()

Results in a Collection Clicked track event in Segment.

Example:

trackCollectionClicked

trackEmailCaptured()

Results in a Email Captured track event in Segment.

Example:

trackEmailCaptured

trackProductClicked()

Results in a Product Clicked track event in Segment.

Example:

trackProductClicked

trackProductListFiltered()

Results in a Product List Filtered track event in Segment.

Example:

trackProductListFiltered

trackProductListViewed()

Results in a Product List Viewed track event in Segment.

Example:

trackProductListViewed

trackProductViewed()

Results in a Product Viewed track event in Segment.

Example:

trackProductViewed

trackPromotionClicked()

Results in a Promotion Clicked track event in Segment.

Example:

trackPromotionClicked

trackPromotionViewed()

Results in a Promotion Viewed track event in Segment.

Example:

trackPromotionClicked

trackStockRequestCreated()

Results in a Stock Request Created track event in Segment.

Example:

trackStockRequestCreated
Updated 09 Nov 2022
Did this page help you?
Yes
No
UP NEXT
useAuth
Docs powered by archbee 
useAnalytics