@segment/action-destinations 3.80.2-alpha.7 → 3.81.1-alpha.2
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/google-analytics-4/addPaymentInfo/generated-types.d.ts +1 -0
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js +25 -40
- 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 +23 -36
- 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 +23 -36
- 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 +24 -38
- 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 +20 -30
- package/dist/destinations/google-analytics-4/customEvent/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-functions.d.ts +3 -1
- package/dist/destinations/google-analytics-4/ga4-functions.js +23 -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 +9 -5
- 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 +22 -34
- 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 +21 -32
- 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 +23 -36
- 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 +28 -46
- 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 +28 -46
- 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 +23 -36
- 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 +21 -32
- 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 +23 -36
- 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 +26 -42
- 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 +21 -32
- 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 +23 -36
- 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 +23 -36
- 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 +23 -36
- 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 +26 -42
- package/dist/destinations/google-analytics-4/viewPromotion/index.js.map +1 -1
- package/dist/destinations/moengage/identifyUser/generated-types.d.ts +2 -2
- package/dist/destinations/moengage/identifyUser/index.js +4 -4
- package/dist/destinations/moengage/identifyUser/index.js.map +1 -1
- package/dist/destinations/moengage/trackEvent/generated-types.d.ts +2 -2
- package/dist/destinations/moengage/trackEvent/index.js +6 -6
- package/dist/destinations/moengage/trackEvent/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -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 },
|
|
@@ -48,50 +49,34 @@ const action = {
|
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
if (features && features['actions-google-analytics-4-verify-params-feature']) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
],
|
|
70
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
52
|
+
ga4_functions_1.verifyParams(payload.params);
|
|
53
|
+
ga4_functions_1.verifyUserProps(payload.user_properties);
|
|
54
|
+
}
|
|
55
|
+
let request_object = {
|
|
56
|
+
client_id: payload.client_id,
|
|
57
|
+
user_id: payload.user_id,
|
|
58
|
+
events: [
|
|
59
|
+
{
|
|
60
|
+
name: 'add_payment_info',
|
|
61
|
+
params: {
|
|
62
|
+
currency: payload.currency,
|
|
63
|
+
value: payload.value,
|
|
64
|
+
coupon: payload.coupon,
|
|
65
|
+
payment_type: payload.payment_type,
|
|
66
|
+
items: googleItems,
|
|
67
|
+
engagement_time_msec: payload.engagement_time_msec,
|
|
68
|
+
...payload.params
|
|
69
|
+
}
|
|
71
70
|
}
|
|
72
|
-
|
|
71
|
+
],
|
|
72
|
+
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
73
|
+
};
|
|
74
|
+
if (features && features['actions-google-analytics-4-add-timestamp']) {
|
|
75
|
+
request_object = { ...request_object, ...{ ['timestamp_micros']: ga4_functions_1.convertTimestamp(payload.timestamp_micros) } };
|
|
73
76
|
}
|
|
74
77
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
75
78
|
method: 'POST',
|
|
76
|
-
json:
|
|
77
|
-
client_id: payload.client_id,
|
|
78
|
-
user_id: payload.user_id,
|
|
79
|
-
events: [
|
|
80
|
-
{
|
|
81
|
-
name: 'add_payment_info',
|
|
82
|
-
params: {
|
|
83
|
-
currency: payload.currency,
|
|
84
|
-
value: payload.value,
|
|
85
|
-
coupon: payload.coupon,
|
|
86
|
-
payment_type: payload.payment_type,
|
|
87
|
-
items: googleItems,
|
|
88
|
-
engagement_time_msec: payload.engagement_time_msec,
|
|
89
|
-
...payload.params
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
94
|
-
}
|
|
79
|
+
json: request_object
|
|
95
80
|
});
|
|
96
81
|
}
|
|
97
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addPaymentInfo/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addPaymentInfo/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,oDAAkG;AAClG,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,EAAE,qCAAoB;QAC1C,MAAM,EAAE,uBAAM;KACf;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAG1C,IAAI,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE;YAC1C,MAAM,IAAI,+BAAgB,CACxB,kEAAkE,EAClE,8BAA8B,EAC9B,GAAG,CACJ,CAAA;SACF;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,8BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;SACjC;QAGD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,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,YAAY,EAAE,OAAO,CAAC,YAAY;wBAClC,KAAK,EAAE,WAAW;wBAClB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAA;SAChH;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,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
|
items: {
|
|
15
16
|
...ga4_properties_1.items_single_products,
|
|
@@ -37,46 +38,32 @@ const action = {
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
if (features && features['actions-google-analytics-4-verify-params-feature']) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
],
|
|
57
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
41
|
+
ga4_functions_1.verifyParams(payload.params);
|
|
42
|
+
ga4_functions_1.verifyUserProps(payload.user_properties);
|
|
43
|
+
}
|
|
44
|
+
let request_object = {
|
|
45
|
+
client_id: payload.client_id,
|
|
46
|
+
user_id: payload.user_id,
|
|
47
|
+
events: [
|
|
48
|
+
{
|
|
49
|
+
name: 'add_to_cart',
|
|
50
|
+
params: {
|
|
51
|
+
currency: payload.currency,
|
|
52
|
+
items: googleItems,
|
|
53
|
+
value: payload.value,
|
|
54
|
+
engagement_time_msec: payload.engagement_time_msec,
|
|
55
|
+
...payload.params
|
|
56
|
+
}
|
|
58
57
|
}
|
|
59
|
-
|
|
58
|
+
],
|
|
59
|
+
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
60
|
+
};
|
|
61
|
+
if (features && features['actions-google-analytics-4-add-timestamp']) {
|
|
62
|
+
request_object = { ...request_object, ...{ ['timestamp_micros']: ga4_functions_1.convertTimestamp(payload.timestamp_micros) } };
|
|
60
63
|
}
|
|
61
64
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
62
65
|
method: 'POST',
|
|
63
|
-
json:
|
|
64
|
-
client_id: payload.client_id,
|
|
65
|
-
user_id: payload.user_id,
|
|
66
|
-
events: [
|
|
67
|
-
{
|
|
68
|
-
name: 'add_to_cart',
|
|
69
|
-
params: {
|
|
70
|
-
currency: payload.currency,
|
|
71
|
-
items: googleItems,
|
|
72
|
-
value: payload.value,
|
|
73
|
-
engagement_time_msec: payload.engagement_time_msec,
|
|
74
|
-
...payload.params
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
79
|
-
}
|
|
66
|
+
json: request_object
|
|
80
67
|
});
|
|
81
68
|
}
|
|
82
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToCart/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,
|
|
1
|
+
{"version":3,"file":"index.js","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AC/B,CAAC,CAAC,CAAA;SACH;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,kDAAkD,CAAC,EAAE;YAC5E,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAC5B,+BAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;SACzC;QAED,IAAI,cAAc,GAAG;YACnB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,aAAa;oBACnB,MAAM,EAAE;wBACN,QAAQ,EAAE,OAAO,CAAC,QAAQ;wBAC1B,KAAK,EAAE,WAAW;wBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAA;SAChH;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,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
|
items: {
|
|
@@ -43,46 +44,32 @@ const action = {
|
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
if (features && features['actions-google-analytics-4-verify-params-feature']) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
],
|
|
63
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
47
|
+
ga4_functions_1.verifyParams(payload.params);
|
|
48
|
+
ga4_functions_1.verifyUserProps(payload.user_properties);
|
|
49
|
+
}
|
|
50
|
+
let request_object = {
|
|
51
|
+
client_id: payload.client_id,
|
|
52
|
+
user_id: payload.user_id,
|
|
53
|
+
events: [
|
|
54
|
+
{
|
|
55
|
+
name: 'add_to_wishlist',
|
|
56
|
+
params: {
|
|
57
|
+
currency: payload.currency,
|
|
58
|
+
value: payload.value,
|
|
59
|
+
items: googleItems,
|
|
60
|
+
engagement_time_msec: payload.engagement_time_msec,
|
|
61
|
+
...payload.params
|
|
62
|
+
}
|
|
64
63
|
}
|
|
65
|
-
|
|
64
|
+
],
|
|
65
|
+
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
66
|
+
};
|
|
67
|
+
if (features && features['actions-google-analytics-4-add-timestamp']) {
|
|
68
|
+
request_object = { ...request_object, ...{ ['timestamp_micros']: ga4_functions_1.convertTimestamp(payload.timestamp_micros) } };
|
|
66
69
|
}
|
|
67
70
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
68
71
|
method: 'POST',
|
|
69
|
-
json:
|
|
70
|
-
client_id: payload.client_id,
|
|
71
|
-
user_id: payload.user_id,
|
|
72
|
-
events: [
|
|
73
|
-
{
|
|
74
|
-
name: 'add_to_wishlist',
|
|
75
|
-
params: {
|
|
76
|
-
currency: payload.currency,
|
|
77
|
-
value: payload.value,
|
|
78
|
-
items: googleItems,
|
|
79
|
-
engagement_time_msec: payload.engagement_time_msec,
|
|
80
|
-
...payload.params
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
85
|
-
}
|
|
72
|
+
json: request_object
|
|
86
73
|
});
|
|
87
74
|
}
|
|
88
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToWishlist/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToWishlist/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,oDAAkG;AAClG,sDAW0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,iDAAiD;IAC9D,mBAAmB,EAAE,wDAAwD;IAC7E,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,QAAQ,EAAE,EAAE,EAAE;QAC1C,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,8BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;SACjC;QAGD,IAAI,OAAO,CAAC,KAAK,IAA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Q,EAAE,OAAO,CAAC,QAAQ;wBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,KAAK,EAAE,WAAW;wBAClB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAA;SAChH;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,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
|
coupon: { ...ga4_properties_1.coupon, default: { '@path': '$.properties.coupon' } },
|
|
14
15
|
currency: { ...ga4_properties_1.currency },
|
|
15
16
|
items: {
|
|
@@ -38,48 +39,33 @@ const action = {
|
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
if (features && features['actions-google-analytics-4-verify-params-feature']) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
],
|
|
59
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
42
|
+
ga4_functions_1.verifyParams(payload.params);
|
|
43
|
+
ga4_functions_1.verifyUserProps(payload.user_properties);
|
|
44
|
+
}
|
|
45
|
+
let request_object = {
|
|
46
|
+
client_id: payload.client_id,
|
|
47
|
+
user_id: payload.user_id,
|
|
48
|
+
events: [
|
|
49
|
+
{
|
|
50
|
+
name: 'begin_checkout',
|
|
51
|
+
params: {
|
|
52
|
+
coupon: payload.coupon,
|
|
53
|
+
currency: payload.currency,
|
|
54
|
+
items: googleItems,
|
|
55
|
+
value: payload.value,
|
|
56
|
+
engagement_time_msec: payload.engagement_time_msec,
|
|
57
|
+
...payload.params
|
|
58
|
+
}
|
|
60
59
|
}
|
|
61
|
-
|
|
60
|
+
],
|
|
61
|
+
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
62
|
+
};
|
|
63
|
+
if (features && features['actions-google-analytics-4-add-timestamp']) {
|
|
64
|
+
request_object = { ...request_object, ...{ ['timestamp_micros']: ga4_functions_1.convertTimestamp(payload.timestamp_micros) } };
|
|
62
65
|
}
|
|
63
66
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
64
67
|
method: 'POST',
|
|
65
|
-
json:
|
|
66
|
-
client_id: payload.client_id,
|
|
67
|
-
user_id: payload.user_id,
|
|
68
|
-
events: [
|
|
69
|
-
{
|
|
70
|
-
name: 'begin_checkout',
|
|
71
|
-
params: {
|
|
72
|
-
coupon: payload.coupon,
|
|
73
|
-
currency: payload.currency,
|
|
74
|
-
items: googleItems,
|
|
75
|
-
value: payload.value,
|
|
76
|
-
engagement_time_msec: payload.engagement_time_msec,
|
|
77
|
-
...payload.params
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
82
|
-
}
|
|
68
|
+
json: request_object
|
|
83
69
|
});
|
|
84
70
|
}
|
|
85
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/beginCheckout/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/beginCheckout/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,oDAAkG;AAClG,sDAY0B;AAK1B,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,QAAQ,EAAE,EAAE,EAAE;QAC1C,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,8BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;SACjC;QAED,IAAI,WAAW,GAAkB,EAAE,CAAA;QAEnC,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC1C,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,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AA"}
|
|
@@ -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).',
|
|
@@ -39,40 +40,29 @@ const action = {
|
|
|
39
40
|
perform: (request, { payload, features }) => {
|
|
40
41
|
const event_name = normalizeEventName(payload.name, payload.lowercase);
|
|
41
42
|
if (features && features['actions-google-analytics-4-verify-params-feature']) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
],
|
|
56
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
43
|
+
ga4_functions_1.verifyParams(payload.params);
|
|
44
|
+
ga4_functions_1.verifyUserProps(payload.user_properties);
|
|
45
|
+
}
|
|
46
|
+
let request_object = {
|
|
47
|
+
client_id: payload.clientId,
|
|
48
|
+
user_id: payload.user_id,
|
|
49
|
+
events: [
|
|
50
|
+
{
|
|
51
|
+
name: event_name,
|
|
52
|
+
params: {
|
|
53
|
+
engagement_time_msec: payload.engagement_time_msec,
|
|
54
|
+
...payload.params
|
|
55
|
+
}
|
|
57
56
|
}
|
|
58
|
-
|
|
57
|
+
],
|
|
58
|
+
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
59
|
+
};
|
|
60
|
+
if (features && features['actions-google-analytics-4-add-timestamp']) {
|
|
61
|
+
request_object = { ...request_object, ...{ ['timestamp_micros']: ga4_functions_1.convertTimestamp(payload.timestamp_micros) } };
|
|
59
62
|
}
|
|
60
63
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
61
64
|
method: 'POST',
|
|
62
|
-
json:
|
|
63
|
-
client_id: payload.clientId,
|
|
64
|
-
user_id: payload.user_id,
|
|
65
|
-
events: [
|
|
66
|
-
{
|
|
67
|
-
name: event_name,
|
|
68
|
-
params: {
|
|
69
|
-
engagement_time_msec: payload.engagement_time_msec,
|
|
70
|
-
...payload.params
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
...ga4_properties_1.formatUserProperties(payload.user_properties)
|
|
75
|
-
}
|
|
65
|
+
json: request_object
|
|
76
66
|
});
|
|
77
67
|
}
|
|
78
68
|
};
|
|
@@ -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,oDAAkF;AAElF,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,EA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,EAAE,CAAC,kBAAkB,CAAC,EAAE,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAA;SAChH;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AACD,kBAAe,MAAM,CAAA"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare function verifyCurrency(currency: string): void;
|
|
2
|
-
export declare function verifyParams(params: object | undefined):
|
|
2
|
+
export declare function verifyParams(params: object | undefined): void;
|
|
3
|
+
export declare function verifyUserProps(userProperties: object | undefined): void;
|
|
4
|
+
export declare function convertTimestamp(timestamp: string | undefined): number | 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.convertTimestamp = exports.verifyUserProps = 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) {
|
|
@@ -11,14 +11,34 @@ function verifyCurrency(currency) {
|
|
|
11
11
|
exports.verifyCurrency = verifyCurrency;
|
|
12
12
|
function verifyParams(params) {
|
|
13
13
|
if (!params) {
|
|
14
|
-
return
|
|
14
|
+
return;
|
|
15
15
|
}
|
|
16
16
|
Object.entries(params).forEach(([_, value]) => {
|
|
17
17
|
if (typeof value != 'string' && typeof value != 'number') {
|
|
18
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
|
-
return params;
|
|
22
21
|
}
|
|
23
22
|
exports.verifyParams = verifyParams;
|
|
23
|
+
function verifyUserProps(userProperties) {
|
|
24
|
+
if (!userProperties) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
Object.entries(userProperties).forEach(([_, value]) => {
|
|
28
|
+
if (typeof value != 'string' && typeof value != 'number' && value != null) {
|
|
29
|
+
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);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.verifyUserProps = verifyUserProps;
|
|
34
|
+
function convertTimestamp(timestamp) {
|
|
35
|
+
if (!timestamp) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
if (!isNaN(+timestamp)) {
|
|
39
|
+
return +timestamp;
|
|
40
|
+
}
|
|
41
|
+
return Date.parse(timestamp) * 1000;
|
|
42
|
+
}
|
|
43
|
+
exports.convertTimestamp = convertTimestamp;
|
|
24
44
|
//# 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;AAGhD,SAAgB,cAAc,CAAC,QAAgB;IAC7C,IAAI,CAAC,8BAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE;QACxD,MAAM,IAAI,+BAAgB,CAAC,GAAG,QAAQ,gCAAgC,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;KACvG;AACH,CAAC;AAJD,wCAIC;
|
|
1
|
+
{"version":3,"file":"ga4-functions.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-functions.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2CAAgD;AAGhD,SAAgB,cAAc,CAAC,QAAgB;IAC7C,IAAI,CAAC,8BAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE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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,16 +1,12 @@
|
|
|
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;
|
|
4
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
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;
|
|
5
4
|
const formatUserProperties = (userProperties) => {
|
|
6
5
|
if (!userProperties) {
|
|
7
6
|
return undefined;
|
|
8
7
|
}
|
|
9
8
|
let properties = {};
|
|
10
9
|
Object.entries(userProperties).forEach(([key, value]) => {
|
|
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
|
-
}
|
|
14
10
|
properties = { ...properties, ...{ [key]: { value: value } } };
|
|
15
11
|
});
|
|
16
12
|
return { user_properties: properties };
|
|
@@ -313,4 +309,12 @@ exports.engagement_time_msec = {
|
|
|
313
309
|
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
310
|
default: 1
|
|
315
311
|
};
|
|
312
|
+
exports.timestamp_micros = {
|
|
313
|
+
label: 'Event Timestamp',
|
|
314
|
+
type: 'string',
|
|
315
|
+
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.',
|
|
316
|
+
default: {
|
|
317
|
+
'@path': '$.timestamp'
|
|
318
|
+
}
|
|
319
|
+
};
|
|
316
320
|
//# sourceMappingURL=ga4-properties.js.map
|