@mparticle/web-google-tag-manager-kit 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -791,7 +791,8 @@ var initialization = {
791
791
  isInitialized = initializeContainer(
792
792
  containerId,
793
793
  common.customDataLayerName,
794
- previewUrl
794
+ previewUrl,
795
+ common.settings.preventAutoBlock
795
796
  );
796
797
  }
797
798
 
@@ -816,11 +817,15 @@ var initialization = {
816
817
  }
817
818
 
818
819
  common.maybeSendConsentUpdateToGoogle(updatedConsentState);
819
-
820
820
  },
821
821
  };
822
822
 
823
- function initializeContainer(containerId, dataLayerName, previewUrl) {
823
+ function initializeContainer(
824
+ containerId,
825
+ dataLayerName,
826
+ previewUrl,
827
+ preventAutoBlock
828
+ ) {
824
829
  var url = 'https://www.googletagmanager.com/gtm.js';
825
830
 
826
831
  // If Settings contains previewUrl, we should tack that onto the gtm snippet
@@ -835,21 +840,27 @@ function initializeContainer(containerId, dataLayerName, previewUrl) {
835
840
 
836
841
  url += '&l=' + dataLayerName;
837
842
 
838
- loadSnippet(url, dataLayerName);
843
+ loadSnippet(url, dataLayerName, preventAutoBlock);
839
844
 
840
845
  return true;
841
846
  }
842
847
 
843
- function loadSnippet(url, dataLayerName) {
848
+ function loadSnippet(url, dataLayerName, preventAutoBlock) {
844
849
  window[dataLayerName].push({
845
850
  'gtm.start': new Date().getTime(),
846
- event: 'gtm.js'
851
+ event: 'gtm.js',
847
852
  });
848
853
 
849
854
  var gTagScript = document.createElement('script');
850
855
  gTagScript.type = 'text/javascript';
851
856
  gTagScript.async = true;
852
857
  gTagScript.src = url;
858
+ if (preventAutoBlock === 'True') {
859
+ gTagScript.setAttributeNode(
860
+ window.document.createAttribute('data-ot-ignore')
861
+ );
862
+ }
863
+
853
864
  (
854
865
  document.getElementsByTagName('head')[0] ||
855
866
  document.getElementsByTagName('body')[0]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-google-tag-manager-kit",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "repository": "https://github.com/mparticle-integrations/mparticle-javascript-integration-google-tag-manager",
5
5
  "main": "dist/GoogleTagManager-Kit.common.js",
6
6
  "browser": "dist/GoogleTagManager-Kit.common.js",