T
TanStack4mo ago
ratty-blush

Google Tags and scripts

What is the proper way to add google tags and analytics to a site? The scripts in header doesn't seem to like scripts with content in it.
6 Replies
rotten-yellow
rotten-yellow4mo ago
what did you try?
ratty-blush
ratty-blushOP4mo ago
Well i didnt try to put it in the scripts because i read the keys that are acceptable and there are none for content. So i use a hydrated variable and insert into the layout using dangerously set inner html. Hydrated so that i dont get hydration errors, however this way its not in the html at runtime
rotten-yellow
rotten-yellow4mo ago
children would the content we have a component called ScriptOnce that should do what you need as well
ratty-blush
ratty-blushOP4mo ago
So children would be a string with the content? Is there documentation on scriptOnce i can't find it Also what about a no script tag?
rotten-yellow
rotten-yellow4mo ago
what about that?
ratty-blush
ratty-blushOP4mo ago
I guess i can just add a noscript tag nvm.

Did you find this page helpful?