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.

Update GA event category for a few widget events

See original GitHub issue

Related to our GA tracking event refinements, in addition to the Idea Hub widget-specific events (see #4005), we should also adjust the existing events for All Traffic and PageSpeed accordingly.


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). It should rely on the current view context, which for both of the widgets here could be either dashboard or pageDashboard.
  • The all_traffic_widget GA event category should be renamed to {viewContext}_all-traffic-widget across all usages (including widget tooltip tour).
  • The pagespeed_widget GA event category should be renamed to {viewContext}_pagespeed-widget across all usages.

Implementation Brief

  • Create a new ViewContextContext.js file in the assets/js/components/Root/ directory. It should create a new context with an empty string as the default value and export the new context object as the default export.
  • Update the Root component:
    • Wrap children with the new ViewContext provider imported from the ViewContextContext file.
    • Remove the viewContext property from ErrorHandler and FeatureToursDesktop elements.
  • Update the ErrorHandler component:
    • Use the ViewContext context object imported from the ViewContextContext file as ErrorHandlers contextType property. See the Reactjs documentation for more infomration.
    • Update the trackEvent call in the componentDidCatch method to use ${ this.context || 'unkonwn' } instead of ${ viewContext } in the event name.
    • Update the FeatureTours component to receive the veiwContext variable using the useContext hook.
  • Update DimensionTabs and UserDimensionsPieChart components from the analytics module to receive the current viewContext using the useContext hook and to use the viewContext value as a prefix for the all_traffic_widget GA event category ({viewContext}_all-traffic-widget).
  • Update DashboardPageSpeed and Recommendation components from the pagespeed-insights module to receive the current viewContext using the useContext hook and to use the viewContext value as a prefix for the pagespeed_widget GA event category ({viewContext}_pagespeed-widget).

Test Coverage

  • Update existing tests if any fails due to the aforementioned changes.

Visual Regression Changes

  • N/A

QA Brief

  • Verify that the GA events for the two widgets are as per the AC

Changelog entry

  • N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
felixarntzcommented, Sep 22, 2021

@johnPhillips Maybe for this issue we could hard-code the feature tours to rely on VIEW_CONTEXT_DASHBOARD as an intermediate solution? Technically this should be sufficient for now, since those feature tours aren’t really shown elsewhere.

0reactions
wpdarrencommented, Oct 4, 2021

QA Update: ✅

The all_traffic_widget GA event category is renamed to {viewContext}_all-traffic-widget across all usages. The pagespeed_widget GA event category is renamed to {viewContext}_pagespeed-widget across all usages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing Megalytic: The Events Summary Widget
The Events Summary widget allows for a wide array of options for customization. You can, of course, modify the chart type and apply...
Read more >
[GA4] Modify and create events via the user interface
Steps to create an event · In the left navigation, click Admin. · In the Property column, click Events. · Click Create event....
Read more >
Setting up and using Google Analytics for the Web Widget ...
Sign in to your Google Analytics account. On the left sidebar, select Behavior > Events > Top Events. Under Event Category, select Zendesk...
Read more >
Google Tag Manager event tracking – The Guide
In this tutorial, you will learn how implement Google Tag Manager event tracking and send them to Google Analytics.
Read more >
How to Track Events with Google Analytics 4 (Updated in 2022)
Learn how to send events to Google Analytics 4 with Google Tag Manager.When GA4 was introduced, it was announced as the event -based ......
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