=== BW4TEC Chat Analytics ===
Contributors: bw4tec
Tags: whatsapp, click tracking, analytics, geoip, elementor
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 4.7.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Advanced WhatsApp click tracking with optional GeoIP, anti-fraud detection, browser/OS analytics, and an interactive admin dashboard.

== Description ==

**BW4TEC Chat Analytics** is a comprehensive analytics solution to track, monitor, and optimize all WhatsApp click interactions on your WordPress website.

### Key Features:
* **Universal Number Tracking**: Automatically detects and logs clicks on any WhatsApp link (wa.me, api.whatsapp.com, chat.whatsapp.com) or elements with a data-phone attribute.
* **Smart Position Detection**: Identifies click origins across site sections (Header, Footer, Content, Sidebar, Floating Button, and Elementor Widgets).
* **Anti-Fraud & Bot Detection Algorithm**: Assigns a fraud score from 0 to 100 based on page load speed, mouse/pointer interaction, User-Agent, and Webdriver flags.
* **Optional GeoIP Lookup**: Identifies City, Region, and Country with local caching via Transients. Easily disable GeoIP in settings for strict GDPR/LGPD compliance.
* **Native Multi-Tab Dashboard**: View KPIs, real-time click logs, number-grouped reports, and suspicious IP lists.
* **Customizable Floating Button**: Display a high-converting WhatsApp floating button with configurable position and custom pre-filled message.
* **CSV Export**: Export complete click logs filtered by date range, phone number, city, or state for external analysis in Excel or Google Sheets.

### Third-Party Services Disclosure:
This plugin integrates with an external API service to perform IP-based geographical location lookups (GeoIP):
* **Service Name**: ip-api.com
* **Purpose**: Resolves the visitor's IP address into country, state, city, and proxy status for anti-fraud detection.
* **Data Transmitted**: Visitor IP Address.
* **Terms of Service & Privacy**: [https://ip-api.com/docs/legal](https://ip-api.com/docs/legal)
* **Control**: GeoIP lookup can be completely enabled or disabled at any time via the plugin settings page.

== Installation ==

1. Upload the `bw4tec-chat-analytics` folder to the `/wp-content/plugins/` directory or install via the WordPress Plugins dashboard.
2. Activate the plugin through the "Plugins" menu in WordPress.
3. Navigate to "BW4TEC Chat" in the admin sidebar to view analytics and manage settings.

== Frequently Asked Questions ==

= Does the plugin track multiple WhatsApp numbers on the same site? =
Yes! The plugin automatically detects and tracks clicks for any WhatsApp number present in site links, whether static or dynamically generated.

= Is it compatible with Elementor? =
Yes. The plugin's JavaScript tracker detects Elementor buttons and icons, automatically categorizing their location as "Widget Elementor".

= Does the GeoIP feature store sensitive user data? =
No. Geographical data is retrieved solely to determine region and cached locally via Transients to prevent redundant external API requests. Additionally, GeoIP lookup can be completely disabled in the settings tab.

= Como funciona o recurso de Limpeza Automática de Dados? =
O plugin possui uma opção de Limpeza Automática (Auto-purge) configurável na aba de Configurações, projetada para evitar o inchaço (bloat) do banco de dados em sites com alto tráfego. Ao ativar esse recurso, os registros de cliques antigos serão excluídos permanentemente de forma automática todos os dias. A BW4TEC não se responsabiliza por quaisquer perdas de dados decorrentes do uso da Limpeza Automática. Recomendamos exportar relatórios em formato CSV periodicamente se você precisar reter um histórico vitalício de cliques.

== Screenshots ==

1. Analytics Dashboard with overview KPIs and metrics.
2. Click tracking log table with IP, location, browser/OS, and fraud score details.
3. Grouped reports by WhatsApp phone number.
4. Settings page, floating button toggles, and CSV data export tool.

== Changelog ==

= 4.6.0 =
* Unified plugin naming to BW4TEC Chat Analytics.
* Complete optimization for the official WordPress.org directory (100% Plugin Checker compliance).
* Comprehensive SQL sanitization using $wpdb->prepare().
* Modular architecture refactoring (separated PHP classes, external JS tracker, and CSS styles).
* Added date range filters, phone number filters, city/state dropdown filters, and license key configuration.
* Added explicit toggle setting for GeoIP third-party API compliance.
