Insights
A lightweight analytics library designed for modern web applications. Insights provides automatic tracking with minimal setup - add a single script tag with your channel configuration to start collecting comprehensive analytics data.
Collected data flows into THG’s analytics infrastructure, where it drives reporting and business intelligence.
Key Features
- Simple Setup: Single script tag with channel, subsite, and storefront configuration
- Automatic Page Views: Tracks navigation and page context with zero configuration
- Core Web Vitals: Automatic tracking of FCP, LCP, CLS, INP, and TTFB
- Session Tracking: Automatic tracking of viewport changes, scroll depth, and tab visibility
- Attribution Tracking: UTM parameters and referrer data captured automatically
- A/B Testing Support: Automatically captures experiment assignments when configured
- Dynamic Content Support: Automatically detects new elements added to the page for impression tracking
- HTML Attribute Tracking: Track clicks and impressions with simple
data-insights-*attributes - Framework Agnostic: Works with any JavaScript front-end web application framework
- Zero Configuration: Authentication, batching, and transmission handled automatically
When to Use the JavaScript API
For most tracking needs, HTML attributes are sufficient. Use the JavaScript API when you need to:
- Track events that don’t correspond to a DOM element (e.g., hover, scroll depth)
- Track events on dynamically generated content where attributes can’t be applied
- Integrate with existing event handlers or analytics logic
Next Steps
- Installation - Add the script tag to your application
- Page Types - Configure page type tracking for richer analytics
- Event Tracking - Track user interactions with HTML attributes
- JavaScript API - Programmatic tracking for advanced scenarios