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
I need to use different GTM IDs acording to my routes.
Is the only possible configuration via defineNuxtConfig or could i configure it using a composable, for example?
The text was updated successfully, but these errors were encountered:
renansantos
changed the title
Ho to change GTM ID dynamically?
How to change GTM ID dynamically?
Dec 26, 2023
You should can just set the id in runtime config instead of the module config. So in runtimeConfig.public.gtm.id and then set the environment variable NUXT_PUBLIC_{whatever} in your environment to overwrite the value
Use the package @gtm-support/vue-gtm directly and create your own plugin so you can initialise the gtm instance in the plugin where you have control on the runtime config
Thank you, @devonik !
I don't know yet wich will be better for my project. But i think both solutions will work.
I am still to understand how lots of thinks work in Nuxt.
Would you mind sharing your plugin so i can learn and create my own solution for my needs?
I need to use different GTM IDs acording to my routes.
Is the only possible configuration via defineNuxtConfig or could i configure it using a composable, for example?
The text was updated successfully, but these errors were encountered: