zadigetvoltaire / nuxt-gtm

Nuxt 3 module for Google Tag Manager
https://www.npmjs.com/package/@zadigetvoltaire/nuxt-gtm
MIT License
59 stars 3 forks source link

Cannot use vueRouterAdditionalEventData option #27

Open dovca opened 4 months ago

dovca commented 4 months ago

It is currently impossible to use the vueRouterAdditionalEventData option, because it is stored in public runtime config by the plugin and removed during serialization for the client bundle (see https://nuxt.com/docs/guide/going-further/runtime-config#serialization)

Reproduction:

// nuxt.config.ts

gtm: {
  vueRouterAdditionalEventData: () => ({foo: 'bar'});
}

Result:

The additional data is not added to the trackView event payload