Wire activation-funnel analytics events#1189
Open
udil-cloudinary wants to merge 1 commit into
Open
Conversation
Builds on the analytics infrastructure (#1187) to emit the activation funnel defined in the spec. Server-side events go through the Analytics component; client-side wizard events go through the JS track() bridge. Server-side: - plugin_activated (step 1) with install-type detection (fresh_install / reactivation / upgrade / downgrade) from the db_version install marker + version compare, emitted on the next admin load via a transient. Persists _cloudinary_last_active on deactivation to derive days_since_last_active. - connection_test_result (3d) in rest_test_connection. - wizard_setup_submitted (5) in rest_save_wizard. - first_sync_started (8, one-time) in Push_Sync::process_assets. - first_api_consumption (9, one-time) via the cloudinary_uploaded_asset action. Client-side (wizard.js -> /events bridge): wizard_started, wizard_signup_clicked, wizard_connect_viewed, credentials_entry_started, credentials_format_validated, connection_test_started, wizard_settings_viewed, wizard_setting_toggled, wizard_completed, wizard_dashboard_clicked. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1 POC, PR #2 of 2 — wires the activation-funnel events on top of the analytics infrastructure from #1187. See the POC definition and implementation plan.
Approach
Server-side events emit directly through the
Analyticscomponent; client-side wizard events go through the JStrack()bridge → the internal/eventsREST route (which enriches them with the server-side param envelope).Server-side
plugin_activated(step 1) — install-type detection inAnalytics::stash_activation()(called fromUtils::install):fresh_install/reactivation/upgrade/downgrade, derived from thedb_versioninstall marker +version_compare. Stashed in a transient and emitted on the next admin load (so full mandatory params +session_idare present), then cleared. A newregister_deactivation_hookpersists_cloudinary_last_activesodays_since_last_activecan be computed on reactivation. Params:activation_type,previous_version,new_version,days_since_last_active.connection_test_result(3d) — inrest_test_connection(status,error_type,attempt_number).wizard_setup_submitted(5) — inrest_save_wizard(media_library,non_media,advanced,status).first_sync_started(8, one-time) — inPush_Sync::process_assets(asset_count).first_api_consumption(9, one-time) — via the existingcloudinary_uploaded_assetaction; emitted on the first successful upload, then suppressed (api_endpoint,asset_type).Client-side (
wizard.js):wizard_started,wizard_signup_clicked,wizard_connect_viewed,credentials_entry_started,credentials_format_validated,connection_test_started,wizard_settings_viewed,wizard_setting_toggled,wizard_completed,wizard_dashboard_clicked.Notes:
first_sync_started,first_api_consumption) are guarded bywp_optionflags.connection_test_resultis server-side (richer error info); the client forwardsattempt_numberon the test request so the server event carries it.track()is now lazy-init so call-sites are order-independent. Still fail-silent end-to-end; nothing emits in production untilcloudinary_analytics_enabledis on (default true) and an event fires.QA notes
plugin_activatedwithactivation_type=fresh_install,previous_versionabsent.activation_type=reactivationwithdays_since_last_active. Bump/lower.versionto exerciseupgrade/downgrade.cloudinary/v1/events),connection_test_resultcarriesattempt_number,wizard_setup_submittedfires on save.first_sync_startedonce; first successful upload →first_api_consumptiononce (re-syncing does not re-fire either).npm run lint:js,npm run lint:php,npm run buildall pass.Test matrix: WP 5.6 / 6.9.x / 7.0, PHP 7.4 / 8.x, single + multisite, classic + block.