-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
document.title not updated in Router.onRouteChangeComplete #4044
Comments
I'm having the same issue. Thanks for posting. I think there's an issue with Router.onRouteChangeComplete for Next 5 --- it's not firing when params change for the route (while the page is the same). This does create problems for my analytics. I do not believe it was a problem before 5? |
I'm having the same issue. It' effect to google analytic detect title of document. |
You do have to explicitly pass in the title. Even outside of the context of Next, this is an issue with Browser History where the order of events firing is not going to pick up the new title. I use tag manager now, I actually bypass the History Change trigger in GTM and created my own inside a business logic HOC:
Works great.... |
Looks like this is the same as #6025 Closing in favor of that one. |
Expected Behavior
I expect that in the handler for the
Router.onRouteChangeComplete
event,document.title
would be the title of the new page that was navigated to.Current Behavior
document.title
is still the title of the previous pageonRouteChangeComplete
Steps to Reproduce (for bugs)
Example: https://create-next-example-app-qyxwpdeqzb.now.sh/
Please note that the pages here are wrapped with the following layout component:
Context
I have been trying to add tracking analytics in
onRouteChangeComplete
, but because the title is inaccurate, my analytics are incorrect.Your Environment
The text was updated successfully, but these errors were encountered: