=== First Party Analytics ===
Contributors: tmmtechnology
Tags: analytics, tracking, woocommerce, google-analytics, web-vitals
Tested up to: 7.0
Stable tag: 1.2.63
Requires PHP: 8.1
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

A plugin for first-party analytics.

== Description ==

This is a plugin for tracking of user website page visits. Similar to Google Analytics. Contains many different types of tracking.

Shows about 40 graphs and tables in total. Tracks about 50 data parts (visits count, user-agents, visited links, web-vitals, etc).

== Types of tracking ==

- General
- Times
- Interaction capabilities
- Sessions
- Pages
- Screen Sizes
- Languages
- Countries
- Searches
- Visited links
- User-Agents
- Referrers
- Sources
- Performance
- Misc

== Bug reports / Questions / Suggestions ==

[wp@tmm.ventures](mailto:wp@tmm.ventures)

== Screenshots ==

1. "General" tab.
2. "Times" tab.
3. "Interaction capabilities" tab.
4. "Sessions" tab.
5. "Pages" tab.
6. "Screen Sizes" tab.
7. "Languages" tab.
8. "Countries" tab.
9. "Searches" tab.
10. "Visited links" tab.
11. "User-Agents" tab.
12. "Referrers" tab.
13. "Sources" tab.
14. "Performance" tab.
15. "Misc" tab.
16. Page edit panel.
17. Settings - General Settings.
18. Settings - Exclude by Cookie.
19. Settings - Exclude by IP.
20. Settings - Cache.

== Changelog ==

= 1.2.63 2026-07-13 =

#### Maintenance

* Bump the plugin version for distribution; no functional code changes.

= 1.2.62 2026-07-03 =

#### Bugfixes

* Fix missing `media/` assets in the distributed package (broken chart placeholder image and no-JS tracking pixel) by no longer excluding the runtime `media/` directory from the build.

= 1.2.61 2026-07-03 =

#### Bugfixes

* Fix "_load_textdomain_just_in_time was called incorrectly" notice by loading translations on the `init` hook (required since WP 6.7).

= 1.2.60 2026-06-09 =

#### Fixes

* Action Scheduler Run Log: remove the per-row Duration column. The table lists one row per log entry (created / started / completed), so a per-action duration could not be shown coherently there and rendered as a misleading 0 or a blank. The average/maximum duration summary stats remain.

= 1.2.59 2026-06-09 =

#### Fixes

* Action Scheduler duration stats: fix the average/maximum execution-duration figures excluding actions run via WP-CLI or on non-English locales. The start time was matched against the localized "action started" log message; it is now derived locale-independently from the action's log order, so all executed actions are counted.

= 1.2.58 2026-06-09 =

#### Enhancements

* Settings → Advanced: add a "Show diagnostics submenus" toggle. When off (the default) the Data Parsing, Data Sharing, Data Recovery and Recovery Tables submenus are hidden from the admin menu to keep it uncluttered. The pages stay fully registered and reachable by direct link — only the menu entries are removed.

= 1.2.57 2026-06-08 =

#### Fixes

* Data sharing: lower the default chunk size from ~90 MB to ~50 MB. A 90 MB chunk of a large, busy table (e.g. ~720k rows) could exceed the backend's per-request processing budget and fail with a 502; ~50 MB roughly halves each request's row count and insert time. Still overridable via the `first_party_analytics_data_sharing_chunk_bytes` filter — lower it further for very wide tables if needed.

= 1.2.56 2026-06-08 =

#### Enhancements

* Data sharing: send each table in size-bounded chunks (~90 MB) via keyset pagination on `id`, so large tables stay under the upload gateway's request-body and timeout limits. Each chunk is its own Action Scheduler task; a failed chunk can be resumed mid-table from the last confirmed-sent row without re-sending earlier chunks. Chunk size is overridable via the `first_party_analytics_data_sharing_chunk_bytes` filter.
* Data sharing admin: show per-table chunk progress (chunks sent and the row-id cursor) in the batched-runs breakdown and the in-progress row.

#### Fixes

* Data sharing: ensure tables larger than one chunk send **all** rows — previously a table could be marked complete after its first page, dropping the remaining rows.

= 1.2.55 2026-05-29 =

#### Fixes

* Recovery Tables: stop WP admin's fixed-height `.tablenav` from cropping the multi-row filter bar.

= 1.2.54 2026-05-29 =

#### Enhancements

* Add **Recovery Tables** admin submenu — read-only viewer for `data_recovery_runs`, `data_recovery_run_rows`, and the recovery slice of `page_visits` (rows where `recovery_run_id <> 0`). Per-column filter bar with operators `=`, `!=`, `>`, `>=`, `<`, `<=`, `LIKE`, `NOT LIKE`, `IS NULL`, `IS NOT NULL`, sortable columns, paging.

= 1.2.53 2026-05-27 =

#### Fixes

* Data Recovery: bucket-level visit summing. When multiple URLs in the same import resolved to the same (post/term, day) — e.g. paginated archives, URL variants — extras were previously dropped by INSERT IGNORE and their visit counts lost. They are now summed into the surviving page_visits row. Each contributing input row is preserved in the run audit with outcome `merged_into_bucket`.

= 1.2.52 2026-05-25 =

#### Enhancements

* Data Recovery: improved URL → WP object resolution. Collapse runs of leading slashes, strip `/page/N/` pagination suffixes before resolving, and walk all URL segments (not just the tail) when looking up nested hierarchical term archives.
* Data Recovery: filter obviously-garbage URLs (zero-width characters, JSON-shaped junk, paths longer than 512 chars) before import — they are no longer inserted into `page_visits` as `object_id=0` rows. Filtered URLs are counted on the run row (`rows_skipped_garbage`) and recorded in the run drill-down with outcome `skipped_garbage` for auditing.

= 1.2.51 2026-05-22 =

#### Enhancements

* Add "Data Recovery" submenu for importing historical analytics (TSV/CSV, with GA4 auto-detect) into `page_visits` for periods when First Party Analytics was not tracking. Auto-detects delimiter, header row, and known GA4 column names; lets the user override every choice before importing.
* Each upload is recorded in two new tables — `data_recovery_runs` (one row per file, with status `uploaded` → `committed`) and `data_recovery_run_rows` (per-(day, url) outcome detail) — so every imported, skipped, or unresolved row is auditable.
* Mark recovered `page_visits` rows with a new `recovery_run_id` column (0 for natively tracked rows) so they remain distinguishable from organic tracking data.
* Only one upload may be pending at a time. Uploaded files are kept on disk for re-inspection/download even after commit; per-row Download + Delete actions on the runs table.

= 1.2.50 2026-05-17 =

#### Fixes

* Store link-visit visitor IDs without casting them to PHP integers, preventing 20-digit tracking cookie values from collapsing to `9223372036854775807`.

= 1.2.49 2026-05-17 =

#### Fixes

* Register `first-party-analytics-data-sharing-history` and `first-party-analytics-data-sharing-send-log` options so the Data Sharing admin screen no longer throws an "Unknown option name" fatal on load.

= 1.2.48 2026-05-16 =

#### Enhancements

* Data Sharing: stage per-table CSVs inside the run dir (under `wp-content/uploads/first-party-analytics/data-sharing-runs/`) instead of the system temp dir, and make the stalled-run per-table breakdown horizontally scrollable on narrow screens.
* Extracted shared on-disk-run FS plumbing (root dir, manifest read/write, has-any-in-progress) from `Raw_Analytics_Parsing\Builds` and `Data_Sharing\Runs\Runs` into a new abstract `Run_Storage` base class. ~200 lines of duplication removed; no behaviour change.

= 1.2.47 2026-05-07 =

#### Enhancements

* Sort Batched Parse Runs by started time so newest runs appear first.

= 1.2.46 2026-05-07 =

#### Enhancements

* Move the stalled batch build remove action into its own table column and match the uploaded file remove button style.

= 1.2.45 2026-05-07 =

#### Enhancements

* Add a guarded delete button for stalled batch builds so stale build directories can be removed from the data parsing screen.

= 1.2.44 2026-05-06 =

#### Fixes

* Restore async enqueueing for standard batch parse chain actions while keeping duplicate active action prevention.

= 1.2.43 2026-05-05 =

#### Fixes

* Prevent duplicate active standard batch parse actions.
* Enqueue standard batch chain actions asynchronously.

= 1.2.42 2026-05-05 =

#### Enhancements

* Add upload analytics file table totals and selectable uploaded files for batch creation.
* Add resume controls for stalled, failed, or missing batched parse run actions.
* Add duplicate pending upload prevention by original filename.

#### Fixes

* Display AJAX request upload date ranges as dates without times.
* Improve stalled and failed Action Scheduler status handling in parsing tables.

= 1.2.41 2026-05-05 =

#### Fixes

* Show rescheduled Action Scheduler tasks as pending or running instead of stalled.

= 1.2.40 2026-05-05 =

#### Enhancements

* Add a button to reschedule failed kind tasks.

= 1.2.39 2026-05-05 =

#### Fixes

* Temporarily disable the data sharing Action Scheduler task.

= 1.2.38 2026-05-05 =

#### Enhancements

* Improve file upload UI.

= 1.2.37 2026-05-04 =

#### Enhancements

* Improve batches logic logging.

= 1.2.36 2026-04-30 =

#### Enhancements

* Add good logging for batches creation.

= 1.2.35 2026-04-30 =

#### Enhancements

* Improve batches logic logging.

= 1.2.34 2026-04-30 =

#### Enhancements

* Improve batches logic.

= 1.2.33 2026-04-27 =

#### Enhancements

* Optimize parsing.

= 1.2.32 2026-04-17 =

#### Enhancements

* Move raw analytics storage from /tmp to /wp-uploads

= 1.2.31 2026-04-15 =

#### Enhancements

* Add "Data parsing" page.

= 1.2.30 2025-11-26 =

#### Bugfixes

* Improve queries and add indexes.

= 1.2.29 2025-02-20 =

#### Bugfixes

* Deletes files from /tmp for Data_Sharing class.
* PHP Warning:  Undefined array key "standardEventsStartTimeDiffTime" in /src/database/class-standard-events-meta.php on line 94
* PHP Warning:  Undefined array key "standardEventsStartTime" in /src/tracking/class-standard-events.php on line 56

= 1.2.28 2024-11-18 =

#### Bugfixes

* Fix settings rendering issue when checked for '1' though could check for true (bool).

= 1.2.27 2024-11-18 =

#### Bugfixes

* Fix migrations, to not drop the tables.

= 1.2.26 2024-05-07 =

#### Bugfixes

* Fix migrations, to not drop the tables.

= 1.2.25 2024-05-03 =

#### Enhancements

* Move actions scheduling to constructors.

= 1.2.24 2024-05-02 =

#### Enhancements

* Use standard Action Scheduler interval.
* Update WP-Plugins-Core.

= 1.2.22 2023-04-07 =

* Use migrations for databases, instead of DBDelta.
* Add a separate tables for object_type to all tables where post_id was (not it's object_id).
* Fix the table.

= 1.2.21 2023-03-24 =

#### Enhancements

* Use 'visibilitychange' instead of 'beforeunload' (with 'pagehide' fallback).
* Add 'isTrusted' check to all events.

#### Optimizations

* Check for changed URL with the 1000 ms interval instead of 100 ms.

= 1.2.20 2023-03-01 =

#### Bugfixes

* Change catalog_viewed_products from 'saffy-placeholder-post' to 'speedsearch-placeholder-post'.
* Fix the products viewed in catalog tracking logic (to not add duplicates, or the products that are already being tracked).
* Fix the POST requests storm (add a rate limit).
* Fix Undefined array key error (in many places).

= 1.2.19 2023-09-12 =

#### Enhancements

* Improved client-side filtering of "number" input fields (only digits are allowed now).

= 1.2.18 2023-09-09 =

#### Enhancements

* Use wp_options table instead of cache for the lock of migrations.
* Change visitor_id table column type from VARCHAR(255) to DECIMAL(20,0).
* Add a support for standard events collection (sessions trace for the Premium plugin).
* Add a support for plugin data CSV export.

#### Bugfixes

* Fix missing public suffix.
* Fix get_domain_data() call.

= 1.2.6 2023-07-18 =

#### Enhancements

* Set min PHP version to 7.4.

= 1.2.4 2023-07-16 =

#### Enhancements

* Add a notice when the plugin is being updated instead of blocking the whole logic.

= 1.2.3 2023-07-12 =

#### Bugfixes

* Make the plugin to work with cache.

= 1.2.0 2023-06-12 =

#### Enhancements

* Load FE scripts async.

= 1.1.49 2023-06-10 =

#### Bugfixes

* Delete wp_date() from standalone script.

= 1.1.48 2023-05-23 =

#### Enhancements

* Use beacon flexibly: for all requests when they are below the size of the beacon limit.

= 1.1.45 2023-05-15 =

#### Bugfixes

* Bundle prebid-ads.js and analytics.js.

= 1.1.44 2023-05-14 =

#### Bugfixes

* Write data in WP-localized date format.

= 1.1.43 2023-05-08 =

#### Bugfixes

* MU-plugin fixed.
* Many minor fixes.

= 1.0.96 2023-02-27 =

#### Bugfixes

* Visitor details unique key fix (now is based on key + value, previosuly was just on key).
* Save visitor details only when they are present (i.e. no "empty" write for BE-only request - as it writes only once due to is_unique).
* Use post_id (when available) instead of post_url for marking/detecting unique visits - less false positives (for uniqueness detection).

= 1.0.80 2023-02-20 =

#### Enhancements

* Support for FPAP adblock buster feature.

= 1.0.80 2023-02-18 =

#### Bugfixes

* Min PHP version required downgraded to 7.2.

= 1.0.79 2023-02-15 =

#### Bugfixes

* Mitigate BF cache effect on metrics.

= 1.0.76 2023-02-15 =

#### Bugfixes

* Min PHP version required downgraded to 7.4.

= 1.0.73 2023-02-09 =

#### Enhancements

* Added "BF (Back-Forward) cache present" collection and representation.

#### Bugfixes

* Web vitals DB fix (when incremented "needs_improvement" instead of "poor" vitals).
* Record 0 for web vital values (previosuly was considered as '' (null)) - now no string convertion is done, which helps to preserve the real original values.
* Raw requests storage reset of requests structure change.

= 1.0.71 2023-01-29 =

#### Enhancements

* Changelog added.
