-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix(gtag): send the newly rendered page's title instead of the old one's #7424
Conversation
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.
Please also add a brief comment explaining this, and linking to the issue.
(And fixing the syntax error, of course)
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
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.
This makes sense to me.
@slorber seems to dislike setTimeout
for good reason, so I'll wait for his decision on this.
@slorber any comment on that? |
This comment was marked as off-topic.
This comment was marked as off-topic.
Related to #6732 I don't think we should ask all analytics plugin authors to use I'd rather make it a guarantee that page metadatas/title are already updated when Some local tests: The easy solution would be to move to |
Waiting for an answer here: https://twitter.com/sebastienlorber/status/1530180431475265537 |
Going to merge this, as at least it fixes the GTAG plugin for the next release But clearly we are not done yet with those lifecycles, and this setTimeout should not be necessary |
This is the same solution as facebook/docusaurus#7424. Signed-off-by: tison <[email protected]>
Pre-flight checklist
Motivation
Fix #7420
Test Plan
I manually tested it with the reproduction environment on stackblitz.
I also have on my private project repo this implementation fix of the gtag plugin that I deployed and debuged using GA debug tools.
It can be clearly seen in the logs and in GA debug panel that the correct title is used now.
Test links
https://stackblitz.com/edit/github-fab3de?file=plugin%2Fclient-module.js
Deploy preview: https://deploy-preview-7424--docusaurus-2.netlify.app/