The Scroll Tracking Module allows site owners to monitor how far visitors scroll down different pages. Currently is it very simple and records the maximum depth viewed, in the future it may also record if an element of the page was clicked. This would help identify if a visitor clicked a CTA at the top of the page or clicked back and left your site.

General Settings

  • Enable Scroll Tracking: Master on/off switch for the entire module
  • Auto-Inject Script: Automatically loads tracking on all pages (recommended for block themes, see below for manual method)
  • Test Mode: Logs tracking data to browser console instead of database (great for debugging)
  • Update Interval: How often to check and update scroll depth (default: 10 seconds, minimum: 3 seconds)

Privacy & Filtering

  • Exclude Logged-in Admins: Don’t track administrators when logged in (enabled by default)
  • Excluded IP Addresses: Enter IP addresses to exclude from tracking (one per line). Your current public IP is shown for convenience.

Data Management

  • Data Retention: Automatically delete entries older than this many days (default: 30, prevents database bloat)
Image

The Scroll Tracking Summary screen can be accessed from the main menu via ToggleWP > Scroll Summary.

This summary lists the total entries and within the last 7 days. From the top you can “Export Last XX Days to CSV” or “Delete All Data”.

Pages with scroll activity are listed below, showing the page title, URL, total views and average scroll depth. For each page you can click “View Details” to find out more.

Image
Scroll tracking summary

In this example I clicked on the Home page of my development site. The Scroll Depth Distribution shows the percentage of logged views and the range of the page they saw.

Ranges are broken down into:

  • No Scroll (0%)
  • 1 – 25%
  • 26 – 50%
  • 51 – 75%
  • 76 – 100%

Each visit is saved with the User Agent. No client IP or device fingerprint is stored. In the below example I visited the one page 5 times during the day (while testing) which resulted in 5 entries. Scroll Tracking will not attempt to combine different views to provide a maximum scroll depth.

Image

Manual Script Injection

For page builders or specific pages where auto-injection might not work, use the shortcode:

[wat_scroll_tracker]

Where to use:

  • Add to page content in your page builder
  • Insert in a custom HTML block
  • Place in a template using: do_shortcode(‘[wat_scroll_tracker]’)

How It Works

  1. Page Load: Script generates a unique session ID
  2. Initial Track: Records the initial scroll position when page loads
  3. Periodic Updates: Every 10 seconds (configurable), checks if scroll depth increased
  4. Smart Updates: Only sends data when scroll depth is higher than previous maximum
  5. Exit Tracking: Uses sendBeacon API to capture final scroll depth when leaving page
  6. Daily Cleanup: WordPress cron automatically deletes old entries

Viewing Reports

Access scroll tracking data in multiple ways:

  • Main Summary: Go to ToggleWP > Scroll Summary
  • Quick Access: Hover over any post/page in WordPress and click “Scroll Summary” in the admin bar
  • Export Data: Download CSV reports with date range filtering

Understanding Scroll Depth Ranges

  • No Scroll (0%): Visitor didn’t scroll at all
  • 1-25%: Light engagement, saw top portion only
  • 26-50%: Moderate engagement, read first half
  • 51-75%: Good engagement, read most content
  • 76-100%: High engagement, scrolled to bottom

Performance & Security

  • Rate Limiting: Maximum 100 requests per IP per hour
  • Session Validation: Only accepts valid UUID v4 format session IDs
  • Input Sanitization: All data sanitized before database storage
  • Honeypot Field: Detects and blocks bot submissions
  • Referrer Check: Validates requests come from your domain

Troubleshooting

Script not loading?

  • Check “Enable Scroll Tracking” is enabled
  • Verify you’re not logged in as admin (if “Exclude Logged-in Admins” is enabled)
  • Try the shortcode method if auto-injection fails

Not seeing data?

  • Disable “Test Mode” to start recording to database
  • Check your IP isn’t in the exclusion list
  • Visit a page with enough content to scroll
  • Wait 10 seconds for the first update to send