@blotoutio/providers-google-ads-clicks-sdk 1.21.2 → 1.22.1

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.
Files changed (4) hide show
  1. package/index.cjs.js +30 -24
  2. package/index.js +30 -24
  3. package/index.mjs +30 -24
  4. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -409,31 +409,33 @@ const getGoogleConsent = (consentData) => {
409
409
  };
410
410
 
411
411
  // eslint-disable-next-line @nx/enforce-module-boundaries
412
- const initGAds = (ID, consentData, executionContext) => {
412
+ const initGAds = (ID, consentData, executionContext, consentSkip) => {
413
413
  var _a;
414
414
  window.dataLayer = window.dataLayer || [];
415
415
  window.gtag = function gtag() {
416
416
  // eslint-disable-next-line prefer-rest-params
417
417
  window.dataLayer.push(arguments);
418
418
  };
419
- let isConsentInitialised = false;
420
- for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
421
- if ((_a = executionContext.get(otherProvider)) === null || _a === void 0 ? void 0 : _a.get('gtag')) {
422
- isConsentInitialised = true;
423
- break;
419
+ if (consentSkip != '1') {
420
+ let isConsentInitialised = false;
421
+ for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
422
+ if ((_a = executionContext.get(otherProvider)) === null || _a === void 0 ? void 0 : _a.get('gtag')) {
423
+ isConsentInitialised = true;
424
+ break;
425
+ }
426
+ }
427
+ const data = getGoogleConsent(consentData);
428
+ if (isConsentInitialised) {
429
+ window.gtag('consent', 'update', data);
430
+ }
431
+ else {
432
+ window.gtag('consent', 'default', {
433
+ ...data,
434
+ functional_storage: 'granted',
435
+ personalization_storage: 'granted',
436
+ security_storage: 'granted',
437
+ });
424
438
  }
425
- }
426
- const data = getGoogleConsent(consentData);
427
- if (isConsentInitialised) {
428
- window.gtag('consent', 'update', data);
429
- }
430
- else {
431
- window.gtag('consent', 'default', {
432
- ...data,
433
- functional_storage: 'granted',
434
- personalization_storage: 'granted',
435
- security_storage: 'granted',
436
- });
437
439
  }
438
440
  upsert(executionContext, packageName, (providerMap) => providerMap.set('gtag', true), () => new Map());
439
441
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -448,7 +450,7 @@ const initGAds = (ID, consentData, executionContext) => {
448
450
  }
449
451
  };
450
452
  const init = ({ manifest, consentData, executionContext }) => {
451
- var _a, _b;
453
+ var _a, _b, _c;
452
454
  if (!window ||
453
455
  !((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['tagId']) ||
454
456
  manifest.variables['loadSDK'] !== '1') {
@@ -462,7 +464,7 @@ const init = ({ manifest, consentData, executionContext }) => {
462
464
  }
463
465
  if (!window.google_tag_manager ||
464
466
  !window.google_tag_manager[manifest.variables['tagId']]) {
465
- initGAds(manifest.variables['tagId'], consentData, executionContext);
467
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_c = manifest.variables) === null || _c === void 0 ? void 0 : _c['consentSkip']);
466
468
  }
467
469
  if (window.gtag) {
468
470
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -605,14 +607,14 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
605
607
  !getCookieValue('_gcl_au')) {
606
608
  return {
607
609
  isFired: false,
608
- sdkVersion: "1.21.2" ,
610
+ sdkVersion: "1.22.1" ,
609
611
  };
610
612
  }
611
613
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
612
614
  if (!conversionLabel) {
613
615
  return {
614
616
  isFired: false,
615
- sdkVersion: "1.21.2" ,
617
+ sdkVersion: "1.22.1" ,
616
618
  };
617
619
  }
618
620
  if (manifestVariables['enhancedConversionsSetting'] === 'gtag' &&
@@ -629,14 +631,18 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
629
631
  });
630
632
  return {
631
633
  isFired: true,
632
- sdkVersion: "1.21.2" ,
634
+ sdkVersion: "1.22.1" ,
633
635
  };
634
636
  };
635
637
 
636
- const consent = ({ consentData }) => {
638
+ const consent = ({ consentData, variables }) => {
637
639
  if (!(window === null || window === void 0 ? void 0 : window.gtag)) {
638
640
  return;
639
641
  }
642
+ const shouldSkipConsent = variables.some((v) => { var _a; return ((_a = v.variableSet) === null || _a === void 0 ? void 0 : _a['consentSkip']) == '1'; });
643
+ if (shouldSkipConsent) {
644
+ return;
645
+ }
640
646
  const data = getGoogleConsent(consentData);
641
647
  window.gtag('consent', 'update', {
642
648
  ...data,
package/index.js CHANGED
@@ -410,31 +410,33 @@ var ProvidersGoogleAdsClicksSdk = (function () {
410
410
  };
411
411
 
412
412
  // eslint-disable-next-line @nx/enforce-module-boundaries
413
- const initGAds = (ID, consentData, executionContext) => {
413
+ const initGAds = (ID, consentData, executionContext, consentSkip) => {
414
414
  var _a;
415
415
  window.dataLayer = window.dataLayer || [];
416
416
  window.gtag = function gtag() {
417
417
  // eslint-disable-next-line prefer-rest-params
418
418
  window.dataLayer.push(arguments);
419
419
  };
420
- let isConsentInitialised = false;
421
- for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
422
- if ((_a = executionContext.get(otherProvider)) === null || _a === void 0 ? void 0 : _a.get('gtag')) {
423
- isConsentInitialised = true;
424
- break;
420
+ if (consentSkip != '1') {
421
+ let isConsentInitialised = false;
422
+ for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
423
+ if ((_a = executionContext.get(otherProvider)) === null || _a === void 0 ? void 0 : _a.get('gtag')) {
424
+ isConsentInitialised = true;
425
+ break;
426
+ }
427
+ }
428
+ const data = getGoogleConsent(consentData);
429
+ if (isConsentInitialised) {
430
+ window.gtag('consent', 'update', data);
431
+ }
432
+ else {
433
+ window.gtag('consent', 'default', {
434
+ ...data,
435
+ functional_storage: 'granted',
436
+ personalization_storage: 'granted',
437
+ security_storage: 'granted',
438
+ });
425
439
  }
426
- }
427
- const data = getGoogleConsent(consentData);
428
- if (isConsentInitialised) {
429
- window.gtag('consent', 'update', data);
430
- }
431
- else {
432
- window.gtag('consent', 'default', {
433
- ...data,
434
- functional_storage: 'granted',
435
- personalization_storage: 'granted',
436
- security_storage: 'granted',
437
- });
438
440
  }
439
441
  upsert(executionContext, packageName, (providerMap) => providerMap.set('gtag', true), () => new Map());
440
442
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -449,7 +451,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
449
451
  }
450
452
  };
451
453
  const init = ({ manifest, consentData, executionContext }) => {
452
- var _a, _b;
454
+ var _a, _b, _c;
453
455
  if (!window ||
454
456
  !((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['tagId']) ||
455
457
  manifest.variables['loadSDK'] !== '1') {
@@ -463,7 +465,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
463
465
  }
464
466
  if (!window.google_tag_manager ||
465
467
  !window.google_tag_manager[manifest.variables['tagId']]) {
466
- initGAds(manifest.variables['tagId'], consentData, executionContext);
468
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_c = manifest.variables) === null || _c === void 0 ? void 0 : _c['consentSkip']);
467
469
  }
468
470
  if (window.gtag) {
469
471
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -606,14 +608,14 @@ var ProvidersGoogleAdsClicksSdk = (function () {
606
608
  !getCookieValue('_gcl_au')) {
607
609
  return {
608
610
  isFired: false,
609
- sdkVersion: "1.21.2" ,
611
+ sdkVersion: "1.22.1" ,
610
612
  };
611
613
  }
612
614
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
613
615
  if (!conversionLabel) {
614
616
  return {
615
617
  isFired: false,
616
- sdkVersion: "1.21.2" ,
618
+ sdkVersion: "1.22.1" ,
617
619
  };
618
620
  }
619
621
  if (manifestVariables['enhancedConversionsSetting'] === 'gtag' &&
@@ -630,14 +632,18 @@ var ProvidersGoogleAdsClicksSdk = (function () {
630
632
  });
631
633
  return {
632
634
  isFired: true,
633
- sdkVersion: "1.21.2" ,
635
+ sdkVersion: "1.22.1" ,
634
636
  };
635
637
  };
636
638
 
637
- const consent = ({ consentData }) => {
639
+ const consent = ({ consentData, variables }) => {
638
640
  if (!(window === null || window === void 0 ? void 0 : window.gtag)) {
639
641
  return;
640
642
  }
643
+ const shouldSkipConsent = variables.some((v) => { var _a; return ((_a = v.variableSet) === null || _a === void 0 ? void 0 : _a['consentSkip']) == '1'; });
644
+ if (shouldSkipConsent) {
645
+ return;
646
+ }
641
647
  const data = getGoogleConsent(consentData);
642
648
  window.gtag('consent', 'update', {
643
649
  ...data,
package/index.mjs CHANGED
@@ -407,31 +407,33 @@ const getGoogleConsent = (consentData) => {
407
407
  };
408
408
 
409
409
  // eslint-disable-next-line @nx/enforce-module-boundaries
410
- const initGAds = (ID, consentData, executionContext) => {
410
+ const initGAds = (ID, consentData, executionContext, consentSkip) => {
411
411
  var _a;
412
412
  window.dataLayer = window.dataLayer || [];
413
413
  window.gtag = function gtag() {
414
414
  // eslint-disable-next-line prefer-rest-params
415
415
  window.dataLayer.push(arguments);
416
416
  };
417
- let isConsentInitialised = false;
418
- for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
419
- if ((_a = executionContext.get(otherProvider)) === null || _a === void 0 ? void 0 : _a.get('gtag')) {
420
- isConsentInitialised = true;
421
- break;
417
+ if (consentSkip != '1') {
418
+ let isConsentInitialised = false;
419
+ for (const otherProvider of ['googleAdsClicks', 'googleAnalytics4']) {
420
+ if ((_a = executionContext.get(otherProvider)) === null || _a === void 0 ? void 0 : _a.get('gtag')) {
421
+ isConsentInitialised = true;
422
+ break;
423
+ }
424
+ }
425
+ const data = getGoogleConsent(consentData);
426
+ if (isConsentInitialised) {
427
+ window.gtag('consent', 'update', data);
428
+ }
429
+ else {
430
+ window.gtag('consent', 'default', {
431
+ ...data,
432
+ functional_storage: 'granted',
433
+ personalization_storage: 'granted',
434
+ security_storage: 'granted',
435
+ });
422
436
  }
423
- }
424
- const data = getGoogleConsent(consentData);
425
- if (isConsentInitialised) {
426
- window.gtag('consent', 'update', data);
427
- }
428
- else {
429
- window.gtag('consent', 'default', {
430
- ...data,
431
- functional_storage: 'granted',
432
- personalization_storage: 'granted',
433
- security_storage: 'granted',
434
- });
435
437
  }
436
438
  upsert(executionContext, packageName, (providerMap) => providerMap.set('gtag', true), () => new Map());
437
439
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -446,7 +448,7 @@ const initGAds = (ID, consentData, executionContext) => {
446
448
  }
447
449
  };
448
450
  const init = ({ manifest, consentData, executionContext }) => {
449
- var _a, _b;
451
+ var _a, _b, _c;
450
452
  if (!window ||
451
453
  !((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['tagId']) ||
452
454
  manifest.variables['loadSDK'] !== '1') {
@@ -460,7 +462,7 @@ const init = ({ manifest, consentData, executionContext }) => {
460
462
  }
461
463
  if (!window.google_tag_manager ||
462
464
  !window.google_tag_manager[manifest.variables['tagId']]) {
463
- initGAds(manifest.variables['tagId'], consentData, executionContext);
465
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_c = manifest.variables) === null || _c === void 0 ? void 0 : _c['consentSkip']);
464
466
  }
465
467
  if (window.gtag) {
466
468
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -603,14 +605,14 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
603
605
  !getCookieValue('_gcl_au')) {
604
606
  return {
605
607
  isFired: false,
606
- sdkVersion: "1.21.2" ,
608
+ sdkVersion: "1.22.1" ,
607
609
  };
608
610
  }
609
611
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
610
612
  if (!conversionLabel) {
611
613
  return {
612
614
  isFired: false,
613
- sdkVersion: "1.21.2" ,
615
+ sdkVersion: "1.22.1" ,
614
616
  };
615
617
  }
616
618
  if (manifestVariables['enhancedConversionsSetting'] === 'gtag' &&
@@ -627,14 +629,18 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
627
629
  });
628
630
  return {
629
631
  isFired: true,
630
- sdkVersion: "1.21.2" ,
632
+ sdkVersion: "1.22.1" ,
631
633
  };
632
634
  };
633
635
 
634
- const consent = ({ consentData }) => {
636
+ const consent = ({ consentData, variables }) => {
635
637
  if (!(window === null || window === void 0 ? void 0 : window.gtag)) {
636
638
  return;
637
639
  }
640
+ const shouldSkipConsent = variables.some((v) => { var _a; return ((_a = v.variableSet) === null || _a === void 0 ? void 0 : _a['consentSkip']) == '1'; });
641
+ if (shouldSkipConsent) {
642
+ return;
643
+ }
638
644
  const data = getGoogleConsent(consentData);
639
645
  window.gtag('consent', 'update', {
640
646
  ...data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-google-ads-clicks-sdk",
3
- "version": "1.21.2",
3
+ "version": "1.22.1",
4
4
  "description": "Google Ads Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",