Site-kit-wp: Add custom events for the analytics tracking box during setup

Created on 16 Jan 2020  Â·  9Comments  Â·  Source: google/site-kit-wp

Feature Description

We need an additional custom dimension to understand what percentage of site owners opted in to the anonymous tracking within the plugin.


_Do not alter or remove anything below. The following sections will be managed by moderators only._

Acceptance criteria

Add custom dimensions to keep track of whether site owners opt in for anonymous tracking.

1) Whenever a user checks the "Help us improve.." box during setup from the Plugins page
Type: Event
Trigger: Click
Category: tracking_plugin
Action: analytics_optin_setup_banner

2) Whenever a user checks the "Help us improve.." box to opt in during setup from the landing page:
Type: Event
Trigger: Click
Category: tracking_plugin
Action: analytics_optin_setup_fallback

3) Whenever a user checks the "Help us improve.." box to opt in during setup from the Settings page:
Track type: Event
Trigger: Click
Category: tracking_plugin
Action: analytics_optin_settings_page

Implementation Brief

Depends on #1055

  • When opting in, enable tracking with new enableTracking() utility and call sendTrackingEvent() with the proper event data
  • Update <Optin> to accept a new optinAction prop, which would contain the value to pass as the event action in the tracking event
  • Update consuming components of <Optin> to pass the appropriate optinAction

    • <ActivationMain> as analytics_optin_setup_banner

    • <SettingsAdmin> as analytics_optin_settings_page

    • <SetupUsingProxy> as analytics_optin_setup_fallback

    • <WizardStepAuthentication> as analytics_optin_setup_fallback

QA Brief

  • Install Tag Assistant Chrome extension
  • Check that checking/enabling the tracking opt-in tracks the following events in Tag Assistant
    Click
    image
    Click into "Events" at the bottom to see the event category and action
    image
    image
  • All event should have the same tracking_plugin for the event category
  • Checking the opt-in from the plugin activation notice should add an event with the analytics_optin_setup_banner action
  • Checking the opt-in from the plugin setup/splash page should add an event with the analytics_optin_setup_fallback action

    • Same for the legacy non-proxy setup wizard (must provide GCP client ID and secret to reach this)

  • Checking the opt-in from the plugin settings page should add an event with the analytics_optin_settings_page action

Changelog entry

  • N/A

All 9 comments

@marrrmarrr a few questions for you about this:

  • How should the before-click state of the opt-in influence this?

    • If the user was opted out and is opting in, I would imagine we track that

    • If the user was opted in and is opting out, do we track that as well?

    • If we track both, does that change the event data at all or it should be the same in both cases?

@aaemnnosttv For now, we should only track when somebody opts in (basically anytime somebody enables the checkbox).

@aaemnnosttv I like the ideas from the IB, they seem closely related to the #1055 work though. Can we include them there instead? We can leave this issue here as blocked, and focus on the necessary infrastructure first.

@aaemnnosttv Whenever you get to it, can you revise this IB based on the implementation for #1055?

IB ✅

Confirmed the latest build functions.

Installed Tag Assistant.

image

Need Dev assistance, as I'm not seeing what is shown on the QA brief

You need to click Record first before Tag Assistant can inspect/observe events on the page. This is only needed at the beginning, not on every single page view.

Edit: it looks like you just needed to reload the page after initially enabling Tag Assistant.

Tested

Checked Tag Assistant on the Activation page via Dashboard
image

Activation via Plugins page
image

Settings page:
image

Passed QA ✅

Verified these events are recorded in GA as well. LGTM

Was this page helpful?
0 / 5 - 0 ratings