-
Notifications
You must be signed in to change notification settings - Fork 299
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
When enabling groups the Analytics edit scope is requested even when it won't be needed #9595
Comments
IB ✔ |
QA Update ✅
Property already have audiences Recording.1826.mp4Property don't have audiences Recording.1833.mp4Recording.1828.mp4OAuth Error: Recording.1830.mp4Insufficient Permissions Error: Recording.1831.mp4Generic error: Recording.1832.mp4 |
Feature Description
The Analytics edit scope is only required when creating an audience or custom dimension, but it's always requested if not present when setting up the feature via one of the Enable groups CTAs.
This could be avoided by first syncing the audiences and custom dimensions and determining if any need to be created, and then only entering the OAuth flow to request the scope if necessary.
See the related Asana task.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
googlesitekit_post_type
custom dimension need to be created.Implementation Brief
assets/js/modules/analytics-4/hooks/useEnableAudienceGroup.js
:onEnableGroups
useCallback:await syncAvailableAudiences()
.getAvailableAudiences
selector..find
returningtrue
the first time an audiences is missing, otherwise returnfalse
, call this booleanrequiresNewAudienceCreation
:getAvailableCustomDimensions
selector.googlesitekit_post_type
key using.find
, negate the response of the find and call this booleanrequiresPostTypeCustomAudienceCreation
.site-kit-wp/assets/js/modules/analytics-4/datastore/audiences.js
Lines 435 to 438 in bc72433
Test Coverage
assets/js/modules/analytics-4/hooks/useEnableAudienceGroup.test.js
to confirm additional permissions are only requested when the AC conditions are met.QA Brief
audienceSegmentation
feature flag.googlesitekit_post_type
custom dimension.googlesitekit_post_type
custom dimension set up. Verify that it does redirect you to OAuth now.Changelog entry
The text was updated successfully, but these errors were encountered: