WS-2704: Add reverb params context provider#14120
Conversation
There was a problem hiding this comment.
presume this will be deleted on clean-up?
| const accountContext = use(AccountContext); | ||
|
|
||
| useEffect(() => { | ||
| setBBCPage({ atiData, requestContext, serviceContext, accountContext }); |
There was a problem hiding this comment.
Do we have tests proving that bbcpage and bbcuser are populated correctly and updated when the page or account data changes? Might be worth adding if not
| setBBCPage({ atiData, requestContext, serviceContext, accountContext }); | ||
| }, [accountContext, atiData, requestContext, serviceContext]); | ||
|
|
||
| const value = useMemo( |
There was a problem hiding this comment.
I think this only exposes raw atiData. Would amp and canonical users still need to rebuild the Reverb parameters?
There was a problem hiding this comment.
Extracting Reverb parameters here means AMP and Canonical use-cases
can access the values provided by ReverbParamsContext. As such, we
won't need to rebuild them.
| </QueryProvider> | ||
| )} | ||
| </EventTrackingContextProvider> | ||
| <ReverbParamsContextProvider atiData={atiAnalytics}> |
There was a problem hiding this comment.
Could this provider receive the final Reverb params instead of raw page metadata? Article pages add experiment details and adjusted page titles later so those values might get lost
…rgh into TASK-initialize-reverb-globally
| // Dangerously allow production builds to successfully complete even if | ||
| // your project has TypeScript errors. | ||
| // !! WARN !! | ||
| ignoreBuildErrors: true, |
There was a problem hiding this comment.
Added to facilitate Preview env deployments.
To be removed prior to merging the PR.
louisearchibald
left a comment
There was a problem hiding this comment.
Thanks for the walkthrough on this today, looks good 🙌
Resolves JIRA: WS-2704
Arises from: #14071
Summary
In #14071, we identified an issue whereby the scroll depth tracker hook
caused page view beacons to be triggered with the incorrect values.
This is due to Reverb being initialised when the scroll depth tracker hook is created, instead
of the page view tracker as has been the case.
This PR introduces a high level ReverbParamsContext which infers the Reverb
values required to track events for given page. The inferred values are then persisted in
window.bbcpageby invoking setBBCPage. These valuesare then availed to the page view events as well as component event tracking hooks
window.bbcpageis relied upon by Reverb'sviewEventanduserActionEventfunctions.Code changes
and set the appropriate
pageTitleforPGL,STYANDCSPassets.pageTitleforMAPassets.pageTitleforMost Readpages.window.bbcpageobject.Testing
Useful Links