@blotoutio/providers-google-ads-clicks-sdk 1.70.1 → 1.71.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.
package/index.cjs.js CHANGED
@@ -682,6 +682,8 @@ const getEventData = (data, isNewCustomer, eventId) => {
682
682
  }
683
683
  return eventData;
684
684
  };
685
+ // aw_merchant_id and the id/price/quantity items below only report as cart data
686
+ // on Google's `purchase` event, which is why tag.ts renames Purchase.
685
687
  const getCartData = (variables, data) => {
686
688
  const cartData = {};
687
689
  const merchantId = parseInt(variables['merchantId']);
@@ -1012,7 +1014,7 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1012
1014
  var _a, _b;
1013
1015
  const result = {
1014
1016
  isFired: false,
1015
- sdkVersion: "1.70.1" ,
1017
+ sdkVersion: "1.71.0" ,
1016
1018
  };
1017
1019
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1018
1020
  if (!eventName || !window.gtag || !tagId) {
@@ -1085,7 +1087,24 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1085
1087
  if (resolvedPageUrl) {
1086
1088
  conversionPayload['page_location'] = resolvedPageUrl;
1087
1089
  }
1088
- (_a = window.gtag) === null || _a === void 0 ? void 0 : _a.call(window, 'event', 'conversion', conversionPayload);
1090
+ /*
1091
+ * Purchase goes out as `purchase`, which is the event name Google's
1092
+ * conversion-with-cart-data spec requires for the aw_merchant_id/items
1093
+ * payload getCartData builds. Every other event keeps `conversion`.
1094
+ *
1095
+ * v2 only for now. v1 channels keep firing `conversion` so the rename
1096
+ * rolls out with the Data Manager migration instead of changing every
1097
+ * live account at once. Widen this once v2 has proved it out.
1098
+ *
1099
+ * The rename moves nothing else: send_to picks the conversion action, so
1100
+ * the same label credits the same action it always did, and
1101
+ * transaction_id, value and currency are untouched. But `purchase` is a
1102
+ * standard gtag name, unlike `conversion`, so a push without send_to
1103
+ * would fan out to every destination on the page including a GA4 config.
1104
+ * The conversionLabel guard above is what keeps send_to set on all of
1105
+ * these. Do not fire this event outside that guard.
1106
+ */
1107
+ (_a = window.gtag) === null || _a === void 0 ? void 0 : _a.call(window, 'event', isDataManager && eventName === 'Purchase' ? 'purchase' : 'conversion', conversionPayload);
1089
1108
  };
1090
1109
  if (eventName === 'Purchase' &&
1091
1110
  (manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['newCustomerReportingEnabled']) === '1') {
package/index.js CHANGED
@@ -683,6 +683,8 @@ var ProvidersGoogleAdsClicksSdk = (function () {
683
683
  }
684
684
  return eventData;
685
685
  };
686
+ // aw_merchant_id and the id/price/quantity items below only report as cart data
687
+ // on Google's `purchase` event, which is why tag.ts renames Purchase.
686
688
  const getCartData = (variables, data) => {
687
689
  const cartData = {};
688
690
  const merchantId = parseInt(variables['merchantId']);
@@ -1013,7 +1015,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
1013
1015
  var _a, _b;
1014
1016
  const result = {
1015
1017
  isFired: false,
1016
- sdkVersion: "1.70.1" ,
1018
+ sdkVersion: "1.71.0" ,
1017
1019
  };
1018
1020
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1019
1021
  if (!eventName || !window.gtag || !tagId) {
@@ -1086,7 +1088,24 @@ var ProvidersGoogleAdsClicksSdk = (function () {
1086
1088
  if (resolvedPageUrl) {
1087
1089
  conversionPayload['page_location'] = resolvedPageUrl;
1088
1090
  }
1089
- (_a = window.gtag) === null || _a === void 0 ? void 0 : _a.call(window, 'event', 'conversion', conversionPayload);
1091
+ /*
1092
+ * Purchase goes out as `purchase`, which is the event name Google's
1093
+ * conversion-with-cart-data spec requires for the aw_merchant_id/items
1094
+ * payload getCartData builds. Every other event keeps `conversion`.
1095
+ *
1096
+ * v2 only for now. v1 channels keep firing `conversion` so the rename
1097
+ * rolls out with the Data Manager migration instead of changing every
1098
+ * live account at once. Widen this once v2 has proved it out.
1099
+ *
1100
+ * The rename moves nothing else: send_to picks the conversion action, so
1101
+ * the same label credits the same action it always did, and
1102
+ * transaction_id, value and currency are untouched. But `purchase` is a
1103
+ * standard gtag name, unlike `conversion`, so a push without send_to
1104
+ * would fan out to every destination on the page including a GA4 config.
1105
+ * The conversionLabel guard above is what keeps send_to set on all of
1106
+ * these. Do not fire this event outside that guard.
1107
+ */
1108
+ (_a = window.gtag) === null || _a === void 0 ? void 0 : _a.call(window, 'event', isDataManager && eventName === 'Purchase' ? 'purchase' : 'conversion', conversionPayload);
1090
1109
  };
1091
1110
  if (eventName === 'Purchase' &&
1092
1111
  (manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['newCustomerReportingEnabled']) === '1') {
package/index.mjs CHANGED
@@ -680,6 +680,8 @@ const getEventData = (data, isNewCustomer, eventId) => {
680
680
  }
681
681
  return eventData;
682
682
  };
683
+ // aw_merchant_id and the id/price/quantity items below only report as cart data
684
+ // on Google's `purchase` event, which is why tag.ts renames Purchase.
683
685
  const getCartData = (variables, data) => {
684
686
  const cartData = {};
685
687
  const merchantId = parseInt(variables['merchantId']);
@@ -1010,7 +1012,7 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1010
1012
  var _a, _b;
1011
1013
  const result = {
1012
1014
  isFired: false,
1013
- sdkVersion: "1.70.1" ,
1015
+ sdkVersion: "1.71.0" ,
1014
1016
  };
1015
1017
  const tagId = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['tagId'];
1016
1018
  if (!eventName || !window.gtag || !tagId) {
@@ -1083,7 +1085,24 @@ const tag = ({ data, eventName, eventId, manifestVariables, destination, pageUrl
1083
1085
  if (resolvedPageUrl) {
1084
1086
  conversionPayload['page_location'] = resolvedPageUrl;
1085
1087
  }
1086
- (_a = window.gtag) === null || _a === void 0 ? void 0 : _a.call(window, 'event', 'conversion', conversionPayload);
1088
+ /*
1089
+ * Purchase goes out as `purchase`, which is the event name Google's
1090
+ * conversion-with-cart-data spec requires for the aw_merchant_id/items
1091
+ * payload getCartData builds. Every other event keeps `conversion`.
1092
+ *
1093
+ * v2 only for now. v1 channels keep firing `conversion` so the rename
1094
+ * rolls out with the Data Manager migration instead of changing every
1095
+ * live account at once. Widen this once v2 has proved it out.
1096
+ *
1097
+ * The rename moves nothing else: send_to picks the conversion action, so
1098
+ * the same label credits the same action it always did, and
1099
+ * transaction_id, value and currency are untouched. But `purchase` is a
1100
+ * standard gtag name, unlike `conversion`, so a push without send_to
1101
+ * would fan out to every destination on the page including a GA4 config.
1102
+ * The conversionLabel guard above is what keeps send_to set on all of
1103
+ * these. Do not fire this event outside that guard.
1104
+ */
1105
+ (_a = window.gtag) === null || _a === void 0 ? void 0 : _a.call(window, 'event', isDataManager && eventName === 'Purchase' ? 'purchase' : 'conversion', conversionPayload);
1087
1106
  };
1088
1107
  if (eventName === 'Purchase' &&
1089
1108
  (manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['newCustomerReportingEnabled']) === '1') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-google-ads-clicks-sdk",
3
- "version": "1.70.1",
3
+ "version": "1.71.0",
4
4
  "description": "Google Ads Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",