/**
 * Plugin Name: MainWP Google Analytics Extension
 * Plugin URI: https://mainwp.com
 * Description: MainWP Google Analytics Extension is an extension for the MainWP plugin that enables you to monitor detailed statistics about your child sites traffic. It integrates seamlessly with your Google Analytics account.
 * Version: 6.1
 * Author: MainWP
 * Author URI: https://mainwp.com
 * Documentation URI: https://docs.mainwp.com/add-ons/analytics/mainwp-google-analytics-extension
 * Requires at least: 6.2
 * Requires PHP: 8.1
 * Text Domain: mainwp-google-analytics-extension
 * Domain Path: /languages/
*/

== Changelog ==

= 6.1.1 - 9-3-2026 =

* Fixed: Corrected cached analytics statistics to consistently reflect the selected reporting period.
* Fixed: Session, page/screen, and country data now use the specified start and end dates.
* Fixed: Foreground refresh blocks unrelated MainWP admin pages.
* Updated: Refactor activation logic to improve file handling and remove transient retries.

= 6.1 - 8-18-2026 =

* Fixed: Improved OAuth token refresh handling to better distinguish temporary and permanent authentication issues, normalize varying authentication responses, and avoid unnecessary reauthorization.
* Added: Database schema validation to help ensure the add-on is properly configured.
* Updated: Improved account and property lookup error handling so invalid inputs and failed requests stop processing instead of returning empty results.
* Updated: Refined scheduled data refreshes with temporary locking to prevent duplicate processing and skip OAuth tokens that are still valid.
* Updated: Google Analytics OAuth tokens are now refreshed before Pro Reports resume sending to help prevent report delivery interruptions.

= 6.0.5 - 6-12-2026 =

* Added: WordPress REST API availability check along with a warning message to inform users if not available.
* Updated: Enhanced GA4 property synchronization to prevent stale mappings and improve data accuracy
* Updated: Refined widget view selection, admin messaging, site-selection persistence, token refresh, and centralized debug logging.

= 6.0.4 - 5-29-2026 =

* Added: Automatic backfill and synchronization of missing Google Analytics properties for connected accounts.

= 6.0.3 - 5-19-2026 =

* Added: A dedicated MainWP REST controller for the Google Analytics authentication challenge endpoint.
* Added: Separate cron handlers and bootstrap files for scheduled analytics data refreshes and hourly token refreshes.
* Added: Token state tracking with `needs_reauth`, `last_updated`, and improved refresh metadata persistence.
* Updated: Cron scheduling is now managed through a dedicated scheduler class with clearer job registration and reporting.
* Updated: Sign-in, token refresh, and account refresh flows with stronger response validation and more detailed masked debug logging.

= 6.0.2 - 5-4-2026 =

* Fixed: Improved the reconnection process to prevent duplicate Google Analytics properties.
* Added: Added detection for `BCMath` extension support with error reporting when the extension is unavailable.
* Added: Added detection for `getmypid()` function support with error reporting when the function is unavailable.
* Added: Added bulk account selection with a "Select All" header checkbox and per-row checkboxes for easier multi-account management.
* Added: Added a bulk actions dropdown with an "Apply" button for batch operations, including "Refresh Data" and "Remove Account".
* Updated: Improved error reporting to display all detected system errors instead of limiting reports to specific error types.
* Updated: Updated the per-row primary action to show either "Reconnect Account" or "Refresh Data" based on the account status.
* Updated: Improved table sorting, multi-row selection, and checkbox state synchronization for more reliable account management.
* Updated: Strengthened validation and error handling when fetching Google Analytics properties to skip malformed entries, log issues, and prevent partial failures.

= 6.0.1 - 3-9-2026 =

* Fixed: License activation issue caused by incorrect product ID capitalization.
* Fixed: Potential conflicts with plugins using the same dependencies.
* Fixed: Error on some hosts where the getmypid PHP function is disabled.
* Updated: Site Settings option UI for MainWP v6 style consistency.

= 6.0 - 2-24-2026 =

* Added: Support for MainWP Bridge (Sign-In Authentication) to simplify API authentication

= 6.0-er.1 - 12-30-2025 =

* Brigde testing started

= 5.0.1 - 3-14-2024 =

* Updated: Revised the notification for missing analytics data to guide users in connecting their Google Analytics account and assigning properties to MainWP sites.

= 5.0 - 2-27-2024 =

* Updated: MainWP 5.0 compatibility

= 4.1.4 - 8-15-2023 =

* Added: Support for Flexible Widgets

= 4.1.3 - 6-14-2023 =

* Fixed: Incorrect Engagement Time data
* Fixed: Incorrect color coding for the Bounce Rate info
* Fixed: PHP Deprecation notice

= 4.1.2 - 5-30-2023 =

* Added: Additional logging for catching Google API feedback when connection fails
* Updates: Authentication process for easier connection of multiple GA accounts
* Updated: Accounts table class to fix the overflow problem

= 4.1.1 - 5-19-2023 =

* Fixed: Error caused by uploading incorrect JSON Key file
* Added: Process to check if the JSON file is compatible

= 4.1 - 5-18-2023 =

* Added: Support for GA4
* Added: Average Engagement Time chart
* Added: New Users chart
* Added: Users chart
* Added: Views by Page info
* Added: Users by Country info
* Added: Sessions by Source info
* Added: Users by Device info
* Updated: Overview page widget to show multiple charts
* Updated: Individual site overview widget to show multiple charts
* Updated: Visitors data page to show widgets
* Updated: GA API authentication process

= 4.0.5 - 12-7-2022 =

* Preventative: Multiple security improvements

= 4.0.4 - 12-7-2021 =

* Fixed: An issue with refreshing Auth token
* Added: Actions log support
* Updated: PHP 8 comatibility

= 4.0.3.2 - 8-13-2021 =

* Added: 'mainwp_ga_visit_chart_date' filter to allow users format chart date
* Added: 'mainwp_ga_select_web_property' filter to allow users to select specific property view
* Updated: Help documentation links

= 4.0.3.1 - 9-10-2020 =

* Updated: MainWP Dashboard 4.1 compatiblity

= 4.0.3 - 4-13-2020 =

* Fixed: view site data permission issue

= 4.0.2 - 2-18-2020 =

* Fixed: issues with user permissions to see analytics data
* Fixed: multiple cosmetic issues

= 4.0.1 - 9-13-2019 =

* Fixed: issue with deleting unused GA accounts
* Fixed: multiple cosmetic issues

= 4.0 - 8-27-2019 =

* Updated: extension UI/UX redesign
* Updated: support for the MainWP 4.0

= 1.9 - 10-12-2018 =

* Added: the mainwp_ga_redirect_url hook to implement support for custom admin paths

= 1.8 - 8-24-2018 =

* Fixed: a couple console warnings
* Updated: the Google graph loader
* Removed: unused jsapi file

= 1.7 - 7-6-2018 =

* Fixed: multiple PHP warnings
* Added: the mainwp_ga_visit_chart_date hook to support custom date format the stats graph
* Updated: prioritize GA views with the "mainwp" string

= 1.6 - 5-12-2017 =

* Fixed: an issue with auto assigning child sites

= 1.5 - 1-18-2017 =

* Fixed: An issue with displaying sites twice in the sites list
* Updated: Default sites sorting

= 1.4 - 31-12-2016 =

* Fixed: Conflict causing the widget to show a white page

= 1.3 - 14-12-2016 =

* Fixed: Google API reference

= 1.2 - 11-8-2016 =

* Fixed: An issue with getting Google Analytics data
* Added: PHP version compatibility check

= 1.1 - 9-16-2016 =

* Fixed: Bug with getting Google Analytics data from the Google API
* Updated: Google API

= 1.0 - 2-17-2016 =

* Fixed: Bug with incorrect Site from Google Account
* Added: GA Account name field
* Added: Support for WP-CLI
* Added: Support for the new API management
* Added: An auto update warning if the extension is not activated
* Updated: "Check for updates now" link is not vidible if extension is not activated

= 0.1.7 - 7-3-2015 =

* Fixed: A bug with incorrect file path

= 0.1.6 =

* Fixed: An issue with displaying values in Client Reports
* Fixed: An issue with saving Google Analytics account

= 0.1.5 =

* Fixed: SQL query bug

= 0.1.4 =

* Updated: Google API authentication process

= 0.1.3 =

* Updated: Quick start guide layout

= 0.1.2 =

* Fixed: Wrong documentation link
* Fixed: Tranlation domain issues
* Updated: CSS style

= 0.1.1 =

* Added: Support for the new Client Reports token (Google Analytics chart)
* Fixed: Potential security issue - Internal code audit

= 0.1.0 =

* Added: New hook to fix a PHP Notice
* Fixed: Misspell in the help documentation

= 0.0.9 =

* Added: Support for the API Manager

= 0.0.8 =

* Added: Auto assign child sites to GA profile

= 0.0.7 =

* Fixed: XML parse bug

= 0.0.6 =

* Added: Support for the Client Reorts extension
* Added: Support Forum URI and Documentation URI in the Plugin info
* Added: Redirection to the Extensions Page after activating the extension
* Fixed: 1 PHP Warning

= 0.0.5 =

* Update quick guide

= 0.0.4 =

* CSS Update

= 0.0.3 =

* Wordpress 3.9 changes

= 0.0.2 =

* Fixed issue with graph on dashboard

= 0.0.1 =

* First version
