-
Notifications
You must be signed in to change notification settings - Fork 230
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
Test Chartbeat on Lite pages #11579
base: latest
Are you sure you want to change the base?
Test Chartbeat on Lite pages #11579
Conversation
@@ -47,9 +51,13 @@ const ChartbeatAnalytics = ({ | |||
|
|||
const chartbeatConfig = getConfig(configDependencies); | |||
|
|||
if (isLiteAndEnabled) { | |||
return <CanonicalChartbeatBeacon chartbeatConfig={chartbeatConfig} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's where the canonical Chartbeat component is added - I was not expecting it to be used here, so wonder if we need to change the logic within UserContext/Chartbeat instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tying Chartbeat to the UserContext provider feels a bit strange to me, unless there were historical reasons for doing so?
UserContext handles things like cookies, which makes sense but not sure having Chartbeat in there does? Maybe just saved importing it into individual page components at the time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's why I was confused, and wondered if this is an opportunity to try and fix it?
Not sure of the historical reasons, but permission for sending tracking beacons also part of the user context / cookies, and perhaps that's why it was there. But I definitely agree, it doesn't belong within the UserContext, it should be within the Chartbeat Analytics component instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#3622
NB: the 'UserContext' probably isnt the right place to put this, but as a POC its fine :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good ol' old tech debt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where's the "old man yells at tech debt" emoji when you need it?!?!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this, I guess this was done with client side routing in mind? As the chartbeat config is stored in state, it's probably there to prevent re-renders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't we removed client-side / SPA routing functionality? If there's a nicer way to refactor this (i.e. could we move the useState
code to the ChartbeatAnalytics component instead of having it in the UserContext?), then we should do it, but if not, it's OK to leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth testing actually, as we did encounter some duplication of ATI events when Helmet mounted on the server and re-mounted on clientside hydration.
This would only affect Canonical mind.
Overall changes
Code changes
true
Testing
chartbeat.js
is downloadedHelpful Links
Add Links to useful resources related to this PR if applicable.
Coding Standards
Repository use guidelines