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.
Results in a Cart Viewed trackevent in Segment.
Example:
Results in a Collection Clicked track event in Segment.
Example:
Results in a Email Captured track event in Segment.
Example:
Results in a Product Clicked track event in Segment.
Example:
Results in a Product List Filtered track event in Segment.
Example:
Results in a Product List Viewed track event in Segment.
Example:
Results in a Product Viewed track event in Segment.
Example:
Results in a Promotion Clicked track event in Segment.
Example:
Results in a Promotion Viewed track event in Segment.
Example:
Results in a Stock Request Created track event in Segment.
Example: