gtm-module
gtm-module copied to clipboard
Duplicate GTM initializing in SPA mode
Hi. If you try to run the nuxt application in SPA mode and open the page, you will get a double GTM submission. You can also see two identical scripts in head. The same thing happens when generating applications in the SPA mode.
Thanks for report @Manfies. Trying to investigate more. Created a repro for vue-meta behaviour:
https://github.com/pi0/nuxt-meta-iife-bug
I see that this will block the usage of multiple containers...
Hi I actually experienced this problem with @nuxtjs/google-tag-manager (which is now deprecated). I had a default value for specifying my GTM-staging
id and an environment value specifying GTM-production
. But when I loaded my site with all environment variables intact, I have production and staging GTM running.
I was wondering what is the difference between this repo and @nuxtjs/google-tag-manager. And whether this repo (based on this issue) could have inherited the problem from @nuxtjs/google-tag-manager. Hope you can help.
@tintinthong This is a full rewrite using an injected snippet on the page. Also currently a guard is added to the snippet to prevent adding duplicate you can try it :)
Hi I'm also have the same issue - duplicated GTM https://take.ms/lwueD This happens while I'm revisiting pages. The configuration is the basic as in the docs:
buildModules: [
'@nuxtjs/gtm'
],
gtm: {
id: 'GTM-IDHRERE'
}
package.json
"dependencies": {
"@nuxtjs/gtm": "^2.3.0"
}
@dminchev I've having the same behaviour. Tags seem to be accumulating per page. However, if you search for the GTM code in devtools, the code snippet its not repeated.
Could this be a detection bug on the Google Tag Assistant extension itself?
I'm saying this because of the way Nuxt works (where each page you visit is not thrown away - if you disable internet you can still visit the pages you've watched before, etc..), and what I believe to be the expectation of Google Tag Assistant (each page is a single unit).
Also, the data metrics don't seem to be affected.
I think I've found it. In default.vue, when using the "keep-alive" attribute on <Nuxt> component, the pages remain on memory, thus triggering the multiple scripts. Removing "keep-alive" removed the extra detections on Google Tag Assistant.
Hi I'm also have the same issue - duplicated GTM https://take.ms/lwueD This happens while I'm revisiting pages. The configuration is the basic as in the docs:
buildModules: [ '@nuxtjs/gtm' ], gtm: { id: 'GTM-IDHRERE' }
package.json
"dependencies": { "@nuxtjs/gtm": "^2.3.0" }
Shouldn't we use it as modules and not buildModules? ReadMe suggests so too