@nuxtjs/gtm
Advanced tools
Comparing version 2.3.1 to 2.3.2
@@ -5,2 +5,9 @@ # Changelog | ||
### [2.3.2](https://github.com/nuxt-community/gtm-module/compare/v2.3.1...v2.3.2) (2020-07-23) | ||
### Bug Fixes | ||
* **plugin:** load SSR events before container loaded ([#51](https://github.com/nuxt-community/gtm-module/issues/51)) ([498f9bd](https://github.com/nuxt-community/gtm-module/commit/498f9bd317469e143b81e34c36b48abc8d1ca5be)) | ||
### [2.3.1](https://github.com/nuxt-community/gtm-module/compare/v2.3.0...v2.3.1) (2020-07-23) | ||
@@ -7,0 +14,0 @@ |
@@ -15,3 +15,3 @@ const _layer = '<%= options.layer %>' | ||
if (!window[_layer]) { | ||
window[_layer] = [{ 'gtm.start': new Date().getTime(), event: 'gtm.js' }] | ||
window[_layer] = [] | ||
} | ||
@@ -33,2 +33,4 @@ window[_layer].push(obj) | ||
const gtmScript = ctx.app.head.script.find(s => s.hid == '<%= options.scriptId %>') | ||
gtmScript.innerHTML = `window['${_layer}']=${JSON.stringify(events)};${gtmScript.innerHTML}` | ||
if (inits.length) { | ||
@@ -44,5 +46,2 @@ gtmScript.innerHTML += `;${JSON.stringify(inits)}.forEach(function(i){window._gtm_inject(i)})` | ||
<% } %> | ||
if (events.length) { | ||
gtmScript.innerHTML += `;${JSON.stringify(events)}.forEach(function(e){window['${_layer}'].push(e)})` | ||
} | ||
}) | ||
@@ -49,0 +48,0 @@ |
{ | ||
"name": "@nuxtjs/gtm", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"description": "Google Tag Manager Module for Nuxt.js", | ||
@@ -5,0 +5,0 @@ "repository": "nuxt-community/gtm-module", |
24724
236