Method Signature
Parameters
Parameters for the recommendation view event
Optional parameters for the network request
Returns
Returnstrue on success or an Error object if validation fails.
Examples
Basic Example
Complete Example
Integration Example
Example with Seed Items
Multiple Recommendation Pods Example
When to Use
CalltrackRecommendationView() when:
- A recommendation widget becomes visible on the page
- Recommendations are loaded and rendered
- A user scrolls to view a recommendation pod
- A carousel or slider with recommendations is displayed
Important Notes
- Always include the
resultIdfrom Constructor.io’s recommendations response - Track when recommendations become visible, not just when they’re loaded
- The
podIdshould match the pod ID used in the recommendations API call - The
numResultsViewedshould reflect how many items are actually visible - Use Intersection Observer API to track visibility accurately
Pod ID Examples
Common pod IDs:"home_page_recommendations"- Homepage recommendations"pdp_similar_items"- Similar items on product pages"pdp_frequently_bought_together"- Frequently bought together"cart_page_recommendations"- Recommendations on cart page"recently_viewed"- Recently viewed items
Seed Items
For item-based recommendations, include the seed item(s):Tracking Visibility
Use Intersection Observer to track when recommendations become visible:Relationship with Other Events
Track these events in sequence:- trackRecommendationView - When recommendations are displayed (this method)
- trackRecommendationResultClick - When user clicks a recommendation
- trackConversion - If the click leads to a conversion
API Endpoint
This method sends aPOST request to:
Related Methods
- trackRecommendationResultClick - Track recommendation clicks
- trackBrowseResultsLoaded - Track browse results
- trackSearchResultsLoaded - Track search results