=== AddonLogic Referrer Tracking ===
Contributors: snehalpancholi
Tags: referrer, traffic sources, analytics, visitors, SEO
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

Logs HTTP referrers of front-end visits and shows a grouped admin report of traffic sources — search engines, social media, and direct links.

== Description ==

AddonLogic Referrer Tracking captures the HTTP Referer header on every public page visit and aggregates it by referring domain. Smart categorisation automatically labels well-known sources such as Google Search, Bing, Facebook, Twitter / X, LinkedIn, Reddit, YouTube, Pinterest, and more.

The admin report (Tools → Referrer Sources) shows:

* Summary cards: unique sources, total visits, today's visits, and top source.
* A horizontal CSS bar chart of your top 10 traffic sources.
* A sortable table with per-source visit counts, weekly activity, first/last seen dates, and one-click delete.
* Pagination and search to navigate large datasets.
* A "Clear All Data" action with confirmation.

All data is stored in a single lightweight custom table using WordPress dbDelta. No external services, no tracking pixels, no JavaScript beacons — just server-side HTTP header analysis.

**Key Features**

* Automatic categorisation of search engines, social platforms, and custom domains.
* Self-referral filtering: internal page-to-page navigation is ignored.
* Daily visit bucketing stored as compact JSON (pruned to 30 days) for the weekly column.
* Zero dependencies — vanilla JavaScript, no jQuery.
* Responsive admin UI with dark-mode support.
* GPLv2 licensed, suitable for WordPress.org or commercial distribution.

== Installation ==

1. Upload the `referrer-tracking` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Navigate to **Tools → Referrer Sources** to view your report.
4. Visit some front-end pages from an external link (e.g. share a URL on social media or click a search result) to start populating data.

== Frequently Asked Questions ==

= Does it track admin pages? =
No. Only public (non-admin) front-end page visits are tracked. Admin, AJAX, and cron requests are ignored.

= Does it count my own navigation? =
No. If the referrer domain matches your site's domain, the visit is silently skipped.

= How long is daily data kept? =
Per-day counts inside `daily_json` are pruned to the most recent 30 days on every write. The cumulative `hits` total is never pruned.

= Is any data sent to a third party? =
No. All data stays in your own database. The plugin only makes outbound requests to the AddonLogic update API to check for plugin updates.

= Does it require WooCommerce or any other plugin? =
No. It works with any WordPress installation.

== Screenshots ==

1. Summary cards showing unique sources, total visits, today's visits, and top source.
2. Top 10 traffic sources horizontal bar chart.
3. Sortable referrer sources table with type badges and delete controls.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release. No upgrade steps required.
