=== AddonLogic Scroll-depth Tracker ===
Contributors: snehalpancholi
Tags: scroll tracking, analytics, engagement, depth, posts
Requires at least: 6.0
Tested up to: 6.7
Stable tag: 1.0.0
Requires PHP: 8.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Records how far visitors scroll on your posts and pages, tracking 25%, 50%, 75%, and 100% depth milestones with a visual admin report.

== Description ==

AddonLogic Scroll-depth Tracker silently listens to visitor scroll behaviour and records the first time each milestone (25%, 50%, 75%, 100%) is reached for every post or page. Hit counts are aggregated in a lightweight custom database table and presented as a clean, colour-coded analytics report under **Tools > Scroll Depth**.

**Key Features**

* Tracks four scroll-depth milestones: 25%, 50%, 75%, and 100%.
* Aggregates milestone hit counts per post — no individual visitor rows.
* Visual funnel bars per post showing the drop-off at each milestone.
* Colour-coded milestone cells so low-engagement posts are immediately visible.
* Per-post totals and global summary cards (total posts tracked, total scroll events).
* "Clear All Data" button for a fresh start.
* Auto-cleanup: deletes data for posts when they are permanently deleted.
* Zero jQuery — pure vanilla JavaScript front-end tracker.
* Scroll events are throttled (200 ms) and deduplicated per session via a JS Set.
* Self-hosted automatic updates via the AddonLogic update server.

== Installation ==

1. Upload the `scroll-depth-tracker` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** screen.
3. Navigate to **Tools > Scroll Depth** to see the analytics report.
4. No configuration required — tracking begins immediately.

== Frequently Asked Questions ==

= Does this store data about individual visitors? =
No. Only aggregate hit counts are stored — the table records one row per post per milestone, incrementing a counter. No IP addresses, cookies, or personal data are collected.

= Does it work on pages as well as posts? =
Yes. Any `is_singular()` URL (posts, pages, custom post types) is tracked.

= Will it slow down my site? =
No. The JavaScript file is small, dependency-free, and uses a passive scroll listener with requestAnimationFrame throttling. The AJAX request fires once per milestone per page load.

= What happens to data when I delete a post? =
All scroll-depth rows for that post are automatically deleted via the `delete_post` hook.

= Can I reset the data? =
Yes. Visit **Tools > Scroll Depth** and click **Clear All Scroll Data** at the bottom of the page.

== Screenshots ==

1. **Report Table** — Post titles with milestone hit counts and funnel bars.
2. **Summary Cards** — Total posts tracked and total scroll events at a glance.
3. **Funnel Bar** — Stacked colour bars visualising the drop-off through each depth milestone.

== Changelog ==

= 1.0.0 =
* Initial release.
* Four milestone tracking: 25%, 50%, 75%, 100%.
* Visual admin report under Tools > Scroll Depth.
* Colour-coded cells with intensity driven by hit count.
* CSS stacked bar funnel per post.
* Auto-cleanup on post deletion.
* AddonLogic self-hosted update support.

== Upgrade Notice ==

= 1.0.0 =
Initial release. No upgrade steps required.
