-
Notifications
You must be signed in to change notification settings - Fork 49
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(script-element): Script is invalid in Head of NextJS #383
Comments
Hello @GervinFung ! Thanks for bringing this up. Have you experienced any issues with the current implementation? Would it be possible for you to verify if it is working properly as it is?
Funny that for dynamic pages it says to add it after the opening
Using the Scrip tag provides more control and, eventually, even using web-workers to load the script, which is an active feature request. It seems that it is recommended in that way so it increases the likelihood that the tracking beacon will be sent before the user leaves the page, in cases where a user leaves the page before it is fully loaded. We could have the user decide if they want to place it in a regular script tag to be used at the top of |
Thanks for replying! I appreciate it To answer to questions u asked above, yes I've experienced issue and had verify it can't verify that I have visited my website I've change it to native I think we can build 1 more component to let user decide, I think I can do that if u don't mind |
That would be awesome! Thanks @GervinFung , let me know if you need anything I'll be glad to help. |
@GervinFung do you think this could also be achieved using the https://nextjs.org/docs/api-reference/next/script#beforeinteractive 🤔 |
Sorry for the late reply, it won't work, even if I try to implement it with native element directly. It worked when I do a simple version with native |
FYI: Head.js will be deprecated: https://beta.nextjs.org/docs/api-reference/file-conventions/head#migration-guide . |
In that case, I think this means that this issue & PR is obsolete already, since @MauricioRobayo can write it with native head tag. Unless my PR replace NextJS Head with native head, that I am ok with it. Is this ok for you @MauricioRobayo |
Hey, nice package u wrote, thanks for the effort. I wanna bring up a topic, not sure if anyone experienced it before, so here it goes, Script element of
nextjs/script
doesn't work when it's descendant of Head ofnext/head
, I ended up using nativescript
element instead. The reason I brought up this is because, it's recommended to put the google analytics script in head tag, see here. I think the fix is quite easyThe text was updated successfully, but these errors were encountered: