You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Despite the above configuration, the scripts are not loading during SSR, and Google Analytics tracking is not working. When inspecting the browser's developer tools, I can see that the script tags are not being added.
💡 What I've Tried
Adding scripts in app.head.script using defineNuxtConfig
Creating a plugins/gtag.client.js file and setting up the plugin
Checking the presence of script tags in the browser's developer tools
🙏 Question
What configuration is necessary to load scripts during SSR using app.head.script in Nuxt 3? Also, what steps do I need to take to ensure Google Analytics tracking functions correctly?
I would greatly appreciate any guidance on this matter. Thank you in advance.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Scripts in
app.head.script
not loading during SSR in Nuxt BridgeDemo: https://stackblitz.com/edit/github-svkdwc-46v9d3?file=nuxt.config.ts
Is it that [email protected], which is used by Nuxt2/Bridge, does not support the syntax of Nuxt3?
Problem
I have added scripts to
app.head.script
usingdefineNuxtConfig
in Nuxt 3, but the scripts are not loading during server-side rendering (SSR).Configuration
I have set up the scripts in
defineNuxtConfig
as follows:Additionally, I have created a
plugins/gtag.client.js
file and set up the plugin as follows:🤔 Problem Details
Despite the above configuration, the scripts are not loading during SSR, and Google Analytics tracking is not working. When inspecting the browser's developer tools, I can see that the script tags are not being added.
💡 What I've Tried
app.head.script
usingdefineNuxtConfig
plugins/gtag.client.js
file and setting up the plugin🙏 Question
What configuration is necessary to load scripts during SSR using
app.head.script
in Nuxt 3? Also, what steps do I need to take to ensure Google Analytics tracking functions correctly?I would greatly appreciate any guidance on this matter. Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions