Implement/refactor GA tracking events for admin bar menu
Feature Description
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The following new GA tracking events should be triggered for the Site Kit admin bar menu:
view_urlsummary: Should be triggered when viewing/rendering the admin bar menu and replace the currentpage_stats_viewevent, which should be removed.open_urldetails: Should be triggered when clicking the details link in the admin bar menu and replace the currentpost_details_clickevent, which should be removed.- Both of the above events should use
VIEW_CONTEXT_ADMINBARas event category.
Implementation Brief
Inside assets/js/googlesitekit-adminbar.js
- Change the call to
trackEventto useVIEW_CONTEXT_ADMINBARas the category (first argument) andview_urlsummaryas the action (second argument).
Inside assets/js/components/adminbar/AdminBarApp.js:
- Import the
VIEW_CONTEXT_ADMINBARview context fromassets/js/googlesitekit/constants.js - As above, refactor the call to
trackEventso that the category (first argument) isVIEW_CONTEXT_ADMINBARand the action (second argument) isopen_urldetailsinstead ofpost_details_click.
Test Coverage
- No new tests required; existing tests should pass.
QA Brief
- Install the Google Analytics Debugger extension for your Google Chrome if you haven't done it yet.
- Verify that GA requests are being sent as per the AC.
Changelog entry
- N/A
@johnPhillips we don't need to rely on the current view context in this ticket. We just need to use the VIEW_CONTEXT_ADMINBAR constant directly as the GA category. So no need to import context related functionality in the AdminBarApp component.
Thanks @eugene-manuilov, IB updated. Ready for another pass 👍
IB :heavy_check_mark:
QA: :heavy_check_mark:
Verified that new tracking events with new category (adminBar) are being sent to GA for both actions.
LGTM.