[ ] Refactor the AudienceTileError component to be a module with its own folder and an index.js file.
[ ] Extract the rendered JSX content from the AudienceTileError component to a new component e.g. TileErrorContent.
Wrap the TileErrorContent component in forwardRef() so a ref can be passed to it, and add the ref to its top-level rendered element.
Add an onRetry prop of type PropTypes.func to TileErrorContent, and pass it through to ReportErrorActions.
[ ] In the AudienceTileError component:
Add an audienceSlug prop of type PropTypes.string.
Create a version of TileErrorContent wrapped by the withIntersectionObserver() HOC, e.g. TileErrorContentWithIntersectionObserver. Render this in place of the existing TileErrorContent instance.
Pass the onInView callback prop to TileErrorContentWithIntersectionObserver:
Determine the action for the GA event: insufficient_permissions_error for an insufficient permissions error, or data_loading_error for any other error.
Pass the onRetry callback prop to TileErrorContent:
Determine the action for the GA event: insufficient_permissions_error_request_access for an insufficient permissions error, or data_loading_error_retry for any other error.
[ ] Add an onOpen prop of type PropTypes.func to both the InfoTooltip and Tooltip components. Pass the prop through from InfoTooltip to Tooltip to MuiTooltip.
[ ] Add an onTooltipOpen prop of type PropTypes.func to the BadgeWithTooltip component. Pass the prop through as the onOpen prop to InfoTooltip.
Add an audienceSlug prop of type PropTypes.string and pass it through to the AudienceTilePagesMetric component.
Pass the onOpen callback prop to InfoTooltip. In the callback, call trackEvent( '${viewContext}_audiences-tile', 'view_tile_tooltip', audienceSlug ).
Pass the onTooltipOpen callback prop to BadgeWithTooltip. In the callback, call trackEvent( '${viewContext}_audiences-tile', 'view_tile_partial_data_tooltip', audienceSlug ).
[ ] In the AudienceTilePagesMetric component:
Add an audienceSlug prop of type PropTypes.string.
Pass the onTooltipOpen callback prop to BadgeWithTooltip. In the callback, call trackEvent( '${viewContext}_audiences-tile', 'view_top_content_partial_data_tooltip', audienceSlug ).
[ ] In the AudienceTiles component:
Pass the audienceSlug prop to the AudienceTile and AudienceTileError components with the value of the audienceSlug constant.
[ ] Create a new AudienceTileZeroData component. Make AudienceTileZeroData a module with its own index.js file and create another component, TileZeroDataContent in the module folder.
Wrap the TileZeroDataContent component in forwardRef() so a ref can be passed to it, and add the ref to its top-level rendered element.
[ ] In the AudienceTileZeroData component:
Add an audienceSlug prop of type PropTypes.string.
Create a version of TileZeroDataContent wrapped by the withIntersectionObserver() HOC, e.g. TileZeroDataContentWithIntersectionObserver. Render the TileZeroDataContentWithIntersectionObserver component.
Pass the onInView callback prop to TileZeroDataContentWithIntersectionObserver. In the callback, call trackEvent( '${viewContext}_audiences-tile', 'view_tile_collecting_data', audienceSlug ).
Create a handleHideTile() callback:
Call trackEvent( '${viewContext}_audiences-tile', 'temporarily_hide', audienceSlug ), followed by onHideTile(). Chain the two calls using .finally().
Replace onHideTile with handleHideTile as the value for the onHideTile prop that is passed to TileZeroDataContentWithIntersectionObserver.
[ ] Extract the rendered JSX content from the AudienceSegmentationErrorWidget component to a new component e.g. ErrorWidgetContent.
Wrap the ErrorWidgetContent component in forwardRef() so a ref can be passed to it, and add the ref to its top-level rendered element.
[ ] In the AudienceSegmentationErrorWidget component:
Create a version of ErrorWidgetContent wrapped by the withIntersectionObserver() HOC, e.g. ErrorWidgetContentWithIntersectionObserver. Render this in place of the existing ErrorWidgetContent instance.
Pass the onInView callback prop to ErrorWidgetContentWithIntersectionObserver:
Determine the action for the GA event: insufficient_permissions_error for an insufficient permissions error, or data_loading_error for any other error.
Determine the action for the GA event: insufficient_permissions_error_request_access for an insufficient permissions error, or data_loading_error_retry for any other error.
Call trackEvent( '${viewContext}_audiences-all-tiles', action ) prior to the calls to setValue() and onRetry(). Chain the calls using trackEvent().finally().
Test Coverage
Add JS test coverage for the above changes where tests exist for the affected components.
QA Brief
As a prerequisite for testing the events for each scenario:
Have a mechanism for checking tracked Analytics events ready, e.g. Tag Assistant or the Google Analytics Debugger Chrome extension.
Set up Site Kit with the audienceSegmentation feature flag enabled, tracking enabled, and Analytics connected using a property which is out of the gathering data state.
Verify the data_loading_error event is tracked as per the AC for each of the error cases.
Click on Retry for each case and verify the data_loading_error_retry event is tracked as per the AC.
Follow the QAB for #8147 again, but change the status code to 403 and the response payload to the following to show the insufficient permissions audience tile error and the insufficient permissions full width error.
Verify the insufficient_permissions_error event is tracked as per the AC for each of the error cases.
Click on Request access for each case and verify the insufficient_permissions_error_request_access event is tracked as per the AC.
Tooltip events
Click/hover the info icon by the title of an audience tile and verify the view_tile_tooltip event is tracked as per the AC.
Using a property with an audience in the partial data state, click/hover the info icon in the "partial data" badge at the top of an audience tile and verify the view_tile_partial_data_tooltip event is tracked as per the AC.
Using a property with a custom dimension audience in the partial data state, click/hover the info icon in the "partial data" badge in the "Top content" metric area of an audience tile and verify the view_top_content_partial_data_tooltip event is tracked as per the AC.
"Collecting data" events
Using a property with an audience in the partial data state, and zero data for the audience, verify the view_tile_collecting_data event is tracked when the "Site Kit is collecting data for this group." tile variant is shown as per the AC.
Click on Temporarily hide for the audience and verify the temporarily_hide event is tracked as per the AC.
Feature Description
GA events should be added to keep track of interaction with Audience Tiles (barring the "Top content" metric area which will be addressed separately).
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
The following GA events should be tracked for the given actions. See the GA events sheet.
Implementation Brief
AudienceTileError
component to be a module with its own folder and anindex.js
file.AudienceTileError
component to a new component e.g.TileErrorContent
.TileErrorContent
component inforwardRef()
so aref
can be passed to it, and add theref
to its top-level rendered element.onRetry
prop of typePropTypes.func
toTileErrorContent
, and pass it through toReportErrorActions
.AudienceTileError
component:audienceSlug
prop of typePropTypes.string
.TileErrorContent
wrapped by thewithIntersectionObserver()
HOC, e.g.TileErrorContentWithIntersectionObserver
. Render this in place of the existingTileErrorContent
instance.onInView
callback prop toTileErrorContentWithIntersectionObserver
:insufficient_permissions_error
for an insufficient permissions error, ordata_loading_error
for any other error.trackEvent( '${viewContext}_audiences-tile', action, audienceSlug )
.onRetry
callback prop toTileErrorContent
:insufficient_permissions_error_request_access
for an insufficient permissions error, ordata_loading_error_retry
for any other error.trackEvent( '${viewContext}_audiences-tile', action, audienceSlug )
.onOpen
prop of typePropTypes.func
to both theInfoTooltip
andTooltip
components. Pass the prop through fromInfoTooltip
toTooltip
toMuiTooltip
.onTooltipOpen
prop of typePropTypes.func
to theBadgeWithTooltip
component. Pass the prop through as theonOpen
prop toInfoTooltip
.AudienceTile
component:audienceSlug
prop of typePropTypes.string
and pass it through to theAudienceTilePagesMetric
component.onOpen
callback prop toInfoTooltip
. In the callback, calltrackEvent( '${viewContext}_audiences-tile', 'view_tile_tooltip', audienceSlug )
.onTooltipOpen
callback prop toBadgeWithTooltip
. In the callback, calltrackEvent( '${viewContext}_audiences-tile', 'view_tile_partial_data_tooltip', audienceSlug )
.AudienceTilePagesMetric
component:audienceSlug
prop of typePropTypes.string
.onTooltipOpen
callback prop toBadgeWithTooltip
. In the callback, calltrackEvent( '${viewContext}_audiences-tile', 'view_top_content_partial_data_tooltip', audienceSlug )
.AudienceTiles
component:audienceSlug
prop to theAudienceTile
andAudienceTileError
components with the value of theaudienceSlug
constant.AudienceTileZeroData
component. MakeAudienceTileZeroData
a module with its ownindex.js
file and create another component,TileZeroDataContent
in the module folder.AudienceTile
component to the newTileZeroDataContent
component.TileZeroDataContent
component inforwardRef()
so aref
can be passed to it, and add theref
to its top-level rendered element.AudienceTileZeroData
component:audienceSlug
prop of typePropTypes.string
.TileZeroDataContent
wrapped by thewithIntersectionObserver()
HOC, e.g.TileZeroDataContentWithIntersectionObserver
. Render theTileZeroDataContentWithIntersectionObserver
component.onInView
callback prop toTileZeroDataContentWithIntersectionObserver
. In the callback, calltrackEvent( '${viewContext}_audiences-tile', 'view_tile_collecting_data', audienceSlug )
.handleHideTile()
callback:trackEvent( '${viewContext}_audiences-tile', 'temporarily_hide', audienceSlug )
, followed byonHideTile()
. Chain the two calls using.finally()
.onHideTile
withhandleHideTile
as the value for theonHideTile
prop that is passed toTileZeroDataContentWithIntersectionObserver
.AudienceSegmentationErrorWidget
component to be a module with its own folder and anindex.js
file.AudienceSegmentationErrorWidget
component to a new component e.g.ErrorWidgetContent
.ErrorWidgetContent
component inforwardRef()
so aref
can be passed to it, and add theref
to its top-level rendered element.AudienceSegmentationErrorWidget
component:ErrorWidgetContent
wrapped by thewithIntersectionObserver()
HOC, e.g.ErrorWidgetContentWithIntersectionObserver
. Render this in place of the existingErrorWidgetContent
instance.onInView
callback prop toErrorWidgetContentWithIntersectionObserver
:insufficient_permissions_error
for an insufficient permissions error, ordata_loading_error
for any other error.trackEvent( '${viewContext}_audiences-all-tiles', action )
.handleRetry()
callback:insufficient_permissions_error_request_access
for an insufficient permissions error, ordata_loading_error_retry
for any other error.trackEvent( '${viewContext}_audiences-all-tiles', action )
prior to the calls tosetValue()
andonRetry()
. Chain the calls usingtrackEvent().finally()
.Test Coverage
QA Brief
audienceSegmentation
feature flag enabled, tracking enabled, and Analytics connected using a property which is out of the gathering data state.Error events
data_loading_error
event is tracked as per the AC for each of the error cases.data_loading_error_retry
event is tracked as per the AC.403
and the response payload to the following to show the insufficient permissions audience tile error and the insufficient permissions full width error.insufficient_permissions_error
event is tracked as per the AC for each of the error cases.insufficient_permissions_error_request_access
event is tracked as per the AC.Tooltip events
view_tile_tooltip
event is tracked as per the AC.view_tile_partial_data_tooltip
event is tracked as per the AC.view_top_content_partial_data_tooltip
event is tracked as per the AC."Collecting data" events
view_tile_collecting_data
event is tracked when the "Site Kit is collecting data for this group." tile variant is shown as per the AC.temporarily_hide
event is tracked as per the AC.Changelog entry