@blotoutio/providers-google-ads-clicks-sdk 1.52.1 → 1.53.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 +29 -14
  2. package/index.js +29 -14
  3. package/index.mjs +29 -14
  4. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -623,7 +623,7 @@ const getDynamicRemarketingItems = (variables, data) => {
623
623
  /**
624
624
  * Send dynamic remarketing event to Google Ads
625
625
  */
626
- const sendDynamicRemarketingEvent = (eventName, manifestVariables, data) => {
626
+ const sendDynamicRemarketingEvent = (eventName, manifestVariables, data, pageUrl) => {
627
627
  if (!window.gtag || manifestVariables['dynamicRemarketingEnabled'] !== '1') {
628
628
  return;
629
629
  }
@@ -640,6 +640,9 @@ const sendDynamicRemarketingEvent = (eventName, manifestVariables, data) => {
640
640
  if (items.length > 0) {
641
641
  eventData['items'] = items;
642
642
  }
643
+ if (pageUrl) {
644
+ eventData['page_location'] = pageUrl;
645
+ }
643
646
  window.gtag('event', googleAdsEvent, eventData);
644
647
  };
645
648
 
@@ -682,8 +685,8 @@ const initGAds = (ID, consentData, executionContext, consentSkip) => {
682
685
  script.parentNode.insertBefore(element, script);
683
686
  }
684
687
  };
685
- const init = ({ manifest, consentData, executionContext }) => {
686
- var _a, _b, _c, _d, _e;
688
+ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
689
+ var _a, _b, _c, _d, _e, _f;
687
690
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
688
691
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
689
692
  if (typeof window === 'undefined' ||
@@ -694,17 +697,23 @@ const init = ({ manifest, consentData, executionContext }) => {
694
697
  const customConfig = {
695
698
  send_page_view: false,
696
699
  };
697
- if (((_d = manifest.variables) === null || _d === void 0 ? void 0 : _d['enhancedConversionsSetting']) === 'gtag') {
700
+ const resolvedPageUrl = pageUrl || ((_d = window.location) === null || _d === void 0 ? void 0 : _d.href);
701
+ if (resolvedPageUrl) {
702
+ customConfig['page_location'] = resolvedPageUrl;
703
+ }
704
+ if (((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['enhancedConversionsSetting']) === 'gtag') {
698
705
  customConfig['allow_enhanced_conversions'] = true;
699
706
  }
700
707
  window.dataLayer = window.dataLayer || [];
701
- window.gtag = function gtag() {
702
- // eslint-disable-next-line prefer-rest-params
703
- window.dataLayer.push(arguments);
704
- };
708
+ window.gtag =
709
+ window.gtag ||
710
+ function gtag() {
711
+ // eslint-disable-next-line prefer-rest-params
712
+ window.dataLayer.push(arguments);
713
+ };
705
714
  if (!window.google_tag_manager ||
706
715
  !window.google_tag_manager[manifest.variables['tagId']]) {
707
- initGAds(manifest.variables['tagId'], consentData, executionContext, (_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['consentSkip']);
716
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['consentSkip']);
708
717
  }
709
718
  if (window.gtag) {
710
719
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -747,10 +756,11 @@ const parseCookies = (cookie) => {
747
756
  }));
748
757
  };
749
758
 
750
- const tag = ({ data, eventName, manifestVariables, destination, }) => {
759
+ const tag = ({ data, eventName, manifestVariables, destination, pageUrl, }) => {
760
+ var _a;
751
761
  const result = {
752
762
  isFired: false,
753
- sdkVersion: "1.52.1" ,
763
+ sdkVersion: "1.53.1" ,
754
764
  };
755
765
  if (!eventName || !window.gtag || !(manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'])) {
756
766
  return result;
@@ -761,8 +771,9 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
761
771
  if (!shouldLoadSDK || !hasCookie) {
762
772
  return result;
763
773
  }
774
+ const resolvedPageUrl = pageUrl || ((_a = window.location) === null || _a === void 0 ? void 0 : _a.href);
764
775
  // Send dynamic remarketing event if enabled
765
- sendDynamicRemarketingEvent(eventName, manifestVariables, data);
776
+ sendDynamicRemarketingEvent(eventName, manifestVariables, data, resolvedPageUrl);
766
777
  // Fire conversion event if loadSDK is enabled and conversion label exists
767
778
  if ((manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['loadSDK']) === '1') {
768
779
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
@@ -773,12 +784,16 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
773
784
  }
774
785
  const eventData = getEventData(data);
775
786
  const cartData = getCartData(manifestVariables, data);
776
- window.gtag('event', 'conversion', {
787
+ const conversionPayload = {
777
788
  send_to: conversionLabel,
778
789
  ...eventData,
779
790
  ...cartData,
780
791
  app: 'blotout',
781
- });
792
+ };
793
+ if (resolvedPageUrl) {
794
+ conversionPayload['page_location'] = resolvedPageUrl;
795
+ }
796
+ window.gtag('event', 'conversion', conversionPayload);
782
797
  result.isFired = true;
783
798
  }
784
799
  }
package/index.js CHANGED
@@ -624,7 +624,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
624
624
  /**
625
625
  * Send dynamic remarketing event to Google Ads
626
626
  */
627
- const sendDynamicRemarketingEvent = (eventName, manifestVariables, data) => {
627
+ const sendDynamicRemarketingEvent = (eventName, manifestVariables, data, pageUrl) => {
628
628
  if (!window.gtag || manifestVariables['dynamicRemarketingEnabled'] !== '1') {
629
629
  return;
630
630
  }
@@ -641,6 +641,9 @@ var ProvidersGoogleAdsClicksSdk = (function () {
641
641
  if (items.length > 0) {
642
642
  eventData['items'] = items;
643
643
  }
644
+ if (pageUrl) {
645
+ eventData['page_location'] = pageUrl;
646
+ }
644
647
  window.gtag('event', googleAdsEvent, eventData);
645
648
  };
646
649
 
@@ -683,8 +686,8 @@ var ProvidersGoogleAdsClicksSdk = (function () {
683
686
  script.parentNode.insertBefore(element, script);
684
687
  }
685
688
  };
686
- const init = ({ manifest, consentData, executionContext }) => {
687
- var _a, _b, _c, _d, _e;
689
+ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
690
+ var _a, _b, _c, _d, _e, _f;
688
691
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
689
692
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
690
693
  if (typeof window === 'undefined' ||
@@ -695,17 +698,23 @@ var ProvidersGoogleAdsClicksSdk = (function () {
695
698
  const customConfig = {
696
699
  send_page_view: false,
697
700
  };
698
- if (((_d = manifest.variables) === null || _d === void 0 ? void 0 : _d['enhancedConversionsSetting']) === 'gtag') {
701
+ const resolvedPageUrl = pageUrl || ((_d = window.location) === null || _d === void 0 ? void 0 : _d.href);
702
+ if (resolvedPageUrl) {
703
+ customConfig['page_location'] = resolvedPageUrl;
704
+ }
705
+ if (((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['enhancedConversionsSetting']) === 'gtag') {
699
706
  customConfig['allow_enhanced_conversions'] = true;
700
707
  }
701
708
  window.dataLayer = window.dataLayer || [];
702
- window.gtag = function gtag() {
703
- // eslint-disable-next-line prefer-rest-params
704
- window.dataLayer.push(arguments);
705
- };
709
+ window.gtag =
710
+ window.gtag ||
711
+ function gtag() {
712
+ // eslint-disable-next-line prefer-rest-params
713
+ window.dataLayer.push(arguments);
714
+ };
706
715
  if (!window.google_tag_manager ||
707
716
  !window.google_tag_manager[manifest.variables['tagId']]) {
708
- initGAds(manifest.variables['tagId'], consentData, executionContext, (_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['consentSkip']);
717
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['consentSkip']);
709
718
  }
710
719
  if (window.gtag) {
711
720
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -748,10 +757,11 @@ var ProvidersGoogleAdsClicksSdk = (function () {
748
757
  }));
749
758
  };
750
759
 
751
- const tag = ({ data, eventName, manifestVariables, destination, }) => {
760
+ const tag = ({ data, eventName, manifestVariables, destination, pageUrl, }) => {
761
+ var _a;
752
762
  const result = {
753
763
  isFired: false,
754
- sdkVersion: "1.52.1" ,
764
+ sdkVersion: "1.53.1" ,
755
765
  };
756
766
  if (!eventName || !window.gtag || !(manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'])) {
757
767
  return result;
@@ -762,8 +772,9 @@ var ProvidersGoogleAdsClicksSdk = (function () {
762
772
  if (!shouldLoadSDK || !hasCookie) {
763
773
  return result;
764
774
  }
775
+ const resolvedPageUrl = pageUrl || ((_a = window.location) === null || _a === void 0 ? void 0 : _a.href);
765
776
  // Send dynamic remarketing event if enabled
766
- sendDynamicRemarketingEvent(eventName, manifestVariables, data);
777
+ sendDynamicRemarketingEvent(eventName, manifestVariables, data, resolvedPageUrl);
767
778
  // Fire conversion event if loadSDK is enabled and conversion label exists
768
779
  if ((manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['loadSDK']) === '1') {
769
780
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
@@ -774,12 +785,16 @@ var ProvidersGoogleAdsClicksSdk = (function () {
774
785
  }
775
786
  const eventData = getEventData(data);
776
787
  const cartData = getCartData(manifestVariables, data);
777
- window.gtag('event', 'conversion', {
788
+ const conversionPayload = {
778
789
  send_to: conversionLabel,
779
790
  ...eventData,
780
791
  ...cartData,
781
792
  app: 'blotout',
782
- });
793
+ };
794
+ if (resolvedPageUrl) {
795
+ conversionPayload['page_location'] = resolvedPageUrl;
796
+ }
797
+ window.gtag('event', 'conversion', conversionPayload);
783
798
  result.isFired = true;
784
799
  }
785
800
  }
package/index.mjs CHANGED
@@ -621,7 +621,7 @@ const getDynamicRemarketingItems = (variables, data) => {
621
621
  /**
622
622
  * Send dynamic remarketing event to Google Ads
623
623
  */
624
- const sendDynamicRemarketingEvent = (eventName, manifestVariables, data) => {
624
+ const sendDynamicRemarketingEvent = (eventName, manifestVariables, data, pageUrl) => {
625
625
  if (!window.gtag || manifestVariables['dynamicRemarketingEnabled'] !== '1') {
626
626
  return;
627
627
  }
@@ -638,6 +638,9 @@ const sendDynamicRemarketingEvent = (eventName, manifestVariables, data) => {
638
638
  if (items.length > 0) {
639
639
  eventData['items'] = items;
640
640
  }
641
+ if (pageUrl) {
642
+ eventData['page_location'] = pageUrl;
643
+ }
641
644
  window.gtag('event', googleAdsEvent, eventData);
642
645
  };
643
646
 
@@ -680,8 +683,8 @@ const initGAds = (ID, consentData, executionContext, consentSkip) => {
680
683
  script.parentNode.insertBefore(element, script);
681
684
  }
682
685
  };
683
- const init = ({ manifest, consentData, executionContext }) => {
684
- var _a, _b, _c, _d, _e;
686
+ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
687
+ var _a, _b, _c, _d, _e, _f;
685
688
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
686
689
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
687
690
  if (typeof window === 'undefined' ||
@@ -692,17 +695,23 @@ const init = ({ manifest, consentData, executionContext }) => {
692
695
  const customConfig = {
693
696
  send_page_view: false,
694
697
  };
695
- if (((_d = manifest.variables) === null || _d === void 0 ? void 0 : _d['enhancedConversionsSetting']) === 'gtag') {
698
+ const resolvedPageUrl = pageUrl || ((_d = window.location) === null || _d === void 0 ? void 0 : _d.href);
699
+ if (resolvedPageUrl) {
700
+ customConfig['page_location'] = resolvedPageUrl;
701
+ }
702
+ if (((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['enhancedConversionsSetting']) === 'gtag') {
696
703
  customConfig['allow_enhanced_conversions'] = true;
697
704
  }
698
705
  window.dataLayer = window.dataLayer || [];
699
- window.gtag = function gtag() {
700
- // eslint-disable-next-line prefer-rest-params
701
- window.dataLayer.push(arguments);
702
- };
706
+ window.gtag =
707
+ window.gtag ||
708
+ function gtag() {
709
+ // eslint-disable-next-line prefer-rest-params
710
+ window.dataLayer.push(arguments);
711
+ };
703
712
  if (!window.google_tag_manager ||
704
713
  !window.google_tag_manager[manifest.variables['tagId']]) {
705
- initGAds(manifest.variables['tagId'], consentData, executionContext, (_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['consentSkip']);
714
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['consentSkip']);
706
715
  }
707
716
  if (window.gtag) {
708
717
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -745,10 +754,11 @@ const parseCookies = (cookie) => {
745
754
  }));
746
755
  };
747
756
 
748
- const tag = ({ data, eventName, manifestVariables, destination, }) => {
757
+ const tag = ({ data, eventName, manifestVariables, destination, pageUrl, }) => {
758
+ var _a;
749
759
  const result = {
750
760
  isFired: false,
751
- sdkVersion: "1.52.1" ,
761
+ sdkVersion: "1.53.1" ,
752
762
  };
753
763
  if (!eventName || !window.gtag || !(manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'])) {
754
764
  return result;
@@ -759,8 +769,9 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
759
769
  if (!shouldLoadSDK || !hasCookie) {
760
770
  return result;
761
771
  }
772
+ const resolvedPageUrl = pageUrl || ((_a = window.location) === null || _a === void 0 ? void 0 : _a.href);
762
773
  // Send dynamic remarketing event if enabled
763
- sendDynamicRemarketingEvent(eventName, manifestVariables, data);
774
+ sendDynamicRemarketingEvent(eventName, manifestVariables, data, resolvedPageUrl);
764
775
  // Fire conversion event if loadSDK is enabled and conversion label exists
765
776
  if ((manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['loadSDK']) === '1') {
766
777
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
@@ -771,12 +782,16 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
771
782
  }
772
783
  const eventData = getEventData(data);
773
784
  const cartData = getCartData(manifestVariables, data);
774
- window.gtag('event', 'conversion', {
785
+ const conversionPayload = {
775
786
  send_to: conversionLabel,
776
787
  ...eventData,
777
788
  ...cartData,
778
789
  app: 'blotout',
779
- });
790
+ };
791
+ if (resolvedPageUrl) {
792
+ conversionPayload['page_location'] = resolvedPageUrl;
793
+ }
794
+ window.gtag('event', 'conversion', conversionPayload);
780
795
  result.isFired = true;
781
796
  }
782
797
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-google-ads-clicks-sdk",
3
- "version": "1.52.1",
3
+ "version": "1.53.1",
4
4
  "description": "Google Ads Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",