@blotoutio/providers-google-analytics-4-sdk 1.24.2 → 1.25.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.
package/index.cjs.js CHANGED
@@ -451,11 +451,9 @@ const getGoogleConsent = (consent) => {
451
451
  // eslint-disable-next-line @nx/enforce-module-boundaries
452
452
  const initGA4 = (ID, advancedConsentMode, consentSkip, consentData, executionContext) => {
453
453
  var _a;
454
- window.dataLayer = window.dataLayer || [];
455
- window.gtag = function gtag() {
456
- // eslint-disable-next-line prefer-rest-params
457
- window.dataLayer.push(arguments);
458
- };
454
+ if (!window.gtag) {
455
+ return;
456
+ }
459
457
  if (consentSkip != '1') {
460
458
  let isConsentInitialised = false;
461
459
  for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
@@ -498,6 +496,11 @@ const init = ({ manifest, userId, executionContext, consentData, }) => {
498
496
  manifest.variables['flowType'] === 'server') {
499
497
  return;
500
498
  }
499
+ window.dataLayer = window.dataLayer || [];
500
+ window.gtag = function gtag() {
501
+ // eslint-disable-next-line prefer-rest-params
502
+ window.dataLayer.push(arguments);
503
+ };
501
504
  if (!window.google_tag_manager ||
502
505
  !window.google_tag_manager[manifest.variables['measurementId']]) {
503
506
  initGA4(manifest.variables['measurementId'], manifest.variables['advancedConsentMode'], manifest.variables['consentSkip'], consentData, executionContext);
@@ -773,7 +776,7 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
773
776
  }
774
777
  return {
775
778
  loaded: isLoaded,
776
- sdkVersion: "1.24.2" ,
779
+ sdkVersion: "1.25.0" ,
777
780
  };
778
781
  };
779
782
 
package/index.js CHANGED
@@ -452,11 +452,9 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
452
452
  // eslint-disable-next-line @nx/enforce-module-boundaries
453
453
  const initGA4 = (ID, advancedConsentMode, consentSkip, consentData, executionContext) => {
454
454
  var _a;
455
- window.dataLayer = window.dataLayer || [];
456
- window.gtag = function gtag() {
457
- // eslint-disable-next-line prefer-rest-params
458
- window.dataLayer.push(arguments);
459
- };
455
+ if (!window.gtag) {
456
+ return;
457
+ }
460
458
  if (consentSkip != '1') {
461
459
  let isConsentInitialised = false;
462
460
  for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
@@ -499,6 +497,11 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
499
497
  manifest.variables['flowType'] === 'server') {
500
498
  return;
501
499
  }
500
+ window.dataLayer = window.dataLayer || [];
501
+ window.gtag = function gtag() {
502
+ // eslint-disable-next-line prefer-rest-params
503
+ window.dataLayer.push(arguments);
504
+ };
502
505
  if (!window.google_tag_manager ||
503
506
  !window.google_tag_manager[manifest.variables['measurementId']]) {
504
507
  initGA4(manifest.variables['measurementId'], manifest.variables['advancedConsentMode'], manifest.variables['consentSkip'], consentData, executionContext);
@@ -774,7 +777,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
774
777
  }
775
778
  return {
776
779
  loaded: isLoaded,
777
- sdkVersion: "1.24.2" ,
780
+ sdkVersion: "1.25.0" ,
778
781
  };
779
782
  };
780
783
 
package/index.mjs CHANGED
@@ -449,11 +449,9 @@ const getGoogleConsent = (consent) => {
449
449
  // eslint-disable-next-line @nx/enforce-module-boundaries
450
450
  const initGA4 = (ID, advancedConsentMode, consentSkip, consentData, executionContext) => {
451
451
  var _a;
452
- window.dataLayer = window.dataLayer || [];
453
- window.gtag = function gtag() {
454
- // eslint-disable-next-line prefer-rest-params
455
- window.dataLayer.push(arguments);
456
- };
452
+ if (!window.gtag) {
453
+ return;
454
+ }
457
455
  if (consentSkip != '1') {
458
456
  let isConsentInitialised = false;
459
457
  for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
@@ -496,6 +494,11 @@ const init = ({ manifest, userId, executionContext, consentData, }) => {
496
494
  manifest.variables['flowType'] === 'server') {
497
495
  return;
498
496
  }
497
+ window.dataLayer = window.dataLayer || [];
498
+ window.gtag = function gtag() {
499
+ // eslint-disable-next-line prefer-rest-params
500
+ window.dataLayer.push(arguments);
501
+ };
499
502
  if (!window.google_tag_manager ||
500
503
  !window.google_tag_manager[manifest.variables['measurementId']]) {
501
504
  initGA4(manifest.variables['measurementId'], manifest.variables['advancedConsentMode'], manifest.variables['consentSkip'], consentData, executionContext);
@@ -771,7 +774,7 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
771
774
  }
772
775
  return {
773
776
  loaded: isLoaded,
774
- sdkVersion: "1.24.2" ,
777
+ sdkVersion: "1.25.0" ,
775
778
  };
776
779
  };
777
780
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-google-analytics-4-sdk",
3
- "version": "1.24.2",
3
+ "version": "1.25.0",
4
4
  "description": "Google Analytics 4 Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",