site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Implement/refactor GA tracking events for admin bar menu

Open felixarntz opened this issue 5 years ago • 4 comments

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 current page_stats_view event, which should be removed.
    • open_urldetails: Should be triggered when clicking the details link in the admin bar menu and replace the current post_details_click event, which should be removed.
    • Both of the above events should use VIEW_CONTEXT_ADMINBAR as event category.

Implementation Brief

Inside assets/js/googlesitekit-adminbar.js

  • Change the call to trackEvent to use VIEW_CONTEXT_ADMINBAR as the category (first argument) and view_urlsummary as the action (second argument).

Inside assets/js/components/adminbar/AdminBarApp.js:

  • Import the VIEW_CONTEXT_ADMINBAR view context from assets/js/googlesitekit/constants.js
  • As above, refactor the call to trackEvent so that the category (first argument) is VIEW_CONTEXT_ADMINBAR and the action (second argument) is open_urldetails instead of post_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

felixarntz avatar Sep 15 '21 23:09 felixarntz

@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.

eugene-manuilov avatar Sep 23 '21 14:09 eugene-manuilov

Thanks @eugene-manuilov, IB updated. Ready for another pass 👍

johnPhillips avatar Sep 23 '21 15:09 johnPhillips

IB :heavy_check_mark:

eugene-manuilov avatar Sep 23 '21 16:09 eugene-manuilov

QA: :heavy_check_mark:

Verified that new tracking events with new category (adminBar) are being sent to GA for both actions.

LGTM.

kuasha420 avatar Sep 30 '21 01:09 kuasha420