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 settings

See original GitHub issue

This issue introduces new general GA events around module settings (related: #4004).


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).
  • The following new GA events should be fired in the Settings > Connected services tab, for all modules (event category: settings_module-list, event label: the respective module slug):
    • view_module_settings whenever the user expands a module’s settings panel.
    • close_module_settings whenever the user collapses a module’s settings panel.
    • edit_module_settings whenever the user clicks on the “Edit” button within a module’s settings panel.
    • update_module_settings whenever a module’s settings have been successfully updated (via the handleConfirm callback within the module’s settings panel’s Footer).
    • cancel_module_settings whenever the user cancels out of the “Edit” mode explicitly via the “Cancel” (or “Close”) button within the module settings panel’s Footer.

Implementation Brief

  • In assets/js/components/settings/SettingsActiveModule/Header.js:
    • Add a new callback that calls trackEvent( '${ VIEW_CONTEXT_SETTINGS }_module-list', 'view_module_settings', slug ) if isOpen is false. Otherwise it should call trackEvent( '${ VIEW_CONTEXT_SETTINGS }_module-list', 'close_module_settings', slug ).
    • Add the new callback to the onClick property of the Link element.
  • In assets/js/components/settings/SettingsActiveModule/Footer.js:
    • Add a new callback handleEdit that calls trackEvent( '${ VIEW_CONTEXT_SETTINGS }_module-list', 'edit_module_settings', slug ).
    • Add the handleEdit callback to the onClick property of the Edit link.
    • Update the handleConfirm callback to call trackEvent( '${ VIEW_CONTEXT_SETTINGS }_module-list', 'update_module_settings', slug ) when settigns are saved successfully.
    • Update the handleClose callback to call trackEvent( '${ VIEW_CONTEXT_SETTINGS }_module-list', 'cancel_module_settings', slug ).

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:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
felixarntzcommented, Oct 1, 2021

@wpdarren The cancel_module_settings should indeed happen on either the “Close” or “Cancel” button (which technically do almost the same thing, it’s just that the label is different for modules where there are no settings. So it looks like that indeed needs to be fixed @kuasha420

I couldn’t see it in the AC but should I expect to see events when I disconnect a module within the ‘Connected Services’ tab. When I click to disconnect I see settings_module-list and deactivate_module Is this correct? Just wondering if it should be deactivate_module_settings

This is correct as is. All the *_module_settings events are to compare interactions in the UI, whereas the deactivate_module event is more focused on seeing from where and how often people deactivate modules.

0reactions
wpdarrencommented, Oct 4, 2021

QA Update: ✅

Verified:

settings_module-list, event label appears on all: view_module_settings whenever the user expands a module’s settings panel. close_module_settings whenever the user collapses a module’s settings panel. edit_module_settings whenever the user clicks on the “Edit” button within a module’s settings panel. update_module_settings whenever a module’s settings have been successfully updated cancel_module_settings whenever the user cancels out of the “Cancel” and “Close” button.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refactor GA tracking events for module activation and setup ...
As part of redefining some of our legacy GA tracking events, this issue focuses on module activation and setup. As part of that...
Read more >
[GA4] Modify and create events via the user interface
This article describes how to modify and create events in Analytics configuration. All events created in Analytics are based on existing website and...
Read more >
Google Tag Manager Form Tracking with GA4 - Analytics Mania
Go to Tags; Press New button; In Tag Configuration choose Google Analytics: GA4 Event; In the Configuration Tag field, select your current ...
Read more >
Refactor module architecture in a simpler, opinionated and ...
#3002332: Track composite (e.g. paragraph) entities directly and only as their ... All events dispatched by this module have been adjusted, ...
Read more >
Using Google Analytics Event Tracking - Hallam Internet
Create a new tag in Google Tag Manager and change the Track Type to 'Event'. The configuration options will now include tracking parameter ......
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