From a3831e73f24adac058629823bcffe40c03446651 Mon Sep 17 00:00:00 2001 From: alinemorelli Date: Wed, 5 Jun 2019 22:37:57 -0300 Subject: [PATCH] Avoid add new script on datalayer push events --- package-lock.json | 2 +- package.json | 2 +- src/TagManager.js | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 35122c1e..2db8a948 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-gtm-module", - "version": "2.0.4", + "version": "2.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2ed0debe..fd8477a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-gtm-module", - "version": "2.0.5", + "version": "2.0.6", "description": "React Google Tag Manager Module", "main": "dist/index.js", "scripts": { diff --git a/src/TagManager.js b/src/TagManager.js index 57d7c21d..902cf03b 100644 --- a/src/TagManager.js +++ b/src/TagManager.js @@ -43,9 +43,7 @@ const TagManager = { document.body.insertBefore(gtm.noScript(), document.body.childNodes[0]) }, dataLayer: function ({dataLayer, dataLayerName = 'dataLayer'}) { - const snippets = Snippets.dataLayer(dataLayer, dataLayerName) - const dataScript = this.dataScript(snippets) - document.head.appendChild(dataScript) + window[dataLayerName].push(dataLayer) } }