website logo
Navigate through spaces
⌘K
OVERVIEW
ORDER MANAGEMENT (OMS)
SHIPPING - SETUP
Shipping Methods
Shipping Zones
Shipping Method Setup Examples
TAXES - Setup
Tax Automation with Stripe Tax
Tax Automation with Avalara
CONTENT MANAGEMENT (CMS)
DATA
CUSTOMER LIFETIME REVENUE
Customer Lifetime Revenue Explanation
Customer Lifetime Revenue and Purchase Likelihood
Recency Frequency and Monetary
CLR and RFM Data Table Glossary
RFM and CLR in the Hub
LOOKER
Modifying a Dashboard
Timestamp differences between Looker, OMS and Shopify
How to create custom calculations in Looker
Looker and Shopify data models
Custom fields
How to 'Save and Schedule' reports
Creating Custom Reports or Look
Looks vs Dashboards
Login Looker FAQ
Looker Glossary
SEGMENT EVENT TRACKING
What are event tracking
Adding Tracking
What is the Tracking Plan?
The Chord Tracking Plan
The Shopify Tracking Plan
Event Tracking FAQ
EVENT UPDATES PAGE
Email Subscription Payment Event Update
Product Feed Setup
Getting Segment to Production
Consent Management
Installing in Next.js
Installing in Gatsby
Integrations
👩‍💻Developer Tools
Using Chord with Shopify
Docs powered by archbee 

useAnalytics

14min

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 03 Mar 2023
Did this page help you?
Yes
No
PREVIOUS
SDK Reference
NEXT
useAuth
Docs powered by archbee 
useAnalytics