mib200 / vue-gtm

Simple implementation of Google Tag Manager in Vue.js 2.0
Apache License 2.0
243 stars 85 forks source link

Bug: Using enable function to load gtm.js script won't load with queryParams #102

Closed NorthBei closed 3 years ago

NorthBei commented 3 years ago

Info

Tool Version
Plugin v3.1.0-vue2
Vue v2.6.11
Node v10.1.5.3
OS Mac

Input

I add those js script in main.js (the vue's entry) and in the beginning, the enable attribute be set as false

import VueGtm from 'vue-gtm'
import Vue from 'vue'

Vue.use(VueGtm, {
  id: 'GTM-ID',
  queryParams: {
    gtm_auth: 'GTM_AUTH',
    gtm_preview: 'GTM_PREVIEW',
    gtm_cookies_win: 'GTM_COOKIES_WIN'
  },
  enabled: false
})

and I using script like below to dynamic load gtm script

Vue.gtm.enable(true)

Output or Error

At result, the plugin won't load gtm.js with the queryParams like below, just only load with GTM ID

image

Expected Output

I expect that I can load gtm script with queryParams by the enable function (the enable attribute be set as true in the beginning will work like that)

image

Additional Context

I have been seen the code about this issue in 3.1.0-vue2 version but because the env's problem, I can't run it successfully... so I just add this issue for you, I am sorry about that

Shinigami92 commented 3 years ago

Hopefully I have time to look into this the next few days Currently not at home but have my Mac with me

Shinigami92 commented 3 years ago

@NorthBei Please let me know if everything is working as expected with 3.1.1-vue2

Thank you for using our plugin

NorthBei commented 3 years ago

@Shinigami92 Thanks for your quickly bug fixed ! I have been updated the vue-gtm module, and run on local for test, it works well ~~

I am very appreciate for your help and development of this plugin !