mib200 / vue-gtm

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

set GTM ID dynamically #60

Closed liamngth closed 4 years ago

liamngth commented 5 years ago

I am facing a situation where I need to set GTM ID at runtime. I have developed an app which is used for multiple brands (8). Currently, two of them need to apply GTM with different ID. At back-end we will load the ID and set it into vue-gtm is is possible to achieve that? Please let me know

JeremieKaszub commented 4 years ago

I'll be more than glad to have a soltion for this very promblem too. ;Thanks in advance for your time.

aniWeyn commented 4 years ago

hi! I also would be glad if changing ID dynamically would be implemented

igal1c0de4n commented 4 years ago

@liamngth I'm achieving that by postponing the Vue.use(VueGtm, until I have the GTM ID. So, in my case it runs when my app gets a response to an http GET for the dynamic data

mib200 commented 4 years ago

I use it by making the AJAX call first and then initializing the plugin after the response of the AJAX query.