Closed techanvil closed 1 month ago
Hi @benbowler, thanks for drafting this IB. A couple of points:
... selectors to monitor
syncAvailableCustomDimensions
selector/resolver like so:
fetchSyncAvailableCustomDimensions()
action, this doesn't seem right. We'll probably want to use isFetchingSyncAvailableCustomDimensions()
, e.g.:Hi @benbowler, thanks for updating the IB. A few more points:
For the view-only context:
isSyncingAvailableCustomDimensions
in the AudienceTile
component because the AudienceTileLoading
component will be rendered instead due to including this value in the loading condition.individualTileErrors
value, in order to avoid showing the whole tile in the error state, but still need to flag that there was an invalid custom dimension error to the AudienceTile
so it can avoid rendering the "Top content" metric area.More fundamentally, though - I've noticed the googlesitekit_post_type
custom dimension is actually missing from the "Top content" report options:
It needs to be added as a dimension filter, like we do here, but with value: 'post'
:
This will be needed for this issue to be complete and testable, so we should include the fix here too. There's likely to be a number of tests that need updating as a result which we should factor into the estimate.
I chose to use the getErrorForSelector
selector within the AudienceTile
component instead of adding another new prop to this component, we could instead create a new prop such as hasTopContentCustomDimensionError
instead if prefered.
I've increased the estimate a couple of bands because the scope has expanded slightly as we've discussed required fixes/additions to be able to work on this ticket.
Thanks @benbowler. Using getErrorForSelector()
SGTM.
A small point, you've referred/linked to topCitiesReportErrors
with regard to filtering out the invalid custom dimension errors, in fact they should be filtered out from topContentReportErrors
and topContentPageTitlesReportErrors
. I've amended that to save a round trip.
IB :white_check_mark:
Hi @techanvil , I followed the steps but it doesn't seem like it's working as expected.
Video is attached for reference:
Let me know in case I missed any steps.
Hey @kelvinballoo, maybe I should have mentioned this in the QAB, but you won't be able to test this issue with the Tester plugin configured to provide mock report data. This is because the underlying code relies on the error response returned by the real request for the "Top content" data once the custom dimension has been archived.
You should be able to test this with any property which is legitimately out of the gathering data state. Please give it another try and let me know if you run into any further problems.
Hi @techanvil , thanks. I managed to test it with a site, despite having 0 data, it was out of the gathering state. I was able to get the 'Update' button and in dashboard sharing view mode, the "Top content" metric area did not appear in the tiles. ✅
Clicking on 'Update' on the admin dashboard: ✅
This is working as expected. Moving ticket to approval.
Feature Description
The Audience Tile's "Top content" metric area has a CTA for creating the
googlesitekit_post_type
custom dimension if it doesn't exist.However, it doesn't have logic in place to determine if the custom dimension doesn't exist when requesting the report for the metric. At present it's reliant on the list of available custom dimensions being synced somewhere, which only happens during Audience Segmentation setup, or in the Key Metrics feature.
We should ensure that, if the report for the "Top content" metric returns an error because the custom dimension doesn't exist, the list of custom dimensions is resynced so the tile will immediately know that the dimension is missing and show the CTA to create it.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
googlesitekit_post_type
present in the "Top content" metric area (already implemented via https://github.com/google/site-kit-wp/issues/8153).Implementation Brief
Add Missing Custom Dimension to Top Content Report
googlesitekit_post_type
dimension filter to the top content report options:https://github.com/google/site-kit-wp/blob/119747b9e3be9bb8310faec37b7ea41c6b4ea89f/assets/js/modules/analytics-4/hooks/useAudienceTilesReports.js#L322-L329 https://github.com/google/site-kit-wp/blob/119747b9e3be9bb8310faec37b7ea41c6b4ea89f/assets/js/modules/analytics-4/hooks/useAudienceTilesReports.js#L346-L353
Authenticated User Context
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTiles.js
(note the newuseAudienceTilesReports
custom hook merged in #8144):useEffect
withtopContentReportErrors
as a dependency.topContentReportErrors
contains any invalid custom dimension errors using the.find
prototype, and use theisInvalidCustomDimensionError
util to identify this error type.fetchSyncAvailableCustomDimensions
.isSyncingAvailableCustomDimensions
containing the value of theisFetchingSyncAvailableCustomDimensions
selector: https://github.com/google/site-kit-wp/blob/56feb1f6ca227cc9fc6da3511a96fb2f4bf9d3b0/assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTile/AudienceTilePagesMetric.js#L94-L96isSyncingAvailableCustomDimensions
: https://github.com/google/site-kit-wp/blob/41f0bbaec9736ba334cccc7b469ce1a5e2cdfc71/assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTiles.js#L419-L427topContentReportErrors
andtopContentPageTitlesReportErrors
here, using theisInvalidCustomDimensionError
util, so that the Top Cities Audience Tile will be rendered if there is only an invalid custom dimension error: https://github.com/google/site-kit-wp/blob/b2d47c854a1c23eaba82690c88812972ba730bed/assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTiles.js#L321-L322View-Only Context
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTile/index.js
, use thegetErrorForSelector
selector to get any errors for the top content report for the audienceResourceName of the current tile.Test Coverage
QA Brief
Authenticated user
audienceSegmentation
feature flag enabled and Analytics connected to a property which is out of the "gathering data" state.googlesitekit_post_type
custom dimension in Analytics.sessionStorage.clear()
in the JS console.sync-custom-dimensions
endpoint should appear in the network devtools.View-only user
Changelog entry
googlesitekit_post_type
custom dimension appears in the main dashboard when the corresponding report error indicates the missing custom dimension.