=== WhatsLink Click Tracker ===
Contributors: sani060913
Tags: whatsapp, telegram, analytics, utm, tracking
Requires at least: 6.0
Tested up to: 7.1
Stable tag: 1.5.9
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Track WhatsApp, Telegram, and phone clicks in WordPress — links, buttons, and chat widgets. See which pages and campaigns start conversations.

== Description ==

You have a WhatsApp button, a Telegram link, or a "Call us" number on your site. People click them. But you have no idea which page starts the most conversations, which campaign is worth running again, or whether your homepage button even gets used.

**WhatsLink Click Tracker** fixes that.

Install it, activate it, and every click on a WhatsApp, Telegram, or phone link is logged automatically — post title, page URL, click date, UTM source, UTM campaign, UTM medium, and referrer. No code changes. No Google Tag Manager. No custom events.

### Three channels, one click log

* **WhatsApp** — `wa.me`, `api.whatsapp.com`, WhatsApp Web (`web.whatsapp.com`), and app links (`whatsapp://`)
* **Telegram** — `t.me` links
* **Phone calls** — `tel:` links, such as "Call us" buttons

Plain links, buttons, and chat widgets that open WhatsApp from JavaScript are all tracked, on any theme and any page builder.

---

### Works with popular WhatsApp button plugins

WhatsLink adds analytics to your existing WhatsApp button plugin — without replacing or modifying it. Tested with:

* **Click to Chat for WhatsApp** — the floating widget, shortcodes, and `ctc_chat` buttons
* **Joinchat** (formerly WhatsApp me by Creame) — the chat button and its chat window
* **Chaty** — the WhatsApp channel on mobile and desktop (WhatsApp Web)
* **WP Social Chat** — the floating WhatsApp button
* **Any manually added WhatsApp, Telegram, or phone link** — detected automatically

Just install WhatsLink alongside your existing button plugin. No configuration.

---

### What the free version gives you

* **Click log dashboard** — every WhatsApp, Telegram, and phone click with page title, URL, date, and UTM data
* **Live search and pagination** — find any click in seconds
* **Sortable columns** — sort by page, date, clicked link, or UTM values
* **UTM tracking** — source, medium, and campaign logged automatically
* **Referrer tracking** — see where traffic came from
* **Stats bar** — total clicks, last 30 days, and top page at a glance
* **Date range filter** — view logs for last 7 days, last 30 days, or all time
* **Top Pages** — see the 5 pages that start the most conversations
* **Badge counter** — shows total click counts next to each WhatsApp and Telegram button (visible to admins only)
* **One-click reset** — clear old data when needed
* **GDPR-friendly** — no IP addresses, no geolocation, no personal data

Works on posts, pages, WooCommerce products, and any other post type.

---

### Why upgrade to Pro?

The free version tells you *what* happened. Pro tells you *why* and helps you act on it.

👉 [WhatsLink Click Tracker Pro →](https://wpsani.store/downloads/whatslink-click-tracker-pro/?utm_source=wordpress_plugin&utm_medium=readme&utm_campaign=whatslink_tracker_pro)

**Pro adds:**

* Reports dashboard with date range and UTM source, medium, and campaign filters
* KPI overview — total clicks, unique links clicked, pages generating clicks, and UTM coverage
* Channel breakdown — WhatsApp vs Telegram vs phone
* Trend chart — daily click volume over time
* Top UTM sources chart, plus Top Pages and Top Clicked URLs tables
* CSV export — choose the date range and columns
* Real-time email notifications — get alerted on each new click
* Daily and weekly summary emails, with the full list attached as CSV
* Priority support

---

== Features ==

= FREE VERSION =

* Detects clicks on WhatsApp (wa.me, api.whatsapp.com, web.whatsapp.com, whatsapp://), Telegram (t.me), and phone (tel:) links
* Detects chat widgets that open WhatsApp from JavaScript (Click to Chat, Joinchat, WP Social Chat)
* Works on posts, pages, WooCommerce products, and custom post types
* Tracks post title, post type, permalink, clicked URL, and datetime
* Tracks utm_source, utm_medium, utm_campaign
* Tracks referrer
* Stats bar — total clicks, last 30 days, and top page on the dashboard
* Date range filter — All time, Last 30 days, Last 7 days
* Top Pages — 5 most-clicked pages with click counts
* AJAX dashboard with live search, pagination, and sortable columns
* Optional badge counter showing total clicks per link (visible to admins only)
* One-click log reset
* Lightweight — no external services, no tracking scripts
* GDPR-friendly: no IP or location data stored

= PRO VERSION =

* Report filters: date range, UTM source, UTM medium, UTM campaign
* KPI overview: total clicks, unique links clicked, pages generating clicks, UTM coverage
* Channel breakdown: WhatsApp, Telegram, phone
* Daily trend chart
* Top UTM sources chart, Top Pages and Top Clicked URLs tables
* CSV export with date range and column selection
* Real-time email notifications per click
* Daily and weekly summary emails with CSV attachment
* Priority support

👉 [Upgrade to Pro →](https://wpsani.store/downloads/whatslink-click-tracker-pro/?utm_source=wordpress_plugin&utm_medium=readme&utm_campaign=whatslink_tracker_pro)

---

== Screenshots ==

1. Main dashboard — stats bar (total clicks, last 30 days, top page), click log with search, sorting, pagination, and UTM data.
2. Reports Dashboard with filters and KPIs (Pro).
3. Top Pages chart (Pro).
4. Top Clicked URLs chart (Pro).
5. Badge counter displayed next to WhatsApp and Telegram links on the page.
6. Email notification settings (Pro).
7. CSV export from click logs (Pro).
8. Badge counter enable/disable setting in plugin settings.

---

== Installation ==

1. Install the plugin from the WordPress plugin directory or upload the zip manually.
2. Activate it from the Plugins screen.
3. Click **WhatsLink Click Tracker** in the WordPress admin sidebar to see your click log.

No configuration required. Tracking starts immediately after activation.

---

== Frequently Asked Questions ==

= Does it work with Elementor, Divi, Beaver Builder, and other page builders? =

Yes. WhatsLink detects clicks on WhatsApp links regardless of how they were added to the page — through any theme, page builder, or widget.

= Which link formats does it support? =

WhatsApp: `https://wa.me/`, `https://api.whatsapp.com/send`, `https://web.whatsapp.com/send`, and `whatsapp://send` are detected automatically.

Since version 1.5.5, WhatsLink also tracks Telegram links (`https://t.me/`) and phone links (`tel:`). No additional configuration needed.

= Does it also track Telegram and phone links? =

Yes, since version 1.5.5. Any link with a `t.me/` URL or a `tel:` href is tracked alongside WhatsApp clicks. All three channels appear in the same click log and — if you use WhatsLink PRO — in the Channel Breakdown widget in the Reports dashboard.

= How does the click tracking work? Does it modify my WhatsApp links? =

No. WhatsLink uses a JavaScript event listener to detect clicks on messaging links, and also notices when a chat widget opens WhatsApp from JavaScript (as Click to Chat, Joinchat, and WP Social Chat do). Your links and widgets are never modified — they still open WhatsApp directly as usual. The click is just logged silently in the background.

= What is the badge counter? =

An optional feature that shows the total number of clicks next to each WhatsApp button — visible only when you are logged in as an admin. Useful for monitoring click activity directly on the page without opening the dashboard.

= What's the difference between the free version and Pro? =

The free version gives you the full click log with UTM and referrer data. Pro adds advanced filtering, visual charts, CSV export, and automated email reports. See the full comparison above.

= Is it compatible with WooCommerce? =

Yes. WhatsApp clicks on product pages are tracked and labeled by product title and type.

= Is it GDPR compliant? =

The Free version stores no IP addresses, no location data, and no personal user information — only anonymized click events tied to page URLs.

= What happens if I deactivate the plugin? =

Deactivating never deletes your click data. When you click "Deactivate" on the Plugins screen, an optional feedback form opens. Only if you choose a reason and click "Send & Deactivate", your answer (the reason, any details you add, and your site URL) is emailed to the plugin author to help improve WhatsLink. "Skip & Deactivate" deactivates without sending anything, and Cancel, the Esc key, or a click outside the form closes it without deactivating.

= Will it slow down my site? =

No. Click logging is asynchronous (uses the browser's sendBeacon API) and has no impact on page load time.

= How many clicks can it store? =

There is no hard limit. Clicks are stored in your WordPress database. You can reset the log at any time from the dashboard.

= Can I export my click data? =

CSV export is available in the Pro version.

---

== Changelog ==

= 1.5.9 =
* New: The "Upgrade to PRO" page now shows what PRO adds with screenshots of the PRO screens (with example data), and how many clicks your site tracked in the last 30 days.
* Fix: The dashboard notices count all clicks (WhatsApp, Telegram, and phone), show the number formatted, and no longer appear on the Upgrade page itself. The upgrade notice now links to that page.
* Tweak: Removed unused demo images. Click tracking is unchanged in this version.

= 1.5.8 =
* Fix: Clicks on chat widgets that open WhatsApp from JavaScript instead of a link — Click to Chat, Joinchat, and WP Social Chat — are now tracked. Previously only plain links were.
* New: WhatsApp Web links (`web.whatsapp.com`, used by Chaty, Joinchat, and others on desktop) and app links (`whatsapp://`) are now tracked.
* Fix: Telegram links are now recognised by their address, so links such as `about.me/…` are no longer counted as Telegram clicks.
* Fix: One tap that triggers both a link and a widget is counted once.
* Fix: The "Top Page" stat and the "Top Pages" table were empty on MariaDB databases since 1.5.7.
* Fix: The plugin could not load on PHP versions older than 7.3. The minimum PHP version is now 7.4, the same as current WordPress.
* Fix: The deactivation feedback form now sends nothing unless you click "Send & Deactivate", says exactly what is sent, and can be closed without deactivating.
* Fix: After activation you are reliably taken to the WhatsLink dashboard, even if a background request runs first.
* Performance: The tracking script now loads deferred, and the badge stylesheet loads only for admins who see the badge.

= 1.5.7 =
* Fix: Uninstalling the plugin now removes its database table, settings, and per-user dismissal flags. Previously, deleting the plugin left this data behind.
* Fix: The "Top Page" stat and the "Top Pages" table could come back empty on servers where MySQL's ONLY_FULL_GROUP_BY mode is enabled (the default on MySQL 8+ and many modern hosts) — this looked like "no data yet" but was a query error being silently swallowed.
* Performance: Added database indexes used by the badge counter lookup. Existing installs are upgraded automatically on the next visit to wp-admin — no action needed.
* Fix: Removed an inaccurate mention of "device" data from the empty-state screen; WhatsLink has never collected device data.
* Docs: Documented the optional deactivation feedback form (and the email it sends to the plugin author) in the FAQ.
* Docs: Updated "Tested up to" to WordPress 7.1 and trimmed tags to meet the WordPress.org 5-tag limit.

= 1.5.6 =
* Fix: Badge counter now displays click counts on Telegram (t.me) links, not only WhatsApp.

= 1.5.5 =
* New: Click tracking now covers Telegram links (t.me) and phone links (tel:) in addition to WhatsApp links.

= 1.5.4 =
* Fix: Corrected Pro upgrade link URL in readme — wrong URL was causing a redirect that stripped UTM parameters.

= 1.5.3 =
* Docs: Fixed installation instructions — plugin has a dedicated admin menu item, not under Tools.

= 1.5.2 =
* Compatibility: Confirmed compatibility with WordPress 7.0.

= 1.5.1 =
* Fix: Tracking reliability improvements for sites using dynamic WhatsApp button plugins.
* Fix: Admin scripts now load only on the plugin pages, not across the entire dashboard.
* Fix: Improved compatibility on sites with non-standard server configurations.

= 1.5.0 =
* Fix: Click tracking now works correctly with Joinchat, Chaty, WP Social Chat, and any plugin that injects its WhatsApp button via JavaScript. Previously those buttons could go untracked.
* Fix: Lighter frontend script — jQuery dependency removed.
* Fix: Badge counter correctly documented as visible to admins only.

= 1.4.0 =
* New: After tracking 25 clicks, a notice in the dashboard invites you to leave a review on WordPress.org.
* New: Plugin page updated with a compatibility list for popular WhatsApp button plugins.

= 1.3.0 =
* New: Deactivation feedback form — a short optional survey when you deactivate helps us improve the plugin.
* New: Once you have tracked 10+ clicks, a notice links to WhatsLink PRO for charts and CSV export.

= 1.2.2 =
* New: First-install screen — if no clicks have been logged yet, the dashboard confirms tracking is active instead of showing an empty table.

= 1.2.0 =
* New: Stats bar — total clicks, last 30 days, and top page shown at the top of the dashboard.
* New: Date range filter — view clicks from the last 7 days, 30 days, or all time.
* New: Top Pages — the 5 pages that have received the most WhatsApp clicks.
* Fix: Click tracking was not recording clicks from regular (non-admin) visitors. Critical fix — update immediately if you are on 1.1.x.
* Fix: Plugin was silently failing on sites with a non-standard database table prefix.
* Fix: Column sorting was not working correctly in all cases.

= 1.1.2 =
* Fix: Prevented a startup error on some server configurations during plugin activation.

= 1.1.1 =
* New: UTM tracking (source, medium, campaign) and referrer now included in the free version.

= 1.1.0 =
* New: Badge counter — shows total click counts next to each WhatsApp button (visible to admins only).
* New: Clicked URL column added to the click log.
* Fix: Click logging is now more reliable on mobile browsers.
* Fix: Security improvements.

= 1.0.1 =
* Fix: Security and stability improvements.

= 1.0.0 =
* Initial release.

---

== Upgrade Notice ==

= 1.5.9 =
A clearer "Upgrade to PRO" page and more accurate dashboard notices. Click tracking is unchanged.

= 1.5.8 =
Tracks Click to Chat, Joinchat, and WP Social Chat widgets and WhatsApp Web links, fixes empty "Top Pages" on MariaDB, and makes deactivation feedback strictly opt-in. Requires PHP 7.4 or later.

= 1.5.7 =
Data cleanup and a silent bug fix: uninstall now removes all plugin data, and "Top Pages"/stats no longer come back empty on strict MySQL setups. Recommended for all users.

= 1.5.6 =
Fix: Badge counter now shows click counts on Telegram links alongside WhatsApp. Recommended for all users.

= 1.5.5 =
New: Telegram (t.me) and phone (tel:) link tracking added alongside WhatsApp.

= 1.5.4 =
Minor fix: corrects Pro upgrade link in readme. No functional changes.

= 1.5.3 =
Minor documentation fix. No functional changes.

= 1.5.2 =
Confirmed compatibility with WordPress 7.0.

= 1.5.1 =
Reliability and compatibility improvements. Recommended for all users.

= 1.5.0 =
Important fix: click tracking now works with Joinchat, Chaty, WP Social Chat, and similar plugins. Update if you have seen missing clicks in your dashboard.

= 1.3.0 =
Adds an optional deactivation feedback form and an upgrade reminder for PRO features after 10+ tracked clicks.

= 1.2.0 =
Critical fix: click tracking was not recording regular visitor clicks. Update immediately if you are on 1.1.x.

= 1.1.2 =
Stability fix for plugin activation. Recommended for all users.
