-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger the custom GA view_notification
event only when the banner notifications are visible
#6023
Comments
ACs here are largely good, but I wanted to call out which components were actually affected. I'll move this to IB, and I can work on that myself 👍🏻 |
Thanks, @tofumatt. Could you please add more information to IB? I think that each components have different circumstances when we can consider them as rendered, right? Let's write them down in IB. |
Thanks, @tofumatt. IB ✔️ |
QA Update:
|
@wpdarren, you're correct |
QA Update: ✅Verified:
|
|
Good spot there @aaemnnosttv. I have looked into this and it's not a regression as I can see the same behaviour in the previous release. I've created a followup issue to address this: #6109 |
Bug Description
Currently, some banner notifications trigger the custom GA
view_notification
event using theuseMount
hook. However, theview_notification
event will be triggered even if the banner notification is not displayed due to the respective component returningnull
if the data is unavailable.The above event should be triggered if the respective banner notification is displayed.
Steps to reproduce
view_notification
.mainDashboard_wp52-version-notification
is triggered.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
view_notification
event should be triggered if the respective banner notification is displayed. The following notification events should be checked to only send when the component actually renders and doesn'treturn null
site-kit-wp/assets/js/components/activation/activation-app.js
Line 62 in 5841f2b
site-kit-wp/assets/js/components/notifications/SetupSuccessBannerNotification.js
Lines 99 to 102 in a7a6f45
site-kit-wp/assets/js/components/notifications/WPVersionBumpNotification.js
Line 53 in a7a6f45
Implementation Brief
trackEvent
call within auseEffect
instead of theuseMount
hook, conditionally on the same code path that causes the component to actually render. An example of how we have done this is in theThankWithGoogleSupporterWallNotification
component.site-kit-wp/assets/js/components/activation/activation-app.js
Line 62 in 5841f2b
useMount
that callstrackEvent
to be auseEffect
that only runs whenbuttonURL
is truthy.site-kit-wp/assets/js/components/notifications/SetupSuccessBannerNotification.js
Lines 99 to 102 in a7a6f45
useMount
to auseEffect
here:site-kit-wp/assets/js/components/notifications/SetupSuccessBannerNotification.js
Lines 99 to 102 in 5841f2b
return null
are met (starts withmodules !== undefined && !! notification
, but also includes conditions in this switch case). It might be worth cleaning up the switch case here and returning early in a few places, as the current logic is a bit hard to read.site-kit-wp/assets/js/components/notifications/WPVersionBumpNotification.js
Line 53 in a7a6f45
useMount
to auseEffect
that only callstrackEvent
whenhasMinimumWPVersion === false && version !== undefined
Test Coverage
QA Brief
view_notification
GA event for theactivation
category is triggered only when theActivationApp
notification is displayed. (This notification will have theCongratulations, the Site Kit plugin is now activated.
title).view_notification
GA event for themainDashboard_wp52-version-notification
event category is triggered only when theWPVersionBumpNotification
is displayed.SetupSuccessBannerNotification
is displayed:view_notification
-mainDashboard_authentication-success-notification
complete_user_setup
-mainDashboard_authentication-success-notification
complete_site_setup
-mainDashboard_authentication-success-notification
Changelog entry
The text was updated successfully, but these errors were encountered: