Skip to content

Analytics: reliable activation event, stable install identity, consistent categories - #1262

Open
udil-cloudinary wants to merge 1 commit into
developfrom
feature/analytics-instrumentation-fixes
Open

Analytics: reliable activation event, stable install identity, consistent categories#1262
udil-cloudinary wants to merge 1 commit into
developfrom
feature/analytics-instrumentation-fixes

Conversation

@udil-cloudinary

Copy link
Copy Markdown
Contributor

What & why

Four correctness/consistency fixes to the plugin analytics instrumentation (built on the activation-funnel work already on develop).

The fixes

  1. Activation event no longer dropped when emission is disabled. maybe_send_pending_activation() now bails on ! is_enabled() before consuming the pending transient, so the event isn't consumed-and-dropped — it can still be sent on a later admin load. Stash TTL widened HOUR_IN_SECONDSDAY_IN_SECONDS.

  2. Stable install_id. A persistent UUID (_cloudinary_install_id, non-autoloaded) is added to every event envelope in base_params() via the new get_install_id() helper. This gives off-interactive events (cron / queue / front-end, where session_id is empty) a durable join key. Unlike site_id, it survives a domain change.

  3. user_role context marker. Returns cron / system / front instead of '' when there is no acting user, so off-interactive events stay distinguishable.

  4. Normalized event_category to a fixed set — activation_funnel | feature_usage | settings | system — moving specifics to a feature property:

    • transformation_appliedfeature_usage + feature: transformation
    • gallery_configuredfeature_usage + feature: gallery
    • cache_uploadedfeature_usage + feature: asset_sync
    • deactivation_submittedactivation_funnel
    • poc_smoke_testsystem

⚠️ Collector / dashboard impact

Fix #4 changes event_category values on the wire. The downstream collector/dashboard schema must be coordinated with these normalized categories and the new feature property. (This aligns with the analytics dashboard spec.)

Testing

  • Husky / lint-staged PHPCS (WordPress-VIP ruleset) passes on commit.

Follow-ups (tracked separately, not in this PR)

  • Asset-sync adoption + extent (asset_sync_configured on assets-page save; source/is_external on cache_uploaded) — needs Settings-API keys verified against a running install.
  • Weekly usage-heartbeat WP-Cron event for retention + silent-churn detection.

🤖 Generated with Claude Code

…tent categories

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant