site-kit-wp
site-kit-wp copied to clipboard
Implement the zero data state of an Audience Tile
Feature Description
Implement the zero data state of an audience. This includes the “temporarily hide” behavior.
See audience tiles > zero data in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Given that a selected audience is in the "partial data" state, and it has zero data for the current date range:
- Its Audience Tile should be displayed in the "zero data" variant.
- It should be implemented as per the Figma design.
- If there is only one audience in the audience selection, the copy for the descriptive text should be:
- Site Kit is collecting data for this group
- If there are multiple audiences in the audience selection:
- The copy for the descriptive text should be:
- Site Kit is collecting data for this group. You can hide this group until data is available.
- The tile should have a Temporarily hide CTA.
- Clicking on Temporarily hide will hide the tile, until the audience is determined to be in a non-zero data state on a subsequent page load.
- The copy for the descriptive text should be:
Implementation Brief
-
[ ] Update
AudienceTileNoDatacomponent insideassets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTile- [ ] This should accept an additional prop
displayHideCTAwhich should be boolean. - [ ] If
displayHideCTAistrue, it should displayTemporarily hideCTA.- [ ] Clicking the
Temporarily hideCTA should dispatch an action to dismiss the item with item name asaudience_tile_${audienceResourceName}as slug and 0 as the expiration.audienceResourceNameshould be normalised with underscrores by replacing/with_. This may need an utility function likehyphenCaseToPascalCasehere -[ ] Action to dismiss the action can be dispatch withdismissItemselector in user data store.
- [ ] Clicking the
- [ ]
AudienceTileNoDatashould display the the svg icon for no data as per the figma design. - Also display the text as mentioned in AC according to the value of
displayHideCTAprop.
- [ ] This should accept an additional prop
-
[ ] In
AudienceTilescomponent insideassets/js/modules/analytics-4/components/audience-segmentation/dashboard/, before rendering theAudienceTilecomponent.- [ ] Get the report for all audiences in
configuredAudiencesusing thegetReportForAllAudiencesselector of analytics-4 module. - [ ] Check if the audience is in the partial state using the
isResourcePartialDataselector of analytics-4 module. - [ ] If the given audience is in partial data state and it has zero data (using hasZeroData selector), render the
AudienceTileNoDatacomponent instead ofAudienceTilecomponent. Before rendering theAudienceTileNoData, also check if the tile has been dismissed withTemporarily hideCTA.- [ ] Pass
displayHideCTAprop astrueif the above condition is met and length ofconfiguredAudiencesis more than 1. - [ ] Pass
displayHideCTAprop asfalseif the above condition is met, but length ofconfiguredAudiencesis only 1.
- [ ] Pass
- [ ] Get the report for all audiences in
Test Coverage
- Remove the
AudienceTileNoDatatest fromAudienceTilestory asAudienceTileNoDatawill never be rendered from within theAudienceTilecomponent. - Update the storybook test for
AudienceTilescomponent where one of the component should return the zero data for one of the audience. - Add the story where there's only one audience so that it should not render "Temorarily hide" CTA.