Skip to content

Commit 918924f

Browse files
chore(build): Generate latest bundle [skip ci]
1 parent 687fcd2 commit 918924f

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

dist/GoogleTagManager-Kit.common.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,8 @@ var initialization = {
791791
isInitialized = initializeContainer(
792792
containerId,
793793
common.customDataLayerName,
794-
previewUrl
794+
previewUrl,
795+
common.settings.preventAutoBlock
795796
);
796797
}
797798

@@ -816,11 +817,15 @@ var initialization = {
816817
}
817818

818819
common.maybeSendConsentUpdateToGoogle(updatedConsentState);
819-
820820
},
821821
};
822822

823-
function initializeContainer(containerId, dataLayerName, previewUrl) {
823+
function initializeContainer(
824+
containerId,
825+
dataLayerName,
826+
previewUrl,
827+
preventAutoBlock
828+
) {
824829
var url = 'https://www.googletagmanager.com/gtm.js';
825830

826831
// If Settings contains previewUrl, we should tack that onto the gtm snippet
@@ -835,21 +840,27 @@ function initializeContainer(containerId, dataLayerName, previewUrl) {
835840

836841
url += '&l=' + dataLayerName;
837842

838-
loadSnippet(url, dataLayerName);
843+
loadSnippet(url, dataLayerName, preventAutoBlock);
839844

840845
return true;
841846
}
842847

843-
function loadSnippet(url, dataLayerName) {
848+
function loadSnippet(url, dataLayerName, preventAutoBlock) {
844849
window[dataLayerName].push({
845850
'gtm.start': new Date().getTime(),
846-
event: 'gtm.js'
851+
event: 'gtm.js',
847852
});
848853

849854
var gTagScript = document.createElement('script');
850855
gTagScript.type = 'text/javascript';
851856
gTagScript.async = true;
852857
gTagScript.src = url;
858+
if (preventAutoBlock === 'True') {
859+
gTagScript.setAttributeNode(
860+
window.document.createAttribute('data-ot-ignore')
861+
);
862+
}
863+
853864
(
854865
document.getElementsByTagName('head')[0] ||
855866
document.getElementsByTagName('body')[0]

dist/GoogleTagManager-Kit.iife.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,8 @@ var GoogleTagManagerKit = (function (exports) {
790790
isInitialized = initializeContainer(
791791
containerId,
792792
common.customDataLayerName,
793-
previewUrl
793+
previewUrl,
794+
common.settings.preventAutoBlock
794795
);
795796
}
796797

@@ -815,11 +816,15 @@ var GoogleTagManagerKit = (function (exports) {
815816
}
816817

817818
common.maybeSendConsentUpdateToGoogle(updatedConsentState);
818-
819819
},
820820
};
821821

822-
function initializeContainer(containerId, dataLayerName, previewUrl) {
822+
function initializeContainer(
823+
containerId,
824+
dataLayerName,
825+
previewUrl,
826+
preventAutoBlock
827+
) {
823828
var url = 'https://www.googletagmanager.com/gtm.js';
824829

825830
// If Settings contains previewUrl, we should tack that onto the gtm snippet
@@ -834,21 +839,27 @@ var GoogleTagManagerKit = (function (exports) {
834839

835840
url += '&l=' + dataLayerName;
836841

837-
loadSnippet(url, dataLayerName);
842+
loadSnippet(url, dataLayerName, preventAutoBlock);
838843

839844
return true;
840845
}
841846

842-
function loadSnippet(url, dataLayerName) {
847+
function loadSnippet(url, dataLayerName, preventAutoBlock) {
843848
window[dataLayerName].push({
844849
'gtm.start': new Date().getTime(),
845-
event: 'gtm.js'
850+
event: 'gtm.js',
846851
});
847852

848853
var gTagScript = document.createElement('script');
849854
gTagScript.type = 'text/javascript';
850855
gTagScript.async = true;
851856
gTagScript.src = url;
857+
if (preventAutoBlock === 'True') {
858+
gTagScript.setAttributeNode(
859+
window.document.createAttribute('data-ot-ignore')
860+
);
861+
}
862+
852863
(
853864
document.getElementsByTagName('head')[0] ||
854865
document.getElementsByTagName('body')[0]

0 commit comments

Comments
 (0)