question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor GA tracking events for module activation and setup (including Idea Hub adjustments)

See original GitHub issue

As part of redefining some of our legacy GA tracking events, this issue focuses on module activation and setup. As part of that it also touches some events relevant for Idea Hub, which should be part of the Idea Hub launch.


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

Acceptance criteria

  • All of the event categories mentioned below should technically rely on the VIEW_CONTEXT_* constants for their first name segment (i.e. don’t hardcode “dashboard” but use the constant instead).

Module activation and deactivation

  • An activate_module GA event should be fired in the following places:
    • When clicking the button to activate a module in Settings > Connect more services (event category: settings_module-list).
    • When clicking the button to activate a module from within an ActivateModuleCTA (event category: dashboard_widget-activation-cta). Note that this currently is only used by Analytics and PageSpeed Insights.
    • When clicking one of the buttons to activate a module from the common “success” notification on top of the dashboard which appears after successful plugin or module setup (event category: dashboard_authentication-success-notification). The existing module_activate event that is fired there should be removed / replaced with this.
    • When clicking the CTA button to activate Idea Hub in the (currently) Idea Hub-specific activation prompt notification (event category: dashboard_module-activation-notification). Note that there is already another event there which should not be erased - both events should be fired for the same interaction, as they are relevant in different tracking contexts.
    • For each of the above, the module slug should be used as event label.
  • A deactivate_module GA event should be fired when confirming the disconnect dialog after clicking the button to disconnect a module from within Settings > Connected services (event category: settings_module-list). The module slug should be used as event label.

Module setup

  • A view_module_setup GA event should be fired whenever the ModuleSetup component is first rendered.
  • A complete_module_setup GA event should be fired whenever a module setup is completed (via the finishSetup callback within ModuleSetup).
  • A cancel_module_setup GA event should be fired whenever a module setup is explicitly cancelled (via the “Cancel” button within ModuleSetup).
  • For each of the above 3 events the event category should be moduleSetup, and the module slug should be used as event label.

Idea Hub activation prompt notification

  • In addition to the extra activate_module event within this Idea Hub notification (see above), the existing 3 events that are currently Idea Hub-specific should all be renamed, as follows:
    • The event category for the three of them should be dashboard_module-activation-notification.
    • The event names should be view_notification, confirm_notification, and dismiss_notification respectively.
    • The event label for all three of them should be the module slug, which technically can be hard-coded to idea-hub here.
    • Just to explain why the above renaming: In the future we are going to introduce a generic component for this that also can work for other modules, but that should not be part of this issue.

Implementation Brief

  • Module activation and deactivation:
    • In assets/js/components/settings/SetupModule.js:
      • Add trackEvent( '${ VIEW_CONTEXT_SETTINGS }_module-list', 'activate_module', slug ) call to the onSetup callback.
    • In assets/js/components/ActivateModuleCTA.js:
      • Add trackEvent( '${ VIEW_CONTEXT_DASHBOARD }_widget-activation-cta', 'activate_module', moduleSlug ) call before the onCTAClick callback.
    • In assets/js/components/ModulesList.js:
      • Update the trackEvent function call in the handleSetupModule callback to use ${ VIEW_CONTEXT_DASHBOARD }_authentication-success-notification category instead of ${ slug }_setup and activate_module instead of module_activate.
    • In assets/js/modules/idea-hub/components/dashboard/DashboardCTA.js:
      • Update the event names for existing trackEvent calls:
        • confirm_notification instead of prompt_widget_setup
        • view_notification instead of prompt_widget_view
        • dismiss_notification instead of prompt_widget_dismiss
      • Use ${ VIEW_CONTEXT_DASHBOARD }_module-activation-notification as the event category and idea-hub as the event label for updated events.
      • Add trackEvent( '${ VIEW_CONTEXT_DASHBOARD }_module-activation-notification', 'activate_module', 'idea-hub' ) call to the onButtonClick callback before navigation. It can be placed after the existing trackEvent call, but do not delete it or replace the existing trackEvent call.
    • In assets/js/components/settings/SettingsActiveModule/ConfirmDisconnect.js:
      • Add trackEvent( '${ VIEW_CONTEXT_SETTINGS }_module-list', 'deactivate_module', slug ) call to the handleDisconnect callback.
  • Module setup:
    • In assets/js/components/setup/ModuleSetup.js:
      • Add useMount hook that calls trackEvent( 'moduleSetup', 'view_module_setup', moduleSlug ).
      • Add trackEvent( 'moduleSetup', 'complete_module_setup', moduleSlug ) call to the finishSetup callback.
      • Add a new callback for the cancel button that calls trackEvent( 'moduleSetup', 'cancel_module_setup', moduleSlug ).

Test Coverage

  • N/A

Visual Regression Changes

  • N/A

QA Brief

  • Install the Google Analytics Debugger extension for your Google Chrome if you haven’t done it yet.
  • Verify that events mentioned in AC are triggered correctly.

Changelog entry

  • N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
eugene-manuilovcommented, Sep 10, 2021

However, for other events that can happen in multiple view contexts (relevant e.g. #4006) I think it would be most appropriate if we could rely on the current view context. We have that in the Root component, so maybe we could build a simple ViewContextProvider component to use there and a useViewContext hook? Depending on the effort that would take we should only do that for #4006 though, since we need #4004 and #4005 ready for the Idea Hub launch.

Yes, let’s look at it in #4006. IB is updated.

0reactions
wpdarrencommented, Sep 20, 2021

QA Update: ✅

Verified that I have been through all of the ACs for Module activation and deactivation, Module setup and Idea Hub activation prompt notification. I can confirm that the events are triggered as per the ACs. The initial issue reported here has been fixed and the dashboard_module-activation-notification event is only triggered at the top large CTA, and not the widget anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Activation events - Optimize Resource Hub - Google Support
Create your experience (A/B, multivariate, redirect test, or personalization) · Navigate to Settings > Activation event on the experience details page · Click ......
Read more >
Site Kit by Google – Analytics, Search Console, AdSense ...
Easy-to-understand stats directly on your WordPress dashboard; Official stats from multiple Google tools, all in one dashboard; Quick setup for multiple ...
Read more >
readme.txt - HSDC
Refactor settings tabs with React Router and update URL hashes with more ... Add a module activation CTA for Idea Hub to the...
Read more >
Setting up and tracking AutoLeadStar goals and events in ...
AutoLeadStar automatically sends events into Google Analytics. No need to turn anything on, activate or otherwise adjust a setting with this ...
Read more >
Track Events with Google Analytics 4 (GA4) and Google Tag ...
Also, keep in mind that this guide focuses mainly on the setup. I will include a chapter with a quick overview of reports...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found