@blotoutio/providers-google-ads-clicks-sdk 1.69.2 → 1.70.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 +24 -17
  2. package/index.js +24 -17
  3. package/index.mjs +24 -17
  4. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -911,7 +911,7 @@ const initGAds = (ID, consentData, executionContext, consentSkip, sdkUrl) => {
911
911
  }
912
912
  };
913
913
  const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
914
- var _a, _b, _c, _d, _e, _f, _g, _h;
914
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
915
915
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
916
916
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
917
917
  if (typeof window === 'undefined' ||
@@ -926,9 +926,12 @@ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
926
926
  if (resolvedPageUrl) {
927
927
  customConfig['page_location'] = resolvedPageUrl;
928
928
  }
929
- // v2 always drives enhanced conversions through gtag, so it needs this too.
930
- if (((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['apiVersion']) === '2' ||
931
- ((_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['enhancedConversionsSetting']) === 'gtag') {
929
+ // Must match tag.ts. Left on without it, gtag collects user data on its own.
930
+ const isDataManager = ((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['apiVersion']) === '2';
931
+ const allowEnhancedConversions = isDataManager
932
+ ? ((_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['dataManagerEnhancedConversions']) !== '0'
933
+ : ((_g = manifest.variables) === null || _g === void 0 ? void 0 : _g['enhancedConversionsSetting']) === 'gtag';
934
+ if (allowEnhancedConversions) {
932
935
  customConfig['allow_enhanced_conversions'] = true;
933
936
  }
934
937
  window.dataLayer = window.dataLayer || [];
@@ -940,7 +943,7 @@ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
940
943
  };
941
944
  if (!window.google_tag_manager ||
942
945
  !window.google_tag_manager[manifest.variables['tagId']]) {
943
- initGAds(manifest.variables['tagId'], consentData, executionContext, (_g = manifest.variables) === null || _g === void 0 ? void 0 : _g['consentSkip'], (_h = manifest.variables) === null || _h === void 0 ? void 0 : _h['sdkUrl']);
946
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_h = manifest.variables) === null || _h === void 0 ? void 0 : _h['consentSkip'], (_j = manifest.variables) === null || _j === void 0 ? void 0 : _j['sdkUrl']);
944
947
  }
945
948
  if (window.gtag) {
946
949
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -1009,7 +1012,7 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1009
1012
  var _a, _b;
1010
1013
  const result = {
1011
1014
  isFired: false,
1012
- sdkVersion: "1.69.2" ,
1015
+ sdkVersion: "1.70.0" ,
1013
1016
  };
1014
1017
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1015
1018
  if (!eventName || !window.gtag || !tagId) {
@@ -1028,17 +1031,21 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1028
1031
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
1029
1032
  if (conversionLabel) {
1030
1033
  const isDataManager = manifestVariables['apiVersion'] === '2';
1031
- /*
1032
- * On v2 the browser is the primary source of user data: Google now accepts
1033
- * user-provided data from the tag, Data Manager and the API at once, so
1034
- * there is no adjustment upload to attach it server-side. Consent is
1035
- * handled by Consent Mode — `init` sets ad_user_data/ad_personalization
1036
- * from the user's consent, and gtag withholds user data when they're denied.
1037
- */
1038
- if ((isDataManager ||
1039
- manifestVariables['enhancedConversionsSetting'] === 'gtag') &&
1040
- destination) {
1041
- window.gtag('set', 'user_data', getUserData(destination));
1034
+ // On unless a super admin turns it off for the channel — setting user data
1035
+ // here appears to cost the account's v1 conversion actions their enhanced
1036
+ // conversions coverage. v1 keeps following the customer's own EC setting.
1037
+ const sendUserData = isDataManager
1038
+ ? manifestVariables['dataManagerEnhancedConversions'] !== '0'
1039
+ : manifestVariables['enhancedConversionsSetting'] === 'gtag';
1040
+ if (sendUserData && destination) {
1041
+ // Sending an empty object still marks the conversion as carrying
1042
+ // user-provided data, so Google counts it as eligible and then finds
1043
+ // nothing, which costs us enhanced conversions coverage. Stay quiet
1044
+ // when the session store has no identifiers.
1045
+ const userData = getUserData(destination);
1046
+ if (Object.keys(userData).length) {
1047
+ window.gtag('set', 'user_data', userData);
1048
+ }
1042
1049
  }
1043
1050
  const cartData = getCartData(manifestVariables, data);
1044
1051
  const fireConversion = (isNewCustomer) => {
package/index.js CHANGED
@@ -912,7 +912,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
912
912
  }
913
913
  };
914
914
  const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
915
- var _a, _b, _c, _d, _e, _f, _g, _h;
915
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
916
916
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
917
917
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
918
918
  if (typeof window === 'undefined' ||
@@ -927,9 +927,12 @@ var ProvidersGoogleAdsClicksSdk = (function () {
927
927
  if (resolvedPageUrl) {
928
928
  customConfig['page_location'] = resolvedPageUrl;
929
929
  }
930
- // v2 always drives enhanced conversions through gtag, so it needs this too.
931
- if (((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['apiVersion']) === '2' ||
932
- ((_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['enhancedConversionsSetting']) === 'gtag') {
930
+ // Must match tag.ts. Left on without it, gtag collects user data on its own.
931
+ const isDataManager = ((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['apiVersion']) === '2';
932
+ const allowEnhancedConversions = isDataManager
933
+ ? ((_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['dataManagerEnhancedConversions']) !== '0'
934
+ : ((_g = manifest.variables) === null || _g === void 0 ? void 0 : _g['enhancedConversionsSetting']) === 'gtag';
935
+ if (allowEnhancedConversions) {
933
936
  customConfig['allow_enhanced_conversions'] = true;
934
937
  }
935
938
  window.dataLayer = window.dataLayer || [];
@@ -941,7 +944,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
941
944
  };
942
945
  if (!window.google_tag_manager ||
943
946
  !window.google_tag_manager[manifest.variables['tagId']]) {
944
- initGAds(manifest.variables['tagId'], consentData, executionContext, (_g = manifest.variables) === null || _g === void 0 ? void 0 : _g['consentSkip'], (_h = manifest.variables) === null || _h === void 0 ? void 0 : _h['sdkUrl']);
947
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_h = manifest.variables) === null || _h === void 0 ? void 0 : _h['consentSkip'], (_j = manifest.variables) === null || _j === void 0 ? void 0 : _j['sdkUrl']);
945
948
  }
946
949
  if (window.gtag) {
947
950
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -1010,7 +1013,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
1010
1013
  var _a, _b;
1011
1014
  const result = {
1012
1015
  isFired: false,
1013
- sdkVersion: "1.69.2" ,
1016
+ sdkVersion: "1.70.0" ,
1014
1017
  };
1015
1018
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1016
1019
  if (!eventName || !window.gtag || !tagId) {
@@ -1029,17 +1032,21 @@ var ProvidersGoogleAdsClicksSdk = (function () {
1029
1032
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
1030
1033
  if (conversionLabel) {
1031
1034
  const isDataManager = manifestVariables['apiVersion'] === '2';
1032
- /*
1033
- * On v2 the browser is the primary source of user data: Google now accepts
1034
- * user-provided data from the tag, Data Manager and the API at once, so
1035
- * there is no adjustment upload to attach it server-side. Consent is
1036
- * handled by Consent Mode — `init` sets ad_user_data/ad_personalization
1037
- * from the user's consent, and gtag withholds user data when they're denied.
1038
- */
1039
- if ((isDataManager ||
1040
- manifestVariables['enhancedConversionsSetting'] === 'gtag') &&
1041
- destination) {
1042
- window.gtag('set', 'user_data', getUserData(destination));
1035
+ // On unless a super admin turns it off for the channel — setting user data
1036
+ // here appears to cost the account's v1 conversion actions their enhanced
1037
+ // conversions coverage. v1 keeps following the customer's own EC setting.
1038
+ const sendUserData = isDataManager
1039
+ ? manifestVariables['dataManagerEnhancedConversions'] !== '0'
1040
+ : manifestVariables['enhancedConversionsSetting'] === 'gtag';
1041
+ if (sendUserData && destination) {
1042
+ // Sending an empty object still marks the conversion as carrying
1043
+ // user-provided data, so Google counts it as eligible and then finds
1044
+ // nothing, which costs us enhanced conversions coverage. Stay quiet
1045
+ // when the session store has no identifiers.
1046
+ const userData = getUserData(destination);
1047
+ if (Object.keys(userData).length) {
1048
+ window.gtag('set', 'user_data', userData);
1049
+ }
1043
1050
  }
1044
1051
  const cartData = getCartData(manifestVariables, data);
1045
1052
  const fireConversion = (isNewCustomer) => {
package/index.mjs CHANGED
@@ -909,7 +909,7 @@ const initGAds = (ID, consentData, executionContext, consentSkip, sdkUrl) => {
909
909
  }
910
910
  };
911
911
  const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
912
- var _a, _b, _c, _d, _e, _f, _g, _h;
912
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
913
913
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
914
914
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
915
915
  if (typeof window === 'undefined' ||
@@ -924,9 +924,12 @@ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
924
924
  if (resolvedPageUrl) {
925
925
  customConfig['page_location'] = resolvedPageUrl;
926
926
  }
927
- // v2 always drives enhanced conversions through gtag, so it needs this too.
928
- if (((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['apiVersion']) === '2' ||
929
- ((_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['enhancedConversionsSetting']) === 'gtag') {
927
+ // Must match tag.ts. Left on without it, gtag collects user data on its own.
928
+ const isDataManager = ((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['apiVersion']) === '2';
929
+ const allowEnhancedConversions = isDataManager
930
+ ? ((_f = manifest.variables) === null || _f === void 0 ? void 0 : _f['dataManagerEnhancedConversions']) !== '0'
931
+ : ((_g = manifest.variables) === null || _g === void 0 ? void 0 : _g['enhancedConversionsSetting']) === 'gtag';
932
+ if (allowEnhancedConversions) {
930
933
  customConfig['allow_enhanced_conversions'] = true;
931
934
  }
932
935
  window.dataLayer = window.dataLayer || [];
@@ -938,7 +941,7 @@ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
938
941
  };
939
942
  if (!window.google_tag_manager ||
940
943
  !window.google_tag_manager[manifest.variables['tagId']]) {
941
- initGAds(manifest.variables['tagId'], consentData, executionContext, (_g = manifest.variables) === null || _g === void 0 ? void 0 : _g['consentSkip'], (_h = manifest.variables) === null || _h === void 0 ? void 0 : _h['sdkUrl']);
944
+ initGAds(manifest.variables['tagId'], consentData, executionContext, (_h = manifest.variables) === null || _h === void 0 ? void 0 : _h['consentSkip'], (_j = manifest.variables) === null || _j === void 0 ? void 0 : _j['sdkUrl']);
942
945
  }
943
946
  if (window.gtag) {
944
947
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -1007,7 +1010,7 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1007
1010
  var _a, _b;
1008
1011
  const result = {
1009
1012
  isFired: false,
1010
- sdkVersion: "1.69.2" ,
1013
+ sdkVersion: "1.70.0" ,
1011
1014
  };
1012
1015
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1013
1016
  if (!eventName || !window.gtag || !tagId) {
@@ -1026,17 +1029,21 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1026
1029
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
1027
1030
  if (conversionLabel) {
1028
1031
  const isDataManager = manifestVariables['apiVersion'] === '2';
1029
- /*
1030
- * On v2 the browser is the primary source of user data: Google now accepts
1031
- * user-provided data from the tag, Data Manager and the API at once, so
1032
- * there is no adjustment upload to attach it server-side. Consent is
1033
- * handled by Consent Mode — `init` sets ad_user_data/ad_personalization
1034
- * from the user's consent, and gtag withholds user data when they're denied.
1035
- */
1036
- if ((isDataManager ||
1037
- manifestVariables['enhancedConversionsSetting'] === 'gtag') &&
1038
- destination) {
1039
- window.gtag('set', 'user_data', getUserData(destination));
1032
+ // On unless a super admin turns it off for the channel — setting user data
1033
+ // here appears to cost the account's v1 conversion actions their enhanced
1034
+ // conversions coverage. v1 keeps following the customer's own EC setting.
1035
+ const sendUserData = isDataManager
1036
+ ? manifestVariables['dataManagerEnhancedConversions'] !== '0'
1037
+ : manifestVariables['enhancedConversionsSetting'] === 'gtag';
1038
+ if (sendUserData && destination) {
1039
+ // Sending an empty object still marks the conversion as carrying
1040
+ // user-provided data, so Google counts it as eligible and then finds
1041
+ // nothing, which costs us enhanced conversions coverage. Stay quiet
1042
+ // when the session store has no identifiers.
1043
+ const userData = getUserData(destination);
1044
+ if (Object.keys(userData).length) {
1045
+ window.gtag('set', 'user_data', userData);
1046
+ }
1040
1047
  }
1041
1048
  const cartData = getCartData(manifestVariables, data);
1042
1049
  const fireConversion = (isNewCustomer) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-google-ads-clicks-sdk",
3
- "version": "1.69.2",
3
+ "version": "1.70.0",
4
4
  "description": "Google Ads Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",