Update GA event category for a few widget events
See original GitHub issueRelated 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 eitherdashboard
orpageDashboard
. - 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 theassets/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 theViewContextContext
file. - Remove the
viewContext
property fromErrorHandler
andFeatureToursDesktop
elements.
- Wrap children with the new
- Update the
ErrorHandler
component:- Use the
ViewContext
context object imported from theViewContextContext
file asErrorHandler
scontextType
property. See the Reactjs documentation for more infomration. - Update the
trackEvent
call in thecomponentDidCatch
method to use${ this.context || 'unkonwn' }
instead of${ viewContext }
in the event name. - Update the
FeatureTours
component to receive theveiwContext
variable using theuseContext
hook.
- Use the
- Update
DimensionTabs
andUserDimensionsPieChart
components from theanalytics
module to receive the currentviewContext
using theuseContext
hook and to use theviewContext
value as a prefix for theall_traffic_widget
GA event category ({viewContext}_all-traffic-widget
). - Update
DashboardPageSpeed
andRecommendation
components from thepagespeed-insights
module to receive the currentviewContext
using theuseContext
hook and to use theviewContext
value as a prefix for thepagespeed_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:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.QA Update: ✅
The
all_traffic_widget
GA event category is renamed to {viewContext}_all-traffic-widget
across all usages. Thepagespeed_widget
GA event category is renamed to{viewContext}_pagespeed-widget
across all usages.