nuxt-community/gtm-module

Manual initialization - instructions not clear

PaulBouisset opened this issue · 1 comments

Hi, I use only dynamic slugs on my ssr project so the default pageViewEvent is not working for me.

I tried to use the Manual Initialization described in the readme but I don't understand how to set the page view event correctly.

After initializing the module via the plugin file do I keep some setting in nuxt.module like debug:true ? And how do I send page view event from there ? Is it from the plugin file using something like this.$router.afterEach ?

export default { 
     modules: [   '@nuxtjs/gtm'  ], 
     plugins: [   '~/plugins/gtm'  ]
 }
export default function({ $gtm, route }) {
  $gtm.init('GTM-XXXXXXX')
}

My bad the exemple provided in the repo was actually showing how to setup pageTracking with manual initialization. But I think the readme was confusing because the gtm settings are not showed so you are not sure if you have to remove them