@blotoutio/providers-google-ads-clicks-sdk 1.69.1 → 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 +27 -17
  2. package/index.js +27 -17
  3. package/index.mjs +27 -17
  4. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -50,6 +50,9 @@ const upsert = (map, key, update, createDefault) => {
50
50
  * Keep this list in sync with `defaultParams` in queryParams.ts when new
51
51
  * click ID providers are added.
52
52
  */
53
+ // One limit for the Customers.ai mmuid / search tokens everywhere they are
54
+ // handled: the smblead SDK capture hook, EdgeLake emission, and the smblead
55
+ // webhook ingestion/emission (the app cannot import provider config libs).
53
56
  const CLICK_IDS = [
54
57
  { param: 'fbclid', label: 'Facebook' }, // Facebook Ads
55
58
  { param: 'gclid', label: 'Google' }, // Google Ads (click)
@@ -908,7 +911,7 @@ const initGAds = (ID, consentData, executionContext, consentSkip, sdkUrl) => {
908
911
  }
909
912
  };
910
913
  const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
911
- var _a, _b, _c, _d, _e, _f, _g, _h;
914
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
912
915
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
913
916
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
914
917
  if (typeof window === 'undefined' ||
@@ -923,9 +926,12 @@ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
923
926
  if (resolvedPageUrl) {
924
927
  customConfig['page_location'] = resolvedPageUrl;
925
928
  }
926
- // v2 always drives enhanced conversions through gtag, so it needs this too.
927
- if (((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['apiVersion']) === '2' ||
928
- ((_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) {
929
935
  customConfig['allow_enhanced_conversions'] = true;
930
936
  }
931
937
  window.dataLayer = window.dataLayer || [];
@@ -937,7 +943,7 @@ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
937
943
  };
938
944
  if (!window.google_tag_manager ||
939
945
  !window.google_tag_manager[manifest.variables['tagId']]) {
940
- 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']);
941
947
  }
942
948
  if (window.gtag) {
943
949
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -1006,7 +1012,7 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1006
1012
  var _a, _b;
1007
1013
  const result = {
1008
1014
  isFired: false,
1009
- sdkVersion: "1.69.1" ,
1015
+ sdkVersion: "1.70.0" ,
1010
1016
  };
1011
1017
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1012
1018
  if (!eventName || !window.gtag || !tagId) {
@@ -1025,17 +1031,21 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1025
1031
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
1026
1032
  if (conversionLabel) {
1027
1033
  const isDataManager = manifestVariables['apiVersion'] === '2';
1028
- /*
1029
- * On v2 the browser is the primary source of user data: Google now accepts
1030
- * user-provided data from the tag, Data Manager and the API at once, so
1031
- * there is no adjustment upload to attach it server-side. Consent is
1032
- * handled by Consent Mode — `init` sets ad_user_data/ad_personalization
1033
- * from the user's consent, and gtag withholds user data when they're denied.
1034
- */
1035
- if ((isDataManager ||
1036
- manifestVariables['enhancedConversionsSetting'] === 'gtag') &&
1037
- destination) {
1038
- 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
+ }
1039
1049
  }
1040
1050
  const cartData = getCartData(manifestVariables, data);
1041
1051
  const fireConversion = (isNewCustomer) => {
package/index.js CHANGED
@@ -51,6 +51,9 @@ var ProvidersGoogleAdsClicksSdk = (function () {
51
51
  * Keep this list in sync with `defaultParams` in queryParams.ts when new
52
52
  * click ID providers are added.
53
53
  */
54
+ // One limit for the Customers.ai mmuid / search tokens everywhere they are
55
+ // handled: the smblead SDK capture hook, EdgeLake emission, and the smblead
56
+ // webhook ingestion/emission (the app cannot import provider config libs).
54
57
  const CLICK_IDS = [
55
58
  { param: 'fbclid', label: 'Facebook' }, // Facebook Ads
56
59
  { param: 'gclid', label: 'Google' }, // Google Ads (click)
@@ -909,7 +912,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
909
912
  }
910
913
  };
911
914
  const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
912
- var _a, _b, _c, _d, _e, _f, _g, _h;
915
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
913
916
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
914
917
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
915
918
  if (typeof window === 'undefined' ||
@@ -924,9 +927,12 @@ var ProvidersGoogleAdsClicksSdk = (function () {
924
927
  if (resolvedPageUrl) {
925
928
  customConfig['page_location'] = resolvedPageUrl;
926
929
  }
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') {
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) {
930
936
  customConfig['allow_enhanced_conversions'] = true;
931
937
  }
932
938
  window.dataLayer = window.dataLayer || [];
@@ -938,7 +944,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
938
944
  };
939
945
  if (!window.google_tag_manager ||
940
946
  !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']);
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']);
942
948
  }
943
949
  if (window.gtag) {
944
950
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -1007,7 +1013,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
1007
1013
  var _a, _b;
1008
1014
  const result = {
1009
1015
  isFired: false,
1010
- sdkVersion: "1.69.1" ,
1016
+ sdkVersion: "1.70.0" ,
1011
1017
  };
1012
1018
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1013
1019
  if (!eventName || !window.gtag || !tagId) {
@@ -1026,17 +1032,21 @@ var ProvidersGoogleAdsClicksSdk = (function () {
1026
1032
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
1027
1033
  if (conversionLabel) {
1028
1034
  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));
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
+ }
1040
1050
  }
1041
1051
  const cartData = getCartData(manifestVariables, data);
1042
1052
  const fireConversion = (isNewCustomer) => {
package/index.mjs CHANGED
@@ -48,6 +48,9 @@ const upsert = (map, key, update, createDefault) => {
48
48
  * Keep this list in sync with `defaultParams` in queryParams.ts when new
49
49
  * click ID providers are added.
50
50
  */
51
+ // One limit for the Customers.ai mmuid / search tokens everywhere they are
52
+ // handled: the smblead SDK capture hook, EdgeLake emission, and the smblead
53
+ // webhook ingestion/emission (the app cannot import provider config libs).
51
54
  const CLICK_IDS = [
52
55
  { param: 'fbclid', label: 'Facebook' }, // Facebook Ads
53
56
  { param: 'gclid', label: 'Google' }, // Google Ads (click)
@@ -906,7 +909,7 @@ const initGAds = (ID, consentData, executionContext, consentSkip, sdkUrl) => {
906
909
  }
907
910
  };
908
911
  const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
909
- var _a, _b, _c, _d, _e, _f, _g, _h;
912
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
910
913
  const shouldLoadSDK = ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _a === void 0 ? void 0 : _a['loadSDK']) === '1' ||
911
914
  ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.variables) === null || _b === void 0 ? void 0 : _b['dynamicRemarketingEnabled']) === '1';
912
915
  if (typeof window === 'undefined' ||
@@ -921,9 +924,12 @@ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
921
924
  if (resolvedPageUrl) {
922
925
  customConfig['page_location'] = resolvedPageUrl;
923
926
  }
924
- // v2 always drives enhanced conversions through gtag, so it needs this too.
925
- if (((_e = manifest.variables) === null || _e === void 0 ? void 0 : _e['apiVersion']) === '2' ||
926
- ((_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) {
927
933
  customConfig['allow_enhanced_conversions'] = true;
928
934
  }
929
935
  window.dataLayer = window.dataLayer || [];
@@ -935,7 +941,7 @@ const init = ({ manifest, consentData, executionContext, pageUrl, }) => {
935
941
  };
936
942
  if (!window.google_tag_manager ||
937
943
  !window.google_tag_manager[manifest.variables['tagId']]) {
938
- 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']);
939
945
  }
940
946
  if (window.gtag) {
941
947
  window.gtag('config', manifest.variables['tagId'], customConfig);
@@ -1004,7 +1010,7 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1004
1010
  var _a, _b;
1005
1011
  const result = {
1006
1012
  isFired: false,
1007
- sdkVersion: "1.69.1" ,
1013
+ sdkVersion: "1.70.0" ,
1008
1014
  };
1009
1015
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1010
1016
  if (!eventName || !window.gtag || !tagId) {
@@ -1023,17 +1029,21 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1023
1029
  const conversionLabel = getConversionLabel(eventName, manifestVariables);
1024
1030
  if (conversionLabel) {
1025
1031
  const isDataManager = manifestVariables['apiVersion'] === '2';
1026
- /*
1027
- * On v2 the browser is the primary source of user data: Google now accepts
1028
- * user-provided data from the tag, Data Manager and the API at once, so
1029
- * there is no adjustment upload to attach it server-side. Consent is
1030
- * handled by Consent Mode — `init` sets ad_user_data/ad_personalization
1031
- * from the user's consent, and gtag withholds user data when they're denied.
1032
- */
1033
- if ((isDataManager ||
1034
- manifestVariables['enhancedConversionsSetting'] === 'gtag') &&
1035
- destination) {
1036
- 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
+ }
1037
1047
  }
1038
1048
  const cartData = getCartData(manifestVariables, data);
1039
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.1",
3
+ "version": "1.70.0",
4
4
  "description": "Google Ads Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",