@segment/action-destinations 3.76.1-alpha.4 → 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/logEvent/index.js +20 -1
- package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
- package/dist/destinations/amplitude/logPurchase/index.js +21 -2
- package/dist/destinations/amplitude/logPurchase/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/addPaymentInfo/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js +4 -19
- 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 +3 -14
- 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 +4 -20
- 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 +3 -14
- 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 +2 -0
- package/dist/destinations/google-analytics-4/customEvent/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-functions.d.ts +5 -0
- package/dist/destinations/google-analytics-4/ga4-functions.js +58 -3
- 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 +11 -3
- 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 +2 -0
- 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 +2 -0
- 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 +2 -0
- 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 +3 -14
- 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 +4 -20
- 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 +4 -20
- 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 +2 -0
- 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 +3 -14
- 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 +3 -17
- 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 +2 -0
- 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 +4 -20
- 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 +3 -26
- 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 +3 -14
- 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 +3 -14
- package/dist/destinations/google-analytics-4/viewPromotion/index.js.map +1 -1
- package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.js +53 -32
- package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.js.map +1 -1
- package/dist/destinations/salesforce/lead/index.js +1 -2
- package/dist/destinations/salesforce/lead/index.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 -4
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
- package/package.json +4 -4
|
@@ -51,7 +51,26 @@ const action = {
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
default: {
|
|
54
|
-
'@
|
|
54
|
+
'@arrayPath': [
|
|
55
|
+
'$.properties.products',
|
|
56
|
+
{
|
|
57
|
+
price: {
|
|
58
|
+
'@path': 'price'
|
|
59
|
+
},
|
|
60
|
+
revenue: {
|
|
61
|
+
'@path': 'revenue'
|
|
62
|
+
},
|
|
63
|
+
quantity: {
|
|
64
|
+
'@path': 'quantity'
|
|
65
|
+
},
|
|
66
|
+
productId: {
|
|
67
|
+
'@path': 'productId'
|
|
68
|
+
},
|
|
69
|
+
revenueType: {
|
|
70
|
+
'@path': 'revenueType'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
55
74
|
}
|
|
56
75
|
},
|
|
57
76
|
use_batch_endpoint: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEvent/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA6D;AAC7D,+DAAsC;AACtC,kDAA6C;AAI7C,gCAA6C;AAC7C,0CAAqD;AACrD,oEAA8D;AAC9D,8CAAwD;AACxD,8DAA2D;AAW3D,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;AAChF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,6BAA6B;IAC1C,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,GAAG,0BAAW;QACd,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,iCAAiC;YAC9C,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,+IAA+I;iBAClJ;gBACD,QAAQ,EAAE;oBACR,KAAK,EAAE,UAAU;oBACjB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,qEAAqE;iBACnF;gBACD,OAAO,EAAE;oBACP,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,mMAAmM;iBACtM;gBACD,SAAS,EAAE;oBACT,KAAK,EAAE,YAAY;oBACnB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,sGAAsG;iBACzG;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,cAAc;oBACrB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,4GAA4G;iBAC/G;aACF;YACD,OAAO,EAAE;gBACP,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEvent/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA6D;AAC7D,+DAAsC;AACtC,kDAA6C;AAI7C,gCAA6C;AAC7C,0CAAqD;AACrD,oEAA8D;AAC9D,8CAAwD;AACxD,8DAA2D;AAW3D,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;AAChF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,6BAA6B;IAC1C,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,GAAG,0BAAW;QACd,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,iCAAiC;YAC9C,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,+IAA+I;iBAClJ;gBACD,QAAQ,EAAE;oBACR,KAAK,EAAE,UAAU;oBACjB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,qEAAqE;iBACnF;gBACD,OAAO,EAAE;oBACP,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,mMAAmM;iBACtM;gBACD,SAAS,EAAE;oBACT,KAAK,EAAE,YAAY;oBACnB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,sGAAsG;iBACzG;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,cAAc;oBACrB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,4GAA4G;iBAC/G;aACF;YACD,OAAO,EAAE;gBACP,YAAY,EAAE;oBACZ,uBAAuB;oBACvB;wBACE,KAAK,EAAE;4BACL,OAAO,EAAE,OAAO;yBACjB;wBACD,OAAO,EAAE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
27
|
const action = {
|
|
28
|
-
title: 'Log
|
|
28
|
+
title: 'Log Purchase',
|
|
29
29
|
description: 'Send an event to Amplitude.',
|
|
30
30
|
defaultSubscription: 'type = "track"',
|
|
31
31
|
fields: {
|
|
@@ -69,7 +69,26 @@ const action = {
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
default: {
|
|
72
|
-
'@
|
|
72
|
+
'@arrayPath': [
|
|
73
|
+
'$.properties.products',
|
|
74
|
+
{
|
|
75
|
+
price: {
|
|
76
|
+
'@path': 'price'
|
|
77
|
+
},
|
|
78
|
+
revenue: {
|
|
79
|
+
'@path': 'revenue'
|
|
80
|
+
},
|
|
81
|
+
quantity: {
|
|
82
|
+
'@path': 'quantity'
|
|
83
|
+
},
|
|
84
|
+
productId: {
|
|
85
|
+
'@path': 'productId'
|
|
86
|
+
},
|
|
87
|
+
revenueType: {
|
|
88
|
+
'@path': 'revenueType'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]
|
|
73
92
|
}
|
|
74
93
|
},
|
|
75
94
|
use_batch_endpoint: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logPurchase/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA6D;AAC7D,+DAAsC;AACtC,kDAA6C;AAI7C,gCAA6C;AAC7C,0CAAqD;AACrD,oEAA8D;AAC9D,8CAAwD;AACxD,8DAA2D;AAW3D,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;AAUhF,SAAS,oBAAoB,CAAC,OAAqB;IACjD,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE;QACvC,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,UAAU;QAC9C,QAAQ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AAI,EAAE;gBACJ,OAAO,EAAE,QAAQ,CAAC,MAAM;gBACxB,MAAM;gBACN,OAAO;aACR;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -10,6 +10,7 @@ const action = {
|
|
|
10
10
|
fields: {
|
|
11
11
|
client_id: { ...ga4_properties_1.client_id },
|
|
12
12
|
user_id: { ...ga4_properties_1.user_id },
|
|
13
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
14
|
currency: { ...ga4_properties_1.currency },
|
|
14
15
|
value: { ...ga4_properties_1.value },
|
|
15
16
|
coupon: { ...ga4_properties_1.coupon },
|
|
@@ -29,29 +30,13 @@ const action = {
|
|
|
29
30
|
if (payload.currency) {
|
|
30
31
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
-
throw new actions_core_1.IntegrationError('Currency is required if value is set.', 'Misconfigured required field', 400);
|
|
34
|
-
}
|
|
35
|
-
if (payload.currency === undefined && payload.items[0].currency === undefined) {
|
|
36
|
-
throw new actions_core_1.IntegrationError('One of item-level currency or top-level currency is required.', 'Misconfigured required field', 400);
|
|
37
|
-
}
|
|
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
|
-
}
|
|
33
|
+
ga4_functions_1.checkCurrencyDefinition(payload.value, payload.currency, payload.items);
|
|
50
34
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
51
35
|
method: 'POST',
|
|
52
36
|
json: {
|
|
53
37
|
client_id: payload.client_id,
|
|
54
38
|
user_id: payload.user_id,
|
|
39
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
55
40
|
events: [
|
|
56
41
|
{
|
|
57
42
|
name: 'add_payment_info',
|
|
@@ -60,7 +45,7 @@ const action = {
|
|
|
60
45
|
value: payload.value,
|
|
61
46
|
coupon: payload.coupon,
|
|
62
47
|
payment_type: payload.payment_type,
|
|
63
|
-
items:
|
|
48
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
64
49
|
engagement_time_msec: payload.engagement_time_msec,
|
|
65
50
|
...ga4_functions_1.verifyParams(payload.params)
|
|
66
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addPaymentInfo/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addPaymentInfo/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAG1E,oDAAuH;AACvH,sDAa0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,0DAA0D;IACvE,mBAAmB,EAAE,mDAAmD;IACxE,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,MAAM,EAAE,EAAE,GAAG,uBAAM,EAAE;QACrB,YAAY,EAAE,EAAE,GAAG,6BAAY,EAAE;QACjC,KAAK,EAAE;YACL,GAAG,qCAAoB;YACvB,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EA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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
|
items: {
|
|
15
15
|
...ga4_properties_1.items_single_products,
|
|
@@ -21,32 +21,21 @@ const action = {
|
|
|
21
21
|
params: ga4_properties_1.params
|
|
22
22
|
},
|
|
23
23
|
perform: (request, { payload }) => {
|
|
24
|
-
let googleItems = [];
|
|
25
24
|
if (payload.currency) {
|
|
26
25
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
27
26
|
}
|
|
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 product;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
27
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
40
28
|
method: 'POST',
|
|
41
29
|
json: {
|
|
42
30
|
client_id: payload.client_id,
|
|
43
31
|
user_id: payload.user_id,
|
|
32
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
44
33
|
events: [
|
|
45
34
|
{
|
|
46
35
|
name: 'add_to_cart',
|
|
47
36
|
params: {
|
|
48
37
|
currency: payload.currency,
|
|
49
|
-
items:
|
|
38
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
50
39
|
value: payload.value,
|
|
51
40
|
engagement_time_msec: payload.engagement_time_msec,
|
|
52
41
|
...ga4_functions_1.verifyParams(payload.params)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToCart/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToCart/index.ts"],"names":[],"mappings":";;AAGA,oDAA8F;AAC9F,sDAW0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,6CAA6C;IAC1D,mBAAmB,EAAE,4CAA4C;IACjE,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;YACL,GAAG,sCAAqB;YACxB,QAAQ,EAAE,IAAI;SACf;QACD,KAAK,EAAE,EAAE,GAAG,sBAAK,EAAE;QACnB,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,aAAa;wBACnB,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
|
currency: { ...ga4_properties_1.currency },
|
|
14
14
|
value: { ...ga4_properties_1.value },
|
|
15
15
|
items: {
|
|
@@ -24,36 +24,20 @@ 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: 'add_to_wishlist',
|
|
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
42
|
...ga4_functions_1.verifyParams(payload.params)
|
|
59
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToWishlist/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToWishlist/index.ts"],"names":[],"mappings":";;AAGA,oDAAuH;AACvH,sDAW0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE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D,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
|
coupon: { ...ga4_properties_1.coupon, default: { '@path': '$.properties.coupon' } },
|
|
14
14
|
currency: { ...ga4_properties_1.currency },
|
|
15
15
|
items: {
|
|
@@ -25,30 +25,19 @@ const action = {
|
|
|
25
25
|
if (payload.currency) {
|
|
26
26
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
27
27
|
}
|
|
28
|
-
let googleItems = [];
|
|
29
|
-
if (payload.items) {
|
|
30
|
-
googleItems = payload.items.map((product) => {
|
|
31
|
-
if (product.item_name === undefined && product.item_id === undefined) {
|
|
32
|
-
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
33
|
-
}
|
|
34
|
-
if (product.currency) {
|
|
35
|
-
ga4_functions_1.verifyCurrency(product.currency);
|
|
36
|
-
}
|
|
37
|
-
return product;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
28
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
41
29
|
method: 'POST',
|
|
42
30
|
json: {
|
|
43
31
|
client_id: payload.client_id,
|
|
44
32
|
user_id: payload.user_id,
|
|
33
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
45
34
|
events: [
|
|
46
35
|
{
|
|
47
36
|
name: 'begin_checkout',
|
|
48
37
|
params: {
|
|
49
38
|
coupon: payload.coupon,
|
|
50
39
|
currency: payload.currency,
|
|
51
|
-
items:
|
|
40
|
+
items: ga4_functions_1.formatItems(payload.items),
|
|
52
41
|
value: payload.value,
|
|
53
42
|
engagement_time_msec: payload.engagement_time_msec,
|
|
54
43
|
...ga4_functions_1.verifyParams(payload.params)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/beginCheckout/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/beginCheckout/index.ts"],"names":[],"mappings":";;AACA,oDAA8F;AAC9F,sDAY0B;AAI1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,+CAA+C;IACpE,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,EAAE,GAAG,uBAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,EAAE;QAClE,QAAQ,EAAE,EAAE,GAAG,yBAAQ,EAAE;QAGzB,KAAK,EAAE;YACL,GAAG,qCAAoB;YACvB,QAAQ,EAAE,IAAI;SACf;QACD,KAAK,EAAE,EAAE,GAAG,sBAAK,EAAE;QACnB,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,gBAAgB;wBACtB,MAAM,EAAE;4BACN,MAAM,EAAE,OAAO,CAAC,MAAM;4BACtB,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"}
|
|
@@ -17,6 +17,7 @@ const action = {
|
|
|
17
17
|
fields: {
|
|
18
18
|
clientId: { ...ga4_properties_1.client_id },
|
|
19
19
|
user_id: { ...ga4_properties_1.user_id },
|
|
20
|
+
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
20
21
|
name: {
|
|
21
22
|
label: 'Event Name',
|
|
22
23
|
description: 'The unique name of the custom event created in GA4. GA4 does not accept spaces in event names so Segment will replace any spaces with underscores. More information about GA4 event name rules is available in [their docs](https://support.google.com/analytics/answer/10085872?hl=en&ref_topic=9756175#event-name-rules&zippy=%2Cin-this-article.%2Cin-this-article).',
|
|
@@ -43,6 +44,7 @@ const action = {
|
|
|
43
44
|
json: {
|
|
44
45
|
client_id: payload.clientId,
|
|
45
46
|
user_id: payload.user_id,
|
|
47
|
+
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
46
48
|
events: [
|
|
47
49
|
{
|
|
48
50
|
name: event_name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/customEvent/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/customEvent/index.ts"],"names":[],"mappings":";;AAGA,oDAAiE;AACjE,sDAQ0B;AAE1B,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,SAA8B,EAAU,EAAE;IAClF,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAClB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAE/B,IAAI,SAAS,EAAE;QACb,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;KAC1B;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,uBAAuB;IACpC,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,QAAQ,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC1B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,yWAAyW;YAC3W,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,qZAAqZ;YACvZ,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;QACD,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EAAE,qCAAoB;QAC1C,MAAM,EAAE,EAAE,GAAG,uBAAM,EAAE;KACtB;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QACtE,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,SAAS,EAAE,OAAO,CAAC,QAAQ;gBAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,gBAAgB,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC;gBAC5D,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE;4BACN,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;AACD,kBAAe,MAAM,CAAA"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import { ProductItem, PromotionProductItem } from './ga4-types';
|
|
1
2
|
export declare function verifyCurrency(currency: string): void;
|
|
2
3
|
export declare function verifyParams(params: object | undefined): object | undefined;
|
|
4
|
+
export declare function checkCurrencyDefinition(value: number | undefined, eventCurrency: string | undefined, items: ProductItem[] | undefined): void;
|
|
5
|
+
export declare function convertTimestamp(timestamp: string | undefined): number | undefined;
|
|
6
|
+
export declare function formatItems(items: ProductItem[] | PromotionProductItem[] | undefined): ProductItem[] | PromotionProductItem[] | undefined;
|
|
7
|
+
export declare function formatPromotionItems(items: PromotionProductItem[] | undefined): PromotionProductItem[] | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyParams = exports.verifyCurrency = void 0;
|
|
3
|
+
exports.formatPromotionItems = exports.formatItems = exports.convertTimestamp = exports.checkCurrencyDefinition = exports.verifyParams = exports.verifyCurrency = void 0;
|
|
4
4
|
const actions_core_1 = require("@segment/actions-core");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
6
|
function verifyCurrency(currency) {
|
|
@@ -14,11 +14,66 @@ function verifyParams(params) {
|
|
|
14
14
|
return undefined;
|
|
15
15
|
}
|
|
16
16
|
Object.entries(params).forEach(([_, value]) => {
|
|
17
|
-
if (typeof value
|
|
18
|
-
throw new actions_core_1.IntegrationError('GA4 only accepts string or number values for event parameters
|
|
17
|
+
if (typeof value != 'string' && typeof value != 'number') {
|
|
18
|
+
throw new actions_core_1.IntegrationError('GA4 only accepts string or number values for event parameters and item parameters. Please ensure you are not including null, array, or nested values.', 'Invalid value', 400);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
return params;
|
|
22
22
|
}
|
|
23
23
|
exports.verifyParams = verifyParams;
|
|
24
|
+
function checkCurrencyDefinition(value, eventCurrency, items) {
|
|
25
|
+
if (value && eventCurrency === undefined) {
|
|
26
|
+
throw new actions_core_1.IntegrationError('Currency is required if value is set.', 'Misconfigured required field', 400);
|
|
27
|
+
}
|
|
28
|
+
if (eventCurrency === undefined && (!items || !items[0] || !items[0].currency)) {
|
|
29
|
+
throw new actions_core_1.IntegrationError('One of item-level currency or top-level currency is required.', 'Misconfigured required field', 400);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.checkCurrencyDefinition = checkCurrencyDefinition;
|
|
33
|
+
function convertTimestamp(timestamp) {
|
|
34
|
+
if (!timestamp) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
if (!isNaN(+timestamp)) {
|
|
38
|
+
return +timestamp;
|
|
39
|
+
}
|
|
40
|
+
return Date.parse(timestamp) * 1000;
|
|
41
|
+
}
|
|
42
|
+
exports.convertTimestamp = convertTimestamp;
|
|
43
|
+
function formatItems(items) {
|
|
44
|
+
if (!items) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const googleItems = 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
|
+
verifyCurrency(product.currency);
|
|
53
|
+
}
|
|
54
|
+
return product;
|
|
55
|
+
});
|
|
56
|
+
return googleItems;
|
|
57
|
+
}
|
|
58
|
+
exports.formatItems = formatItems;
|
|
59
|
+
function formatPromotionItems(items) {
|
|
60
|
+
if (!items) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
let googleItems = [];
|
|
64
|
+
googleItems = items.map((product) => {
|
|
65
|
+
if (product.item_name === undefined && product.item_id === undefined) {
|
|
66
|
+
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
67
|
+
}
|
|
68
|
+
if (product.promotion_id === undefined && product.promotion_name === undefined) {
|
|
69
|
+
throw new actions_core_1.IntegrationError('One of promotion name or promotion id is required.', 'Misconfigured required field', 400);
|
|
70
|
+
}
|
|
71
|
+
if (product.currency) {
|
|
72
|
+
verifyCurrency(product.currency);
|
|
73
|
+
}
|
|
74
|
+
return product;
|
|
75
|
+
});
|
|
76
|
+
return googleItems;
|
|
77
|
+
}
|
|
78
|
+
exports.formatPromotionItems = formatPromotionItems;
|
|
24
79
|
//# sourceMappingURL=ga4-functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ga4-functions.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-functions.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2CAAgD;
|
|
1
|
+
{"version":3,"file":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,cAAc,KAAK,SAAS,EAAE;YAC9E,MAAM,IAAI,+BAAgB,CACxB,oDAAoD,EACpD,8BAA8B,EAC9B,GAAG,CACJ,CAAA;SACF;QACD,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;SACjC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,OAAO,WAAW,CAAA;AACpB,CAAC;AA5BD,oDA4BC"}
|
|
@@ -20,3 +20,4 @@ export declare const minimal_items: InputField;
|
|
|
20
20
|
export declare const items_single_products: InputField;
|
|
21
21
|
export declare const items_multi_products: InputField;
|
|
22
22
|
export declare const engagement_time_msec: InputField;
|
|
23
|
+
export declare const timestamp_micros: InputField;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.engagement_time_msec = exports.items_multi_products = exports.items_single_products = exports.minimal_items = exports.payment_type = exports.coupon = exports.value = exports.currency = exports.client_id = exports.affiliation = exports.transaction_id = exports.shipping = exports.tax = exports.creative_name = exports.creative_slot = exports.promotion_name = exports.promotion_id = exports.user_id = exports.params = exports.user_properties = exports.formatUserProperties = void 0;
|
|
3
|
+
exports.timestamp_micros = exports.engagement_time_msec = exports.items_multi_products = exports.items_single_products = exports.minimal_items = exports.payment_type = exports.coupon = exports.value = exports.currency = exports.client_id = exports.affiliation = exports.transaction_id = exports.shipping = exports.tax = exports.creative_name = exports.creative_slot = exports.promotion_name = exports.promotion_id = exports.user_id = exports.params = exports.user_properties = exports.formatUserProperties = void 0;
|
|
4
4
|
const actions_core_1 = require("@segment/actions-core");
|
|
5
5
|
const formatUserProperties = (userProperties) => {
|
|
6
6
|
if (!userProperties) {
|
|
@@ -8,8 +8,8 @@ const formatUserProperties = (userProperties) => {
|
|
|
8
8
|
}
|
|
9
9
|
let properties = {};
|
|
10
10
|
Object.entries(userProperties).forEach(([key, value]) => {
|
|
11
|
-
if (typeof value
|
|
12
|
-
throw new actions_core_1.IntegrationError('GA4 only accepts string or
|
|
11
|
+
if (typeof value != 'string' && typeof value != 'number' && value != null) {
|
|
12
|
+
throw new actions_core_1.IntegrationError('GA4 only accepts string, number or null values for user properties. Please ensure you are not including array or nested values.', 'Invalid value', 400);
|
|
13
13
|
}
|
|
14
14
|
properties = { ...properties, ...{ [key]: { value: value } } };
|
|
15
15
|
});
|
|
@@ -313,4 +313,12 @@ exports.engagement_time_msec = {
|
|
|
313
313
|
description: 'The amount of time a user interacted with your site, in milliseconds. Google only counts users who interact with your site for a non-zero amount of time. By default, Segment sets engagement time to 1 so users are counted.',
|
|
314
314
|
default: 1
|
|
315
315
|
};
|
|
316
|
+
exports.timestamp_micros = {
|
|
317
|
+
label: 'Event Timestamp',
|
|
318
|
+
type: 'string',
|
|
319
|
+
description: 'A Unix timestamp (in microseconds) for the time to associate with the event. Events can be backdated up to 3 calendar days based on the propertys timezone.',
|
|
320
|
+
default: {
|
|
321
|
+
'@path': '$.timestamp'
|
|
322
|
+
}
|
|
323
|
+
};
|
|
316
324
|
//# sourceMappingURL=ga4-properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ga4-properties.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-properties.ts"],"names":[],"mappings":";;;AACA,wDAAwD;AAEjD,MAAM,oBAAoB,GAAG,CAAC,cAAkC,EAAsB,EAAE;IAC7F,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,SAAS,CAAA;KACjB;IAED,IAAI,UAAU,GAAG,EAAE,CAAA;IAEnB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACtD,IAAI,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ga4-properties.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-properties.ts"],"names":[],"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