Skip to content

Commit

Permalink
fix: add script and no script as head and body first element
Browse files Browse the repository at this point in the history
  • Loading branch information
alinemorelli authored and Aline Morelli committed Feb 15, 2019
1 parent b574309 commit 8b53384
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/TagManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ var TagManager = {
preview: preview
});
if (dataLayer) document.head.appendChild(gtm.dataScript);
document.head.appendChild(gtm.script());
document.body.appendChild(gtm.noScript());
document.head.insertBefore(gtm.script(), document.head.childNodes[0]);
document.body.insertBefore(gtm.noScript(), document.body.childNodes[0]);
},
dataLayer: function dataLayer(_ref2) {
var _dataLayer = _ref2.dataLayer,
Expand Down
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.3",
"version": "2.0.4",
"description": "React Google Tag Manager Module",
"main": "dist/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/TagManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const TagManager = {
preview
})
if (dataLayer) document.head.appendChild(gtm.dataScript)
document.head.appendChild(gtm.script())
document.body.appendChild(gtm.noScript())
document.head.insertBefore(gtm.script(), document.head.childNodes[0])
document.body.insertBefore(gtm.noScript(), document.body.childNodes[0])
},
dataLayer: function ({dataLayer, dataLayerName = 'dataLayer'}) {
const snippets = Snippets.dataLayer(dataLayer, dataLayerName)
Expand Down

0 comments on commit 8b53384

Please sign in to comment.