-
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
Implement the “Top content” metric handling for missing custom dimension #8153
Comments
Hey @hussain-t, nice work so far on the IB here. A few thoughts:
|
Thanks for the valuable feedback, @techanvil. I have updated the IB accordingly. The refactoring of the |
Thanks @hussain-t! One thing - I've removed the point about report errors which was missed from the previous review. All looks good now, this IB LGTM. ✅ |
Sorry for the oversight, and thanks for updating it, @techanvil 👍 |
Hi @hussain-t, as you'll have seen I've left some comments on the PR. One more thing, with regard to the QAB - it would be worth providing this snippet as a tip for syncing the available custom dimensions after deleting the googlesitekit.data.dispatch( 'modules/analytics-4' ).fetchSyncAvailableCustomDimensions() |
Thanks, @techanvil. I've updated the QAB. |
…g-custom-dimension Enhance/#8153 - Top content metric handling for missing custom dimension
QA Update
|
QA Update
|
@kelvinballoo, it means to display the "Retry" button instead of "Request access". Cancel should be available regardless. |
QA Update ✅Thanks for confirming @hussain-t This is working as expected:
Moving ticket to approval |
Feature Description
Implement the ability to create the custom dimension from the "Top content" metric section if it's missing (e.g. the user has archived it in Analytics).
This includes the happy and unhappy paths, excluding those related to redirecting to OAuth if necessary which will be handled separately via #8154.
See audience tiles > "Top content" states and error modal in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
googlesitekit_post_type
doesn't exist (e.g. the user has archived it in Analytics), the "Top content" metric area in an Audience Tile should be displayed in a zero data state which includes an Update CTA.Implementation Brief
Note: Depending on which issue is implemented first, it could be worth taking a look at the error handling introduced via #8134 to see if can be refactored for reuse.
Note 16 May 2024: Working on #8484 first because the
getReportForAllAudiences
will be refactored out making the Error selectors simpler.Create a
AudienceTilePagesMetricContent
Component inassets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTile
:AudienceTilePagesMetricContent
that will be used to render the content of the "Top content" metric area.SpinnerButton
.AudienceTileNoData
.topContentTitles
:PropTypes.object.isRequired
,topContent
:PropTypes.object.isRequired
,isTopContentPartialData
:PropTypes.bool.isRequired
,hasCustomDimension
:PropTypes.bool.isRequired
,onCreateCustomDimension
:PropTypes.func.isRequired
,isSaving
:PropTypes.bool.isRequired
,AudienceTilePagesMetric
.SpinnerButton
with the text “Update”.SpinnerButton
should be disabled if theisSaving
prop istrue
.onCreateCustomDimension
callback function to theonClick
prop of theSpinnerButton
.AudienceTileNoData
component.ContentLinkComponent
component as per the current implementation inAudienceTilePagesMetric
.AudienceTilePagesMetric
.Update
button styles should match the Figma design.Update the AudienceTilePagesMetric Component:
googlesitekit_post_type
using thehasCustomDimensions
selector.https://www.googleapis.com/auth/analytics.edit
scope using thehasScope
selector.handleCreateCustomDimension
callback function with the following logic:autoSubmit
state totrue
in theCORE_FORMS
store with the keyAUDIENCE_TILE_CUSTOM_DIMENSION_CREATE
.setPermissionScopeError
action with thecode
set toERROR_CODE_MISSING_REQUIRED_SCOPE
.AudienceTilePagesMetricContent
component with the following props:topContentTitles
-topContentTitles
prop.topContent
-topContent
prop.isTopContentPartialData
-isTopContentPartialData
prop.hasCustomDimension
-hasCustomDimension
prop.onCreateCustomDimension
-handleCreateCustomDimension
callback function.isSaving
- Determine this using theisCreatingCustomDimension
andisSyncingAvailableCustomDimensions
selectors OR theautoSubmit
state of theAUDIENCE_TILE_CUSTOM_DIMENSION_CREATE
form.getCreateCustomDimensionError
selector returns an error.AudienceErrorModal
component which is being implemented in #8134.title
with the valueFailed to enable metric
and thedescription
with the valueOops! Something went wrong. Retry enabling the metric.
to theAudienceErrorModal
component.handleCreateCustomDimension
callback function to theonRetry
prop of theAudienceErrorModal
component.Update the DashboardMainApp component to create the custom dimension:
AUDIENCE_TILE_CUSTOM_DIMENSION_CREATE
form state.fetchCreateCustomDimension
action property ID and thegooglesitekit_post_type
.receiveIsCustomDimensionGatheringData
action.fetchSyncAvailableCustomDimensions
action.enableAudienceGroup
action into a separate action that does the above steps.useEffect
hook if theautoSubmit
state istrue
with the following:autoSubmit
state of theAUDIENCE_TILE_CUSTOM_DIMENSION_CREATE
form tofalse
.Update the
AudienceErrorModal
component:title
anddescription
props to theAudienceErrorModal
component.title
prop is set, render it in the modal. Otherwise, render the default title.description
prop is set, render it in the modal. Otherwise, render the default description.Disable the Dashboard Sharing and User Menu buttons:
Button
component if theautoSubmit
state istrue
for theAUDIENCE_TILE_CUSTOM_DIMENSION_CREATE
form.Button
component if theautoSubmit
state istrue
for theAUDIENCE_TILE_CUSTOM_DIMENSION_CREATE
form.Test Coverage
AudienceTile
component with the custom dimension missing content.AudienceTilesWidget
component with the custom dimension missing content.QA Brief
Prerequisites
audienceSegmentation
feature flag.googlesitekit_post_type
custom dimension is missing in Analytics. It can be archived or deleted in the Analytics UI.Testing the Custom Dimension Missing Content
Testing the Error Modal
There are two error variants to test:
Insufficient Permissions Error Variant
To simulate the Insufficient Permissions error variant:
Install and Configure Tweak Extension:
create-custom-dimension
request:.*/wp-json/google-site-kit/v1/modules/analytics-4/data/create-custom-dimension*
(.*)
POST
403
Trigger the Insufficient Permissions Error:
Generic Error Variant
To simulate the Generic Error variant:
API Errors:
Simulate a 500 error:
create-custom-dimension
request:.*/wp-json/google-site-kit/v1/modules/analytics-4/data/create-custom-dimension*
(.*)
POST
500
Trigger the Generic Error:
Changelog entry
The text was updated successfully, but these errors were encountered: