Skip to content

Commit

Permalink
Avoid add new script on datalayer push events (alinemorelli#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
alinemorelli authored Jun 6, 2019
1 parent 936e0f5 commit 753c01a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 1 addition & 3 deletions src/TagManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 753c01a

Please sign in to comment.