site-kit-wp: Prevent the success notification appearing when returning from OAuth in the GA4 Activation Banner flow
Bug Description
As described in https://github.com/google/site-kit-wp/issues/5282#issuecomment-1246528980, at present, when returning from OAuth to the GA4 Activation Banner, the Success Notification is displayed, interrupting the desired GA4 Activation Banner flow.
We need to prevent the Success Notification from being displayed in this particular case.
Steps to reproduce
Follow the steps detailed in https://github.com/google/site-kit-wp/issues/5282#issuecomment-1246528980 with more info available in the QAB for #5282.
Screenshots
Here is a screenshot of the Success Notification, shown when the URL contains the query param notification=authentication_success
.
See https://github.com/google/site-kit-wp/issues/5282#issuecomment-1246528980 for more screenshots.
Additional Context
- PHP Version: any
- OS: any
- Browser: any
- Plugin Version: 1.83.0
- Device: any
Acceptance criteria
- When returning from OAuth to the GA4 Activation Banner, the Success Notification should not be displayed, and the GA4 Activation Banner should be shown in its expected state.
Implementation Brief
- In the
assets/js/components/PermissionsModal/AuthenticatedPermissionsModal.js
file:- Update the
redirectURL
property of thegetConnectURL
selector call to usepermissionsError?.data?.redirectURL
value if provided or fallback to the current location href otherwise.
- Update the
- In the
assets/js/modules/analytics-4/components/dashboard/ActivationBanner/SetupBanner.js
file:- In the
handleSubmitChanges
callback:- Create a new variable
redirectURL
and assign the current location href appended withnotification=ga4_setup
using theaddQueryArg
function. - Add a new
redirectURL
property to thedata
object of the permission scope error passed to thesetPermissionScopeError
action.
- Create a new variable
- In the
- In the
assets/js/components/notifications/BannerNotifications.js
file:- Update the
ActivationBanner
component rendering to make sure we don’t display it in theviewOnly
mode.
- Update the
- In the
OAuth_Client
class:- Update
$redirect_url
modifications inauthorize_user
andget_authentication_url
methods to avoid adding thenotification=authentication_success
argument to the redirect URL if the redirect URL already has thenotification
query argument.
- Update
Test Coverage
- Fix any failing tests.
QA Brief
- This can be tested along with #5282. The “Congrats…” banner should no longer appear when returning from OAuth to the GA4 Activation Banner.
- Additionally, a slightly tangential issue has been fixed at the same time: The GA4 Activation Banner will no longer appear in view-only mode. This can be tested as well, setting the scene for the activation banner to appear, then viewing in view-only mode to verify the banner does not appear.
Changelog entry
- Ensure GA4 activation banner is displayed when returning from granting additional scopes after setting up GA4 instead of generic success banner.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17
Thanks @eugene-manuilov. I’m happy enough to stick with
ga4_setup
in that case - we can always revisit it later.