github nuxt-community/gtm-module v2.0.0

latest releases: v2.4.0, v2.3.2, v2.3.1...
4 years ago

This is a major rewrite of @nuxtjs/google-tag-manager after 3 years of contributions and feedback from users.

🍴Package Rename

For more simplicity package renamed from @nuxtjs/google-tag-manager to @nuxtjs/gtm

👍 Native Behaviour

Previously, the module was using custom code to inject gtm.js via a nuxt plugin. It was causing several problems as everything was deferred until nuxt bundle loads and starts executing client-side plugins. Starting with v2, we directly render official snippets with few tweaks into HTML pages (both SSR and SPA)

🔒 Respect User Privacy

By default respectDoNotTrack option is enabled which also guards snippet execution. You can also optionally disable autoInit to first ask users and then manually call $gtm.init() (all previous events will be buffered so there is no data loss). Also using a polyfill for maximum browser support for doNotTrack

🦄 Breaking Changes

  • query (and env) renamed to variables
  • respectDoNotTrack enabled by default
  • noscript (<iframe> fallback) disabled by default ~> Will be enabled by default starting 2.2.0
  • google-tag-manager option in nuxt.config should be changed to gtm
  • pushEvent and pushData merged into $gtm.push with less strict object checks

💖 Huge thanks to v1 contributors

@williamchong007 @igtm @syffs @phlogisticfugu @Manfies @McSneaky @matteo-rigon @derz @chrisladams @Zsavajji @gnuletik

Don't miss a new gtm-module release

NewReleases is sending notifications on new releases.