Scroll Depth

Automatic tracking of how far users scroll on each page.

How It Works

Palace Tracker automatically monitors scroll behavior throughout the user's visit. The maximum scroll depth reached on each page is recorded and sent when the user navigates away or closes the page.

Scroll depth is calculated as a percentage (0-100%) representing how far down the page the user scrolled relative to the total document height.

Data Collected

The scroll depth data is included in the page_exit event:

{
  "eventType": "page_exit",
  "data": {
    "duration": 45,
    "maxScrollDepth": 87
  }
}

In this example, the user scrolled to 87% of the page's total height.

Use Cases

Scroll depth tracking helps you understand:

  • Content engagement - Are users reading your full articles?
  • Page optimization - Where do users typically stop scrolling?
  • Content placement - Is important content visible to most users?
  • Page length - Are pages too long or too short?

Technical Details

The tracker listens to scroll events and continuously updates the maximum scroll depth reached. The final value is sent just before the user leaves the page (via the beforeunload event).

For single-page applications, the scroll depth resets to 0 when navigating to a new route, and a new maximum is tracked for each page.