@blotoutio/providers-google-ads-clicks-sdk 1.52.0 → 1.53.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.
Files changed (4) hide show
  1. package/index.cjs.js +23 -10
  2. package/index.js +23 -10
  3. package/index.mjs +23 -10
  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,7 +697,11 @@ 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 || [];
@@ -704,7 +711,7 @@ const init = ({ manifest, consentData, executionContext }) => {
704
711
  };
705
712
  if (!window.google_tag_manager ||
706
713
  !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']);
714
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['consentSkip']);
708
715
  }
709
716
  if (window.gtag) {
710
717
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -747,10 +754,11 @@ const parseCookies = (cookie) => {
747
754
  }));
748
755
  };
749
756
 
750
- const tag = ({ data, eventName, manifestVariables, destination, }) => {
757
+ const tag = ({ data, eventName, manifestVariables, destination, pageUrl, }) => {
758
+ var _a;
751
759
  const result = {
752
760
  isFired: false,
753
- sdkVersion: "1.52.0" ,
761
+ sdkVersion: "1.53.0" ,
754
762
  };
755
763
  if (!eventName || !window.gtag || !(manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'])) {
756
764
  return result;
@@ -761,8 +769,9 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
761
769
  if (!shouldLoadSDK || !hasCookie) {
762
770
  return result;
763
771
  }
772
+ const resolvedPageUrl = pageUrl || ((_a = window.location) === null || _a === void 0 ? void 0 : _a.href);
764
773
  // Send dynamic remarketing event if enabled
765
- sendDynamicRemarketingEvent(eventName, manifestVariables, data);
774
+ sendDynamicRemarketingEvent(eventName, manifestVariables, data, resolvedPageUrl);
766
775
  // Fire conversion event if loadSDK is enabled and conversion label exists
767
776
  if ((manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['loadSDK']) === '1') {
768
777
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
@@ -773,12 +782,16 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
773
782
  }
774
783
  const eventData = getEventData(data);
775
784
  const cartData = getCartData(manifestVariables, data);
776
- window.gtag('event', 'conversion', {
785
+ const conversionPayload = {
777
786
  send_to: conversionLabel,
778
787
  ...eventData,
779
788
  ...cartData,
780
789
  app: 'blotout',
781
- });
790
+ };
791
+ if (resolvedPageUrl) {
792
+ conversionPayload['page_location'] = resolvedPageUrl;
793
+ }
794
+ window.gtag('event', 'conversion', conversionPayload);
782
795
  result.isFired = true;
783
796
  }
784
797
  }
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,7 +698,11 @@ 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 || [];
@@ -705,7 +712,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
705
712
  };
706
713
  if (!window.google_tag_manager ||
707
714
  !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']);
715
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['consentSkip']);
709
716
  }
710
717
  if (window.gtag) {
711
718
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -748,10 +755,11 @@ var ProvidersGoogleAdsClicksSdk = (function () {
748
755
  }));
749
756
  };
750
757
 
751
- const tag = ({ data, eventName, manifestVariables, destination, }) => {
758
+ const tag = ({ data, eventName, manifestVariables, destination, pageUrl, }) => {
759
+ var _a;
752
760
  const result = {
753
761
  isFired: false,
754
- sdkVersion: "1.52.0" ,
762
+ sdkVersion: "1.53.0" ,
755
763
  };
756
764
  if (!eventName || !window.gtag || !(manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'])) {
757
765
  return result;
@@ -762,8 +770,9 @@ var ProvidersGoogleAdsClicksSdk = (function () {
762
770
  if (!shouldLoadSDK || !hasCookie) {
763
771
  return result;
764
772
  }
773
+ const resolvedPageUrl = pageUrl || ((_a = window.location) === null || _a === void 0 ? void 0 : _a.href);
765
774
  // Send dynamic remarketing event if enabled
766
- sendDynamicRemarketingEvent(eventName, manifestVariables, data);
775
+ sendDynamicRemarketingEvent(eventName, manifestVariables, data, resolvedPageUrl);
767
776
  // Fire conversion event if loadSDK is enabled and conversion label exists
768
777
  if ((manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['loadSDK']) === '1') {
769
778
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
@@ -774,12 +783,16 @@ var ProvidersGoogleAdsClicksSdk = (function () {
774
783
  }
775
784
  const eventData = getEventData(data);
776
785
  const cartData = getCartData(manifestVariables, data);
777
- window.gtag('event', 'conversion', {
786
+ const conversionPayload = {
778
787
  send_to: conversionLabel,
779
788
  ...eventData,
780
789
  ...cartData,
781
790
  app: 'blotout',
782
- });
791
+ };
792
+ if (resolvedPageUrl) {
793
+ conversionPayload['page_location'] = resolvedPageUrl;
794
+ }
795
+ window.gtag('event', 'conversion', conversionPayload);
783
796
  result.isFired = true;
784
797
  }
785
798
  }
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,7 +695,11 @@ 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 || [];
@@ -702,7 +709,7 @@ const init = ({ manifest, consentData, executionContext }) => {
702
709
  };
703
710
  if (!window.google_tag_manager ||
704
711
  !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']);
712
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['consentSkip']);
706
713
  }
707
714
  if (window.gtag) {
708
715
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -745,10 +752,11 @@ const parseCookies = (cookie) => {
745
752
  }));
746
753
  };
747
754
 
748
- const tag = ({ data, eventName, manifestVariables, destination, }) => {
755
+ const tag = ({ data, eventName, manifestVariables, destination, pageUrl, }) => {
756
+ var _a;
749
757
  const result = {
750
758
  isFired: false,
751
- sdkVersion: "1.52.0" ,
759
+ sdkVersion: "1.53.0" ,
752
760
  };
753
761
  if (!eventName || !window.gtag || !(manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'])) {
754
762
  return result;
@@ -759,8 +767,9 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
759
767
  if (!shouldLoadSDK || !hasCookie) {
760
768
  return result;
761
769
  }
770
+ const resolvedPageUrl = pageUrl || ((_a = window.location) === null || _a === void 0 ? void 0 : _a.href);
762
771
  // Send dynamic remarketing event if enabled
763
- sendDynamicRemarketingEvent(eventName, manifestVariables, data);
772
+ sendDynamicRemarketingEvent(eventName, manifestVariables, data, resolvedPageUrl);
764
773
  // Fire conversion event if loadSDK is enabled and conversion label exists
765
774
  if ((manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['loadSDK']) === '1') {
766
775
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
@@ -771,12 +780,16 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
771
780
  }
772
781
  const eventData = getEventData(data);
773
782
  const cartData = getCartData(manifestVariables, data);
774
- window.gtag('event', 'conversion', {
783
+ const conversionPayload = {
775
784
  send_to: conversionLabel,
776
785
  ...eventData,
777
786
  ...cartData,
778
787
  app: 'blotout',
779
- });
788
+ };
789
+ if (resolvedPageUrl) {
790
+ conversionPayload['page_location'] = resolvedPageUrl;
791
+ }
792
+ window.gtag('event', 'conversion', conversionPayload);
780
793
  result.isFired = true;
781
794
  }
782
795
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-google-ads-clicks-sdk",
3
- "version": "1.52.0",
3
+ "version": "1.53.0",
4
4
  "description": "Google Ads Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",