@segment/action-destinations 3.77.1-alpha.0 → 3.77.1-alpha.10
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/dist/destinations/amplitude/index.js +10 -2
- package/dist/destinations/amplitude/index.js.map +1 -1
- package/dist/destinations/amplitude/logEvent/generated-types.d.ts +0 -1
- package/dist/destinations/amplitude/logEvent/index.d.ts +1 -1
- package/dist/destinations/amplitude/logEvent/index.js +21 -31
- package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
- package/dist/destinations/amplitude/logPurchase/generated-types.d.ts +64 -0
- package/dist/destinations/amplitude/logPurchase/generated-types.js +3 -0
- package/dist/destinations/amplitude/logPurchase/generated-types.js.map +1 -0
- package/dist/destinations/amplitude/logPurchase/index.d.ts +13 -0
- package/dist/destinations/amplitude/logPurchase/index.js +216 -0
- package/dist/destinations/amplitude/logPurchase/index.js.map +1 -0
- package/dist/destinations/google-analytics-4/addPaymentInfo/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js +5 -20
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/addToCart/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/addToCart/index.js +4 -15
- package/dist/destinations/google-analytics-4/addToCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/addToWishlist/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/addToWishlist/index.js +5 -21
- package/dist/destinations/google-analytics-4/addToWishlist/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/beginCheckout/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/beginCheckout/index.js +4 -15
- package/dist/destinations/google-analytics-4/beginCheckout/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/customEvent/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/customEvent/index.js +4 -1
- package/dist/destinations/google-analytics-4/customEvent/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-functions.d.ts +6 -0
- package/dist/destinations/google-analytics-4/ga4-functions.js +68 -1
- package/dist/destinations/google-analytics-4/ga4-functions.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-properties.d.ts +1 -0
- package/dist/destinations/google-analytics-4/ga4-properties.js +13 -1
- package/dist/destinations/google-analytics-4/ga4-properties.js.map +1 -1
- package/dist/destinations/google-analytics-4/generateLead/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/generateLead/index.js +3 -1
- package/dist/destinations/google-analytics-4/generateLead/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/login/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/login/index.js +4 -1
- package/dist/destinations/google-analytics-4/login/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/pageView/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/pageView/index.js +4 -1
- package/dist/destinations/google-analytics-4/pageView/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/purchase/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/purchase/index.js +4 -15
- package/dist/destinations/google-analytics-4/purchase/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/refund/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/refund/index.js +5 -21
- package/dist/destinations/google-analytics-4/refund/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/removeFromCart/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/removeFromCart/index.js +5 -21
- package/dist/destinations/google-analytics-4/removeFromCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/search/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/search/index.js +4 -1
- package/dist/destinations/google-analytics-4/search/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/selectItem/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/selectItem/index.js +4 -15
- package/dist/destinations/google-analytics-4/selectItem/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/selectPromotion/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/selectPromotion/index.js +4 -18
- package/dist/destinations/google-analytics-4/selectPromotion/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/signUp/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/signUp/index.js +4 -1
- package/dist/destinations/google-analytics-4/signUp/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewCart/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/viewCart/index.js +5 -21
- package/dist/destinations/google-analytics-4/viewCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewItem/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/viewItem/index.js +4 -27
- package/dist/destinations/google-analytics-4/viewItem/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewItemList/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/viewItemList/index.js +4 -15
- package/dist/destinations/google-analytics-4/viewItemList/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewPromotion/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/viewPromotion/index.js +4 -15
- package/dist/destinations/google-analytics-4/viewPromotion/index.js.map +1 -1
- package/dist/destinations/google-sheets/postSheet/index.js +4 -4
- package/dist/destinations/google-sheets/postSheet/index.js.map +1 -1
- package/dist/destinations/google-sheets/postSheet/operations.js +3 -3
- package/dist/destinations/google-sheets/postSheet/operations.js.map +1 -1
- package/dist/destinations/personas-messaging-twilio/generated-types.d.ts +1 -0
- package/dist/destinations/personas-messaging-twilio/index.js +10 -2
- package/dist/destinations/personas-messaging-twilio/index.js.map +1 -1
- package/dist/destinations/personas-messaging-twilio/sendSms/index.js +3 -1
- package/dist/destinations/personas-messaging-twilio/sendSms/index.js.map +1 -1
- package/dist/destinations/salesforce/lead/index.js +7 -0
- package/dist/destinations/salesforce/lead/index.js.map +1 -1
- package/dist/destinations/salesforce/sf-operations.d.ts +1 -1
- package/dist/destinations/salesforce/sf-operations.js +0 -3
- package/dist/destinations/salesforce/sf-operations.js.map +1 -1
- package/dist/destinations/salesforce/sf-utils.js +4 -6
- package/dist/destinations/salesforce/sf-utils.js.map +1 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js +1 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js.map +1 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +1 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const ga4_functions_1 = require("../ga4-functions");
|
|
5
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
6
5
|
const action = {
|
|
@@ -10,6 +9,7 @@ const action = {
|
|
|
10
9
|
fields: {
|
|
11
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
12
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
13
|
currency: { ...ga4_properties_1.currency },
|
|
14
14
|
transaction_id: { ...ga4_properties_1.transaction_id, required: true },
|
|
15
15
|
value: { ...ga4_properties_1.value, default: { '@path': '$.properties.total' } },
|
|
@@ -32,29 +32,13 @@ const action = {
|
|
|
32
32
|
if (payload.currency) {
|
|
33
33
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
throw new actions_core_1.IntegrationError('Currency is required if value is set.', 'Misconfigured required field', 400);
|
|
37
|
-
}
|
|
38
|
-
if (payload.currency === undefined && (!payload.items || !payload.items[0] || !payload.items[0].currency)) {
|
|
39
|
-
throw new actions_core_1.IntegrationError('One of item-level currency or top-level currency is required.', 'Misconfigured required field', 400);
|
|
40
|
-
}
|
|
41
|
-
let googleItems = [];
|
|
42
|
-
if (payload.items) {
|
|
43
|
-
googleItems = payload.items.map((product) => {
|
|
44
|
-
if (product.item_name === undefined && product.item_id === undefined) {
|
|
45
|
-
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
46
|
-
}
|
|
47
|
-
if (product.currency) {
|
|
48
|
-
ga4_functions_1.verifyCurrency(product.currency);
|
|
49
|
-
}
|
|
50
|
-
return product;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
35
|
+
ga4_functions_1.checkCurrencyDefinition(payload.value, payload.currency, payload.items);
|
|
53
36
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
54
37
|
method: 'POST',
|
|
55
38
|
json: {
|
|
56
39
|
client_id: payload.client_id,
|
|
57
40
|
user_id: payload.user_id,
|
|
41
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
58
42
|
events: [
|
|
59
43
|
{
|
|
60
44
|
name: 'refund',
|
|
@@ -66,9 +50,9 @@ const action = {
|
|
|
66
50
|
coupon: payload.coupon,
|
|
67
51
|
shipping: payload.shipping,
|
|
68
52
|
tax: payload.tax,
|
|
69
|
-
items:
|
|
53
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
70
54
|
engagement_time_msec: payload.engagement_time_msec,
|
|
71
|
-
...payload.params
|
|
55
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
72
56
|
}
|
|
73
57
|
}
|
|
74
58
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/refund/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/refund/index.ts"],"names":[],"mappings":";;AACA,oDAAuH;AACvH,sDAe0B;AAI1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,oCAAoC;IACjD,mBAAmB,EAAE,6CAA6C;IAClE,MAAM,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Q;wBACd,MAAM,EAAE;4BACN,QAAQ,EAAE,OAAO,CAAC,QAAQ;4BAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;4BACtC,KAAK,EAAE,OAAO,CAAC,KAAK;4BACpB,WAAW,EAAE,OAAO,CAAC,WAAW;4BAChC,MAAM,EAAE,OAAO,CAAC,MAAM;4BACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;4BAC1B,GAAG,EAAE,OAAO,CAAC,GAAG;4BAChB,KAAK,EAAE,2BAAW,CAAC,OAAO,CAAC,KAAK,CAAC;4BACjC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC;yBAChC;qBACF;iBACF;gBACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;aACjD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const ga4_functions_1 = require("../ga4-functions");
|
|
5
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
6
5
|
const action = {
|
|
@@ -10,6 +9,7 @@ const action = {
|
|
|
10
9
|
fields: {
|
|
11
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
12
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
13
|
currency: { ...ga4_properties_1.currency },
|
|
14
14
|
value: { ...ga4_properties_1.value },
|
|
15
15
|
items: {
|
|
@@ -24,38 +24,22 @@ const action = {
|
|
|
24
24
|
if (payload.currency) {
|
|
25
25
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
throw new actions_core_1.IntegrationError('Currency is required if value is set.', 'Misconfigured required field', 400);
|
|
29
|
-
}
|
|
30
|
-
if (payload.currency === undefined && (!payload.items || !payload.items[0] || !payload.items[0].currency)) {
|
|
31
|
-
throw new actions_core_1.IntegrationError('One of item-level currency or top-level currency is required.', 'Misconfigured required field', 400);
|
|
32
|
-
}
|
|
33
|
-
let googleItems = [];
|
|
34
|
-
if (payload.items) {
|
|
35
|
-
googleItems = payload.items.map((product) => {
|
|
36
|
-
if (product.item_name === undefined && product.item_id === undefined) {
|
|
37
|
-
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
38
|
-
}
|
|
39
|
-
if (product.currency) {
|
|
40
|
-
ga4_functions_1.verifyCurrency(product.currency);
|
|
41
|
-
}
|
|
42
|
-
return product;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
27
|
+
ga4_functions_1.checkCurrencyDefinition(payload.value, payload.currency, payload.items);
|
|
45
28
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
46
29
|
method: 'POST',
|
|
47
30
|
json: {
|
|
48
31
|
client_id: payload.client_id,
|
|
49
32
|
user_id: payload.user_id,
|
|
33
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
50
34
|
events: [
|
|
51
35
|
{
|
|
52
36
|
name: 'remove_from_cart',
|
|
53
37
|
params: {
|
|
54
38
|
currency: payload.currency,
|
|
55
39
|
value: payload.value,
|
|
56
|
-
items:
|
|
40
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
57
41
|
engagement_time_msec: payload.engagement_time_msec,
|
|
58
|
-
...payload.params
|
|
42
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
59
43
|
}
|
|
60
44
|
}
|
|
61
45
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/removeFromCart/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/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,OAAO,CAAC,KAAK,CAAC;4BACjC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC;yBAChC;qBACF;iBACF;gBACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;aACjD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ga4_functions_1 = require("../ga4-functions");
|
|
3
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
4
5
|
const action = {
|
|
5
6
|
title: 'Search',
|
|
@@ -8,6 +9,7 @@ const action = {
|
|
|
8
9
|
fields: {
|
|
9
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
10
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
11
13
|
search_term: {
|
|
12
14
|
label: 'Search Term',
|
|
13
15
|
type: 'string',
|
|
@@ -27,13 +29,14 @@ const action = {
|
|
|
27
29
|
json: {
|
|
28
30
|
client_id: payload.client_id,
|
|
29
31
|
user_id: payload.user_id,
|
|
32
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
30
33
|
events: [
|
|
31
34
|
{
|
|
32
35
|
name: 'search',
|
|
33
36
|
params: {
|
|
34
37
|
search_term: payload.search_term,
|
|
35
38
|
engagement_time_msec: payload.engagement_time_msec,
|
|
36
|
-
...payload.params
|
|
39
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/search/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/search/index.ts"],"names":[],"mappings":";;AAGA,oDAAiE;AACjE,sDAQ0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,8CAA8C;IAC3D,mBAAmB,EAAE,gDAAgD;IACrE,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,oBAAoB;aAC9B;SACF;QACD,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EAAE,qCAAoB;QAC1C,MAAM,EAAE,uBAAM;KACf;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,gBAAgB,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC;gBAC5D,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,QAAQ;wBACd,MAAM,EAAE;4BACN,WAAW,EAAE,OAAO,CAAC,WAAW;4BAChC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC;yBAChC;qBACF;iBACF;gBACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;aACjD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const ga4_functions_1 = require("../ga4-functions");
|
|
5
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
6
5
|
const action = {
|
|
@@ -10,6 +9,7 @@ const action = {
|
|
|
10
9
|
fields: {
|
|
11
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
12
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
13
|
item_list_name: {
|
|
14
14
|
label: 'Item List Name',
|
|
15
15
|
description: 'The name of the list in which the item was presented to the user.',
|
|
@@ -29,32 +29,21 @@ const action = {
|
|
|
29
29
|
params: ga4_properties_1.params
|
|
30
30
|
},
|
|
31
31
|
perform: (request, { payload }) => {
|
|
32
|
-
let googleItems = [];
|
|
33
|
-
if (payload.items) {
|
|
34
|
-
googleItems = payload.items.map((product) => {
|
|
35
|
-
if (product.item_name === undefined && product.item_id === undefined) {
|
|
36
|
-
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
37
|
-
}
|
|
38
|
-
if (product.currency) {
|
|
39
|
-
ga4_functions_1.verifyCurrency(product.currency);
|
|
40
|
-
}
|
|
41
|
-
return product;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
32
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
45
33
|
method: 'POST',
|
|
46
34
|
json: {
|
|
47
35
|
client_id: payload.client_id,
|
|
48
36
|
user_id: payload.user_id,
|
|
37
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
49
38
|
events: [
|
|
50
39
|
{
|
|
51
40
|
name: 'select_item',
|
|
52
41
|
params: {
|
|
53
|
-
items:
|
|
42
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
54
43
|
item_list_name: payload.item_list_name,
|
|
55
44
|
item_list_id: payload.item_list_id,
|
|
56
45
|
engagement_time_msec: payload.engagement_time_msec,
|
|
57
|
-
...payload.params
|
|
46
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
58
47
|
}
|
|
59
48
|
}
|
|
60
49
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/selectItem/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/selectItem/index.ts"],"names":[],"mappings":";;AACA,oDAA8E;AAG9E,sDAS0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,oDAAoD;IACjE,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,cAAc,EAAE;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,mEAAmE;YAChF,IAAI,EAAE,QAAQ;SACf;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,iEAAiE;YAC9E,IAAI,EAAE,QAAQ;SACf;QACD,KAAK,EAAE;YACL,GAAG,sCAAqB;YACxB,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EAAE,qCAAoB;QAC1C,MAAM,EAAE,uBAAM;KACf;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,gBAAgB,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC;gBAC5D,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,aAAa;wBACnB,MAAM,EAAE;4BACN,KAAK,EAAE,2BAAW,CAAC,OAAO,CAAC,KAAK,CAAC;4BACjC,cAAc,EAAE,OAAO,CAAC,cAAc;4BACtC,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC;yBAChC;qBACF;iBACF;gBACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;aACjD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const ga4_functions_1 = require("../ga4-functions");
|
|
5
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
6
5
|
const action = {
|
|
@@ -10,6 +9,7 @@ const action = {
|
|
|
10
9
|
fields: {
|
|
11
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
12
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
13
|
creative_name: { ...ga4_properties_1.creative_name },
|
|
14
14
|
creative_slot: { ...ga4_properties_1.creative_slot, default: { '@path': '$.properties.creative' } },
|
|
15
15
|
location_id: {
|
|
@@ -42,26 +42,12 @@ const action = {
|
|
|
42
42
|
params: ga4_properties_1.params
|
|
43
43
|
},
|
|
44
44
|
perform: (request, { payload }) => {
|
|
45
|
-
let googleItems = [];
|
|
46
|
-
if (payload.items) {
|
|
47
|
-
googleItems = payload.items.map((product) => {
|
|
48
|
-
if (product.item_name === undefined && product.item_id === undefined) {
|
|
49
|
-
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
50
|
-
}
|
|
51
|
-
if (product.currency) {
|
|
52
|
-
ga4_functions_1.verifyCurrency(product.currency);
|
|
53
|
-
}
|
|
54
|
-
if (product.promotion_id === undefined && product.promotion_name === undefined) {
|
|
55
|
-
throw new actions_core_1.IntegrationError('One of promotion name or promotion id is required.', 'Misconfigured required field', 400);
|
|
56
|
-
}
|
|
57
|
-
return product;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
45
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
61
46
|
method: 'POST',
|
|
62
47
|
json: {
|
|
63
48
|
client_id: payload.client_id,
|
|
64
49
|
user_id: payload.user_id,
|
|
50
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
65
51
|
events: [
|
|
66
52
|
{
|
|
67
53
|
name: 'select_promotion',
|
|
@@ -71,9 +57,9 @@ const action = {
|
|
|
71
57
|
location_id: payload.location_id,
|
|
72
58
|
promotion_id: payload.promotion_id,
|
|
73
59
|
promotion_name: payload.promotion_name,
|
|
74
|
-
items:
|
|
60
|
+
items: ga4_functions_1.formatPromotionItems(payload.items),
|
|
75
61
|
engagement_time_msec: payload.engagement_time_msec,
|
|
76
|
-
...payload.params
|
|
62
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
77
63
|
}
|
|
78
64
|
}
|
|
79
65
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/selectPromotion/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/selectPromotion/index.ts"],"names":[],"mappings":";;AACA,oDAAuF;AACvF,sDAc0B;AAI1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;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,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC;gBAC5D,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,kBAAkB;wBACxB,MAAM,EAAE;4BACN,aAAa,EAAE,OAAO,CAAC,aAAa;4BACpC,aAAa,EAAE,OAAO,CAAC,aAAa;4BACpC,WAAW,EAAE,OAAO,CAAC,WAAW;4BAChC,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,cAAc,EAAE,OAAO,CAAC,cAAc;4BACtC,KAAK,EAAE,oCAAoB,CAAC,OAAO,CAAC,KAAK,CAAC;4BAC1C,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC;yBAChC;qBACF;iBACF;gBACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;aACjD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ga4_functions_1 = require("../ga4-functions");
|
|
3
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
4
5
|
const action = {
|
|
5
6
|
title: 'Sign Up',
|
|
@@ -8,6 +9,7 @@ const action = {
|
|
|
8
9
|
fields: {
|
|
9
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
10
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
11
13
|
method: {
|
|
12
14
|
label: 'Method',
|
|
13
15
|
description: 'The method used for sign up.',
|
|
@@ -26,13 +28,14 @@ const action = {
|
|
|
26
28
|
json: {
|
|
27
29
|
client_id: payload.client_id,
|
|
28
30
|
user_id: payload.user_id,
|
|
31
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
29
32
|
events: [
|
|
30
33
|
{
|
|
31
34
|
name: 'sign_up',
|
|
32
35
|
params: {
|
|
33
36
|
method: payload.method,
|
|
34
37
|
engagement_time_msec: payload.engagement_time_msec,
|
|
35
|
-
...payload.params
|
|
38
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/signUp/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/signUp/index.ts"],"names":[],"mappings":";;AAGA,oDAAiE;AACjE,sDAQ0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,kFAAkF;IAC/F,mBAAmB,EAAE,wCAAwC;IAC7D,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,8BAA8B;YAC3C,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mBAAmB;aAC7B;SACF;QACD,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EAAE,qCAAoB;QAC1C,MAAM,EAAE,uBAAM;KACf;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,gBAAgB,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC;gBAC5D,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,SAAS;wBACf,MAAM,EAAE;4BACN,MAAM,EAAE,OAAO,CAAC,MAAM;4BACtB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC;yBAChC;qBACF;iBACF;gBACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;aACjD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const ga4_functions_1 = require("../ga4-functions");
|
|
5
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
6
5
|
const action = {
|
|
@@ -10,6 +9,7 @@ const action = {
|
|
|
10
9
|
fields: {
|
|
11
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
12
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
13
|
currency: { ...ga4_properties_1.currency },
|
|
14
14
|
value: { ...ga4_properties_1.value },
|
|
15
15
|
items: {
|
|
@@ -24,38 +24,22 @@ const action = {
|
|
|
24
24
|
if (payload.currency) {
|
|
25
25
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
throw new actions_core_1.IntegrationError('Currency is required if value is set.', 'Misconfigured required field', 400);
|
|
29
|
-
}
|
|
30
|
-
if (payload.currency === undefined && (!payload.items || !payload.items[0] || !payload.items[0].currency)) {
|
|
31
|
-
throw new actions_core_1.IntegrationError('One of item-level currency or top-level currency is required.', 'Misconfigured required field', 400);
|
|
32
|
-
}
|
|
33
|
-
let googleItems = [];
|
|
34
|
-
if (payload.items) {
|
|
35
|
-
googleItems = payload.items.map((product) => {
|
|
36
|
-
if (product.item_name === undefined && product.item_id === undefined) {
|
|
37
|
-
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
38
|
-
}
|
|
39
|
-
if (product.currency) {
|
|
40
|
-
ga4_functions_1.verifyCurrency(product.currency);
|
|
41
|
-
}
|
|
42
|
-
return product;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
27
|
+
ga4_functions_1.checkCurrencyDefinition(payload.value, payload.currency, payload.items);
|
|
45
28
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
46
29
|
method: 'POST',
|
|
47
30
|
json: {
|
|
48
31
|
client_id: payload.client_id,
|
|
49
32
|
user_id: payload.user_id,
|
|
33
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
50
34
|
events: [
|
|
51
35
|
{
|
|
52
36
|
name: 'view_cart',
|
|
53
37
|
params: {
|
|
54
38
|
currency: payload.currency,
|
|
55
39
|
value: payload.value,
|
|
56
|
-
items:
|
|
40
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
57
41
|
engagement_time_msec: payload.engagement_time_msec,
|
|
58
|
-
...payload.params
|
|
42
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
59
43
|
}
|
|
60
44
|
}
|
|
61
45
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/viewCart/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/viewCart/index.ts"],"names":[],"mappings":";;AACA,oDAAuH;AACvH,sDAW0B;AAI1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,yCAAyC;IACtD,mBAAmB,EAAE,0CAA0C;IAC/D,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,E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@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const ga4_functions_1 = require("../ga4-functions");
|
|
5
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
6
5
|
const action = {
|
|
@@ -10,6 +9,7 @@ const action = {
|
|
|
10
9
|
fields: {
|
|
11
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
12
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
13
|
currency: { ...ga4_properties_1.currency },
|
|
14
14
|
value: { ...ga4_properties_1.value },
|
|
15
15
|
items: {
|
|
@@ -24,44 +24,21 @@ const action = {
|
|
|
24
24
|
if (payload.currency) {
|
|
25
25
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
26
26
|
}
|
|
27
|
-
let googleItems = [];
|
|
28
|
-
if (payload.items) {
|
|
29
|
-
googleItems = payload.items.map((product) => {
|
|
30
|
-
if (product.item_name === undefined && product.item_id === undefined) {
|
|
31
|
-
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
32
|
-
}
|
|
33
|
-
if (product.currency) {
|
|
34
|
-
ga4_functions_1.verifyCurrency(product.currency);
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
item_id: product.item_id,
|
|
38
|
-
item_name: product.item_name,
|
|
39
|
-
quantity: product.quantity,
|
|
40
|
-
affiliation: product.affiliation,
|
|
41
|
-
coupon: product.coupon,
|
|
42
|
-
discount: product.discount,
|
|
43
|
-
item_brand: product.item_brand,
|
|
44
|
-
item_category: product.item_category,
|
|
45
|
-
item_variant: product.item_variant,
|
|
46
|
-
price: product.price,
|
|
47
|
-
currency: product.currency
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
27
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
52
28
|
method: 'POST',
|
|
53
29
|
json: {
|
|
54
30
|
client_id: payload.client_id,
|
|
55
31
|
user_id: payload.user_id,
|
|
32
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
56
33
|
events: [
|
|
57
34
|
{
|
|
58
35
|
name: 'view_item',
|
|
59
36
|
params: {
|
|
60
37
|
currency: payload.currency,
|
|
61
|
-
items:
|
|
38
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
62
39
|
value: payload.value,
|
|
63
40
|
engagement_time_msec: payload.engagement_time_msec,
|
|
64
|
-
...payload.params
|
|
41
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
65
42
|
}
|
|
66
43
|
}
|
|
67
44
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/viewItem/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/viewItem/index.ts"],"names":[],"mappings":";;AACA,oDAA8F;AAC9F,sDAW0B;AAI1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,sCAAsC;IACnD,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,QAAQ,EAAE,EAAE,GAAG,yBAAQ,EAAE;QACzB,KAAK,EAAE,EAAE,GAAG,sBAAK,EAAE;QACnB,KAAK,EAAE;YACL,GAAG,sCAAqB;YACxB,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EAAE,qCAAoB;QAC1C,MAAM,EAAE,uBAAM;KACf;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,8BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;SACjC;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,gBAAgB,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC;gBAC5D,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE;4BACN,QAAQ,EAAE,OAAO,CAAC,QAAQ;4BAC1B,KAAK,EAAE,2BAAW,CAAC,OAAO,CAAC,KAAK,CAAC;4BACjC,KAAK,EAAE,OAAO,CAAC,KAAK;4BACpB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC;yBAChC;qBACF;iBACF;gBACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;aACjD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const ga4_functions_1 = require("../ga4-functions");
|
|
5
4
|
const ga4_properties_1 = require("../ga4-properties");
|
|
6
5
|
const action = {
|
|
@@ -10,6 +9,7 @@ const action = {
|
|
|
10
9
|
fields: {
|
|
11
10
|
client_id: { ...ga4_properties_1.client_id },
|
|
12
11
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
13
|
item_list_id: {
|
|
14
14
|
label: 'Item List ID',
|
|
15
15
|
type: 'string',
|
|
@@ -35,32 +35,21 @@ const action = {
|
|
|
35
35
|
params: ga4_properties_1.params
|
|
36
36
|
},
|
|
37
37
|
perform: (request, { payload }) => {
|
|
38
|
-
let googleItems = [];
|
|
39
|
-
if (payload.items) {
|
|
40
|
-
googleItems = payload.items.map((product) => {
|
|
41
|
-
if (product.item_name === undefined && product.item_id === undefined) {
|
|
42
|
-
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
43
|
-
}
|
|
44
|
-
if (product.currency) {
|
|
45
|
-
ga4_functions_1.verifyCurrency(product.currency);
|
|
46
|
-
}
|
|
47
|
-
return product;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
38
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
51
39
|
method: 'POST',
|
|
52
40
|
json: {
|
|
53
41
|
client_id: payload.client_id,
|
|
54
42
|
user_id: payload.user_id,
|
|
43
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
55
44
|
events: [
|
|
56
45
|
{
|
|
57
46
|
name: 'view_item_list',
|
|
58
47
|
params: {
|
|
59
48
|
item_list_id: payload.item_list_id,
|
|
60
49
|
item_list_name: payload.item_list_name,
|
|
61
|
-
items:
|
|
50
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
62
51
|
engagement_time_msec: payload.engagement_time_msec,
|
|
63
|
-
...payload.params
|
|
52
|
+
...ga4_functions_1.verifyParams(payload.params)
|
|
64
53
|
}
|
|
65
54
|
}
|
|
66
55
|
],
|