Overview
TheTrackScroll component monitors page scroll depth and tracks when users reach specific percentage milestones. Perfect for understanding content engagement and reading behavior.
Props
The content to render. The component tracks global page scroll, not scrolling within its children.
Array of percentage milestones to track. Each milestone is tracked only once per session.
Usage
Basic Scroll Tracking
Custom Milestones
Blog Post Engagement
Landing Page Analytics
Tracked Events
scroll_milestone
Tracked when a user reaches a scroll depth milestone:Behavior
- Tracks global window scroll, not container scroll
- Each milestone is tracked only once per component instance
- Uses passive scroll listeners for optimal performance
- Automatically cleans up event listeners on unmount
- Renders children as a React Fragment (no wrapper element)
- Calculates scroll percentage based on total document height
Use Cases
- Measure content engagement on long pages
- Track blog post reading depth
- Identify where users lose interest
- Optimize content placement based on scroll data
- A/B test content length and layout
- Monitor landing page effectiveness
- Trigger actions at specific scroll depths