Overview
Tracking events at each stage of the user journey—from seeing products to clicking them—provides the data needed for analytics and recommendation improvements.Event Flow
Tracking Search Results
Basic Implementation
Full Parameters
Tracking Recommendations
Tracking Clicks
Track when a user clicks on a product:The
position parameter is 0-indexed and represents where the product appeared in the results. This is crucial for understanding if users click items at position 1 vs position 20.Tracking Views (Viewability)
Track when a product becomes visible to the user. Standard viewability requires:- At least 50% of the product visible
- Visible for at least 1 second
Using Intersection Observer
Using Auto Track Plugin
For simpler implementation, use the AutoTrackPlugin:Tracking Add to Cart
Track when a user adds a product to their cart:Low-Level Tracking
For custom scenarios, usetrackItemsServed directly:
Parameters
string
required
Where products are displayed. Common values:
search_results, product_page, home_page, category_page, cart_page.string
required
How products were generated. Values:
text-search, image-search, similar-items, visitor-recs, user-recs, plp, curated.string[]
required
Array of product IDs being served.
string
The search query, if applicable.
number
Total available results before pagination.
object
Custom key-value pairs for additional context.
Complete Page Implementation
Best Practices
Next Steps
Conversion Tracking
Track purchases and attribution
Auto Track Plugin
Automatic event tracking