PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / melograno / usage-tracker / README.md
ameliabooking / vendor / melograno / usage-tracker Last commit date
resources 3 weeks ago src 3 weeks ago README.md 3 weeks ago composer.json 3 weeks ago phpunit.xml 1 month ago
README.md
89 lines
1 # melograno/usage-tracker
2
3 Shared WordPress library for anonymous plugin usage telemetry across Melograno products (Amelia, wpDataTables, IvyForms).
4
5 ## Plugin integration
6
7 After Composer autoload is loaded:
8
9 ```php
10 $savedVersion = /* host plugin version stored before upgrade */;
11 $collector = new \Melograno\UsageTracker\Collectors\Plugin\AmeliaCollector();
12
13 \Melograno\UsageTracker\Core\UsageTracker::init($collector, __FILE__, $savedVersion, '1.2.3');
14 ```
15
16 When the collector implements `ConsentNoticeCollectorInterface`, `init()` registers a deferred admin notice in `admin_footer`, enable/dismiss AJAX handlers, and calls `renderConsentAdminNotice()` on the collector when the notice should be shown. The notice is injected after the host admin UI has loaded (for SPA pages such as Amelia, it waits until the app root has mounted).
17
18 Each product collector defines `getPluginSlug()`, `getConsentOptionName()`, and (for opt-in flows) notice/migration settings via `ConsentNoticeCollectorInterface`.
19
20 Host plugin settings UI should read/write consent via `UsageTracker::getSettings()` / `UsageTracker::updateSettings()`. Enabling consent automatically dismisses the admin notice. When disabling consent from general settings, pass `armNoticeOnDisable` as `false` (default) so the notice is dismissed as a definitive opt-out. Pass `true` only for non-definitive flows such as the welcome wizard.
21
22 Pass `$savedVersion` and the current plugin version to `init()`; when they differ, consent upgrade migration runs automatically for `ConsentNoticeCollectorInterface` collectors.
23
24 New-install consent defaults are applied automatically on boot when the consent option has never been stored (`ConsentNoticeCollectorInterface` collectors only).
25
26 On Amelia admin pages that strip third-party notices, the usage notice still renders via `admin_footer` and does not need to be re-registered on `admin_notices`. For manual rendering (e.g. tests), use:
27
28 ```php
29 \Melograno\UsageTracker\Core\UsageTracker::renderConsentAdminNotice();
30 ```
31
32 ### Build-time setup (once per plugin)
33
34 1. Add the dependency:
35
36 ```json
37 "require": {
38 "melograno/usage-tracker": "^1.0"
39 }
40 ```
41
42 2. Optionally include in [](https://github.com/BrianHenryIE/straussStrauss](https://github.com/BrianHenryIE/strauss](https://github.com/BrianHenryIE/strauss) `packages` if you need a prefixed copy (`AmeliaVendor\Melograno\UsageTracker\...`). Amelia loads the package **without** Strauss prefixing so `Melograno\UsageTracker` resolves via Composer autoload.
43
44 3. Run `composer install` (and Strauss if used) before packaging the plugin.
45
46 ### Local path repository (development)
47
48 ```json
49 "repositories": [
50 {
51 "type": "path",
52 "url": "../plugin-usage-tracker"
53 }
54 ]
55 ```
56
57 ## What the library provides
58
59 - Weekly WP Cron send to `https://bi.melograno.io/v1/usage` (override with `MELOGRANO_BI_GATE_URL`)
60 - Per-plugin consent `wp_option` (name from collector; host UI writes it; library reads it for cron/send)
61 - `NoticeManager` for admin notice option state; auto-dismiss when consent is enabled
62 - `ConsentNoticeService` for upgrade migration and new-install consent defaults
63 - `ConsentNoticeCollectorInterface::renderConsentAdminNotice()` for host-branded admin notice UI
64 - Common collectors (WP environment, activation stats)
65 - Product collectors: `AmeliaCollector`, `WpDataTablesCollector`, `IvyFormsCollector`
66 - `sha256` site identifier (no raw site URL in payload)
67 - Deactivation (when `__FILE__` passed to `init`): clears scheduled cron only; consent option is kept
68 - Uninstall: `UsageTracker::deleteStoredOptions()` removes consent and notice options
69
70 ## Development
71
72 ```bash
73 composer install
74 composer test
75 ```
76
77 ## Payload schema
78
79 ```json
80 {
81 "schema_version": 1,
82 "sent_at": "2026-05-19T12:00:00Z",
83 "plugin": "ameliabooking",
84 "site_id": "<sha256 of site_url>",
85 "common": { "environment": {}, "activation": {} },
86 "plugin_data": {}
87 }
88 ```
89