@segment/action-destinations 3.77.1-alpha.4 → 3.78.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/destinations/amplitude/index.js +2 -10
- package/dist/destinations/amplitude/index.js.map +1 -1
- package/dist/destinations/amplitude/logEvent/generated-types.d.ts +1 -0
- package/dist/destinations/amplitude/logEvent/index.d.ts +1 -1
- package/dist/destinations/amplitude/logEvent/index.js +30 -1
- package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/addPaymentInfo/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js +20 -5
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/addToCart/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/addToCart/index.js +15 -4
- package/dist/destinations/google-analytics-4/addToCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/addToWishlist/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/addToWishlist/index.js +21 -5
- package/dist/destinations/google-analytics-4/addToWishlist/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/beginCheckout/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/beginCheckout/index.js +15 -4
- package/dist/destinations/google-analytics-4/beginCheckout/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/customEvent/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/customEvent/index.js +1 -4
- package/dist/destinations/google-analytics-4/customEvent/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-functions.d.ts +0 -6
- package/dist/destinations/google-analytics-4/ga4-functions.js +1 -68
- package/dist/destinations/google-analytics-4/ga4-functions.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-properties.d.ts +0 -1
- package/dist/destinations/google-analytics-4/ga4-properties.js +1 -13
- package/dist/destinations/google-analytics-4/ga4-properties.js.map +1 -1
- package/dist/destinations/google-analytics-4/generateLead/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/generateLead/index.js +1 -3
- package/dist/destinations/google-analytics-4/generateLead/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/login/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/login/index.js +1 -4
- package/dist/destinations/google-analytics-4/login/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/pageView/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/pageView/index.js +1 -4
- package/dist/destinations/google-analytics-4/pageView/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/purchase/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/purchase/index.js +15 -4
- package/dist/destinations/google-analytics-4/purchase/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/refund/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/refund/index.js +21 -5
- package/dist/destinations/google-analytics-4/refund/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/removeFromCart/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/removeFromCart/index.js +21 -5
- package/dist/destinations/google-analytics-4/removeFromCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/search/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/search/index.js +1 -4
- package/dist/destinations/google-analytics-4/search/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/selectItem/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/selectItem/index.js +15 -4
- package/dist/destinations/google-analytics-4/selectItem/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/selectPromotion/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/selectPromotion/index.js +18 -4
- package/dist/destinations/google-analytics-4/selectPromotion/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/signUp/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/signUp/index.js +1 -4
- package/dist/destinations/google-analytics-4/signUp/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewCart/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/viewCart/index.js +21 -5
- package/dist/destinations/google-analytics-4/viewCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewItem/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/viewItem/index.js +27 -4
- package/dist/destinations/google-analytics-4/viewItem/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewItemList/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/viewItemList/index.js +15 -4
- package/dist/destinations/google-analytics-4/viewItemList/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewPromotion/generated-types.d.ts +0 -1
- package/dist/destinations/google-analytics-4/viewPromotion/index.js +15 -4
- 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/salesforce/lead/index.js +0 -7
- 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 +3 -0
- package/dist/destinations/salesforce/sf-operations.js.map +1 -1
- package/dist/destinations/salesforce/sf-utils.js +6 -4
- package/dist/destinations/salesforce/sf-utils.js.map +1 -1
- package/dist/destinations/snap-conversions-api/_tests_/index.test.js +4 -4
- package/dist/destinations/snap-conversions-api/_tests_/index.test.js.map +1 -1
- package/dist/destinations/snap-conversions-api/index.js +1 -1
- package/dist/destinations/snap-conversions-api/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 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
- package/dist/destinations/webhook/__test__/webhook.test.js +5 -21
- package/dist/destinations/webhook/__test__/webhook.test.js.map +1 -1
- package/dist/destinations/webhook/send/generated-types.d.ts +3 -0
- package/dist/destinations/webhook/send/index.js +9 -1
- package/dist/destinations/webhook/send/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/amplitude/logPurchase/generated-types.d.ts +0 -64
- package/dist/destinations/amplitude/logPurchase/generated-types.js +0 -3
- package/dist/destinations/amplitude/logPurchase/generated-types.js.map +0 -1
- package/dist/destinations/amplitude/logPurchase/index.d.ts +0 -13
- package/dist/destinations/amplitude/logPurchase/index.js +0 -197
- package/dist/destinations/amplitude/logPurchase/index.js.map +0 -1
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
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;
|
|
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,12 +309,4 @@ 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
|
};
|
|
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
|
-
};
|
|
324
312
|
//# 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":";;;
|
|
1
|
+
{"version":3,"file":"ga4-properties.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-properties.ts"],"names":[],"mappings":";;;AAEO,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,UAAU,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,CAAA;AACxC,CAAC,CAAA;AAZY,QAAA,oBAAoB,wBAYhC;AAEY,QAAA,eAAe,GAAe;IACzC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EACT,8RAA8R;IAChS,IAAI,EAAE,QAAQ;IACd,oBAAo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C9C,GAAG,qBAAa;IAChB,OAAO,EAAE;QACP,YAAY,EAAE;YACZ,uBAAuB;YACvB;gBACE,OAAO,EAAE;oBACP,OAAO,EAAE,cAAc;iBACxB;gBACD,SAAS,EAAE;oBACT,OAAO,EAAE,QAAQ;iBAClB;gBACD,WAAW,EAAE;oBACX,OAAO,EAAE,eAAe;iBACzB;gBACD,MAAM,EAAE;oBACN,OAAO,EAAE,UAAU;iBACpB;gBACD,KAAK,EAAE;oBACL,OAAO,EAAE,YAAY;iBACtB;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE,SAAS;iBACnB;gBACD,aAAa,EAAE;oBACb,OAAO,EAAE,YAAY;iBACtB;gBACD,YAAY,EAAE;oBACZ,OAAO,EAAE,WAAW;iBACrB;gBACD,KAAK,EAAE;oBACL,OAAO,EAAE,SAAS;iBACnB;gBACD,QAAQ,EAAE;oBACR,OAAO,EAAE,YAAY;iBACtB;aACF;SACF;KACF;CACF,CAAA;AAEY,QAAA,oBAAoB,GAAe;IAC9C,KAAK,EAAE,iCAAiC;IACxC,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,+NAA+N;IACjO,OAAO,EAAE,CAAC;CACX,CAAA"}
|
|
@@ -10,7 +10,6 @@ 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 },
|
|
14
13
|
currency: { ...ga4_properties_1.currency },
|
|
15
14
|
value: { ...ga4_properties_1.value },
|
|
16
15
|
user_properties: ga4_properties_1.user_properties,
|
|
@@ -29,7 +28,6 @@ const action = {
|
|
|
29
28
|
json: {
|
|
30
29
|
client_id: payload.client_id,
|
|
31
30
|
user_id: payload.user_id,
|
|
32
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
33
31
|
events: [
|
|
34
32
|
{
|
|
35
33
|
name: 'generate_lead',
|
|
@@ -37,7 +35,7 @@ const action = {
|
|
|
37
35
|
currency: payload.currency,
|
|
38
36
|
value: payload.value,
|
|
39
37
|
engagement_time_msec: payload.engagement_time_msec,
|
|
40
|
-
...
|
|
38
|
+
...payload.params
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/generateLead/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/generateLead/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,oDAAiD;AAGjD,sDAS0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,kEAAkE;IAC/E,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,QAAQ,EAAE,EAAE,GAAG,yBAAQ,EAAE;QACzB,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;QAGD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;YACnD,MAAM,IAAI,+BAAgB,CAAC,uCAAuC,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;SACzG;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,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,eAAe;wBACrB,MAAM,EAAE;4BACN,QAAQ,EAAE,OAAO,CAAC,QAAQ;4BAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;4BACpB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,OAAO,CAAC,MAAM;yBAClB;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 ga4_functions_1 = require("../ga4-functions");
|
|
4
3
|
const ga4_properties_1 = require("../ga4-properties");
|
|
5
4
|
const action = {
|
|
6
5
|
title: 'Login',
|
|
@@ -9,7 +8,6 @@ const action = {
|
|
|
9
8
|
fields: {
|
|
10
9
|
client_id: { ...ga4_properties_1.client_id },
|
|
11
10
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
-
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
11
|
method: {
|
|
14
12
|
label: 'Method',
|
|
15
13
|
type: 'string',
|
|
@@ -25,14 +23,13 @@ const action = {
|
|
|
25
23
|
json: {
|
|
26
24
|
client_id: payload.client_id,
|
|
27
25
|
user_id: payload.user_id,
|
|
28
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
29
26
|
events: [
|
|
30
27
|
{
|
|
31
28
|
name: 'login',
|
|
32
29
|
params: {
|
|
33
30
|
method: payload.method,
|
|
34
31
|
engagement_time_msec: payload.engagement_time_msec,
|
|
35
|
-
...
|
|
32
|
+
...payload.params
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/login/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/login/index.ts"],"names":[],"mappings":";;AAGA,sDAO0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,gCAAgC;IAC7C,mBAAmB,EAAE,wCAAwC;IAC7D,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,2BAA2B;SACzC;QACD,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EAAE,qCAAoB;QAC1C,MAAM,EAAE,uBAAM;KACf;IAED,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,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,OAAO;wBACb,MAAM,EAAE;4BACN,MAAM,EAAE,OAAO,CAAC,MAAM;4BACtB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,OAAO,CAAC,MAAM;yBAClB;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 ga4_functions_1 = require("../ga4-functions");
|
|
4
3
|
const ga4_properties_1 = require("../ga4-properties");
|
|
5
4
|
const action = {
|
|
6
5
|
title: 'Page View',
|
|
@@ -9,7 +8,6 @@ const action = {
|
|
|
9
8
|
fields: {
|
|
10
9
|
clientId: { ...ga4_properties_1.client_id },
|
|
11
10
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
-
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
11
|
page_location: {
|
|
14
12
|
label: 'Page Location',
|
|
15
13
|
type: 'string',
|
|
@@ -44,7 +42,6 @@ const action = {
|
|
|
44
42
|
json: {
|
|
45
43
|
client_id: payload.clientId,
|
|
46
44
|
user_id: payload.user_id,
|
|
47
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
48
45
|
events: [
|
|
49
46
|
{
|
|
50
47
|
name: 'page_view',
|
|
@@ -53,7 +50,7 @@ const action = {
|
|
|
53
50
|
page_referrer: payload.page_referrer,
|
|
54
51
|
page_title: payload.page_title,
|
|
55
52
|
engagement_time_msec: payload.engagement_time_msec,
|
|
56
|
-
...
|
|
53
|
+
...payload.params
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/pageView/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/pageView/index.ts"],"names":[],"mappings":";;AAGA,sDAO0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,yCAAyC;IACtD,mBAAmB,EAAE,eAAe;IACpC,MAAM,EAAE;QACN,QAAQ,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC1B,OAAO,EAAE,EAAE,GAAG,w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", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const ga4_functions_1 = require("../ga4-functions");
|
|
4
5
|
const ga4_properties_1 = require("../ga4-properties");
|
|
5
6
|
const action = {
|
|
@@ -9,7 +10,6 @@ const action = {
|
|
|
9
10
|
fields: {
|
|
10
11
|
client_id: { ...ga4_properties_1.client_id },
|
|
11
12
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
-
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
13
|
affiliation: { ...ga4_properties_1.affiliation },
|
|
14
14
|
coupon: { ...ga4_properties_1.coupon, default: { '@path': '$.properties.coupon' } },
|
|
15
15
|
currency: { ...ga4_properties_1.currency, required: true },
|
|
@@ -27,12 +27,23 @@ const action = {
|
|
|
27
27
|
},
|
|
28
28
|
perform: (request, { payload }) => {
|
|
29
29
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
30
|
+
let googleItems = [];
|
|
31
|
+
if (payload.items) {
|
|
32
|
+
googleItems = payload.items.map((product) => {
|
|
33
|
+
if (product.item_name === undefined && product.item_id === undefined) {
|
|
34
|
+
throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
|
|
35
|
+
}
|
|
36
|
+
if (product.currency) {
|
|
37
|
+
ga4_functions_1.verifyCurrency(product.currency);
|
|
38
|
+
}
|
|
39
|
+
return product;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
30
42
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
31
43
|
method: 'POST',
|
|
32
44
|
json: {
|
|
33
45
|
client_id: payload.client_id,
|
|
34
46
|
user_id: payload.user_id,
|
|
35
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
36
47
|
events: [
|
|
37
48
|
{
|
|
38
49
|
name: 'purchase',
|
|
@@ -40,13 +51,13 @@ const action = {
|
|
|
40
51
|
affiliation: payload.affiliation,
|
|
41
52
|
coupon: payload.coupon,
|
|
42
53
|
currency: payload.currency,
|
|
43
|
-
items:
|
|
54
|
+
items: googleItems,
|
|
44
55
|
transaction_id: payload.transaction_id,
|
|
45
56
|
shipping: payload.shipping,
|
|
46
57
|
value: payload.value,
|
|
47
58
|
tax: payload.tax,
|
|
48
59
|
engagement_time_msec: payload.engagement_time_msec,
|
|
49
|
-
...
|
|
60
|
+
...payload.params
|
|
50
61
|
}
|
|
51
62
|
}
|
|
52
63
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/purchase/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/purchase/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAG1E,oDAAiD;AAEjD,sDAe0B;AAI1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,6CAA6C;IAC1D,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,WAAW,EAAE,EAAE,GAAG,4BAAW,EAAE;QAC/B,MAAM,EAAE,EAAE,GAAG,uBAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,EAAE;QAClE,QAAQ,EAAE,EAAE,GAAG,yBAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAGzC,KAAK,EAAE;YACL,GAAG,qCAAoB;YACvB,QAAQ,EAAE,IAAI;SACf;QACD,cAAc,EAAE,EAAE,GAAG,+BAAc,EAAE,QAAQ,EAAE,IAAI,EAAE;QACrD,QAAQ,EAAE,EAAE,GAAG,yBAAQ,EAAE;QACzB,GAAG,EAAE,EAAE,GAAG,oBAAG,EAAE;QACf,KAAK,EAAE,EAAE,GAAG,sBAAK,EAAE,OAAO,EAAE,EAA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G;4BAChB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,OAAO,CAAC,MAAM;yBAClB;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 actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const ga4_functions_1 = require("../ga4-functions");
|
|
4
5
|
const ga4_properties_1 = require("../ga4-properties");
|
|
5
6
|
const action = {
|
|
@@ -9,7 +10,6 @@ const action = {
|
|
|
9
10
|
fields: {
|
|
10
11
|
client_id: { ...ga4_properties_1.client_id },
|
|
11
12
|
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,13 +32,29 @@ const action = {
|
|
|
32
32
|
if (payload.currency) {
|
|
33
33
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
if (payload.value && payload.currency === undefined) {
|
|
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
|
+
}
|
|
36
53
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
37
54
|
method: 'POST',
|
|
38
55
|
json: {
|
|
39
56
|
client_id: payload.client_id,
|
|
40
57
|
user_id: payload.user_id,
|
|
41
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
42
58
|
events: [
|
|
43
59
|
{
|
|
44
60
|
name: 'refund',
|
|
@@ -50,9 +66,9 @@ const action = {
|
|
|
50
66
|
coupon: payload.coupon,
|
|
51
67
|
shipping: payload.shipping,
|
|
52
68
|
tax: payload.tax,
|
|
53
|
-
items:
|
|
69
|
+
items: googleItems,
|
|
54
70
|
engagement_time_msec: payload.engagement_time_msec,
|
|
55
|
-
...
|
|
71
|
+
...payload.params
|
|
56
72
|
}
|
|
57
73
|
}
|
|
58
74
|
],
|
|
@@ -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":";;AAAA,wDAA0E;AAC1E,oDAAiD;AACjD,sDAc0B;AAK1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,oCAAoC;IACjD,mBAAmB,EAAE,6CAA6C;IAClE,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,QAAQ,EAAE,EAAE,GAAG,yBAAQ,EAAE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AAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC1C,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;oBACpE,MAAM,IAAI,+BAAgB,CACxB,+EAA+E,EAC/E,8BAA8B,EAC9B,GAAG,CACJ,CAAA;iBACF;gBAED,IAAI,OAAO,CAAC,QAAQ,EAAE;oBACpB,8BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;iBACjC;gBAED,OAAO,OAAsB,CAAA;YAC/B,CAAC,CAAC,CAAA;SACH;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,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,QAAQ;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,WAAW;4BAClB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,OAAO,CAAC,MAAM;yBAClB;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 actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const ga4_functions_1 = require("../ga4-functions");
|
|
4
5
|
const ga4_properties_1 = require("../ga4-properties");
|
|
5
6
|
const action = {
|
|
@@ -9,7 +10,6 @@ const action = {
|
|
|
9
10
|
fields: {
|
|
10
11
|
client_id: { ...ga4_properties_1.client_id },
|
|
11
12
|
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,22 +24,38 @@ const action = {
|
|
|
24
24
|
if (payload.currency) {
|
|
25
25
|
ga4_functions_1.verifyCurrency(payload.currency);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
if (payload.value && payload.currency === undefined) {
|
|
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
|
+
}
|
|
28
45
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
29
46
|
method: 'POST',
|
|
30
47
|
json: {
|
|
31
48
|
client_id: payload.client_id,
|
|
32
49
|
user_id: payload.user_id,
|
|
33
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
34
50
|
events: [
|
|
35
51
|
{
|
|
36
52
|
name: 'remove_from_cart',
|
|
37
53
|
params: {
|
|
38
54
|
currency: payload.currency,
|
|
39
55
|
value: payload.value,
|
|
40
|
-
items:
|
|
56
|
+
items: googleItems,
|
|
41
57
|
engagement_time_msec: payload.engagement_time_msec,
|
|
42
|
-
...
|
|
58
|
+
...payload.params
|
|
43
59
|
}
|
|
44
60
|
}
|
|
45
61
|
],
|
|
@@ -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/destinations/google-analytics-4/removeFromCart/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,oDAAiD;AACjD,sDAU0B;AAK1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,kDAAkD;IAC/D,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,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;QAGD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,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ClD,GAAG,OAAO,CAAC,MAAM;yBAClB;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 ga4_functions_1 = require("../ga4-functions");
|
|
4
3
|
const ga4_properties_1 = require("../ga4-properties");
|
|
5
4
|
const action = {
|
|
6
5
|
title: 'Search',
|
|
@@ -9,7 +8,6 @@ const action = {
|
|
|
9
8
|
fields: {
|
|
10
9
|
client_id: { ...ga4_properties_1.client_id },
|
|
11
10
|
user_id: { ...ga4_properties_1.user_id },
|
|
12
|
-
timestamp_micros: { ...ga4_properties_1.timestamp_micros },
|
|
13
11
|
search_term: {
|
|
14
12
|
label: 'Search Term',
|
|
15
13
|
type: 'string',
|
|
@@ -29,14 +27,13 @@ const action = {
|
|
|
29
27
|
json: {
|
|
30
28
|
client_id: payload.client_id,
|
|
31
29
|
user_id: payload.user_id,
|
|
32
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
33
30
|
events: [
|
|
34
31
|
{
|
|
35
32
|
name: 'search',
|
|
36
33
|
params: {
|
|
37
34
|
search_term: payload.search_term,
|
|
38
35
|
engagement_time_msec: payload.engagement_time_msec,
|
|
39
|
-
...
|
|
36
|
+
...payload.params
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
],
|
|
@@ -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,sDAO0B;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,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,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,QAAQ;wBACd,MAAM,EAAE;4BACN,WAAW,EAAE,OAAO,CAAC,WAAW;4BAChC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,OAAO,CAAC,MAAM;yBAClB;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 actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const ga4_functions_1 = require("../ga4-functions");
|
|
4
5
|
const ga4_properties_1 = require("../ga4-properties");
|
|
5
6
|
const action = {
|
|
@@ -9,7 +10,6 @@ const action = {
|
|
|
9
10
|
fields: {
|
|
10
11
|
client_id: { ...ga4_properties_1.client_id },
|
|
11
12
|
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,21 +29,32 @@ 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
|
+
}
|
|
32
44
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
33
45
|
method: 'POST',
|
|
34
46
|
json: {
|
|
35
47
|
client_id: payload.client_id,
|
|
36
48
|
user_id: payload.user_id,
|
|
37
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
38
49
|
events: [
|
|
39
50
|
{
|
|
40
51
|
name: 'select_item',
|
|
41
52
|
params: {
|
|
42
|
-
items:
|
|
53
|
+
items: googleItems,
|
|
43
54
|
item_list_name: payload.item_list_name,
|
|
44
55
|
item_list_id: payload.item_list_id,
|
|
45
56
|
engagement_time_msec: payload.engagement_time_msec,
|
|
46
|
-
...
|
|
57
|
+
...payload.params
|
|
47
58
|
}
|
|
48
59
|
}
|
|
49
60
|
],
|
|
@@ -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":";;AAAA,wDAA0E;AAC1E,oDAAiD;AAIjD,sDAQ0B;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,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,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,KAAK,SAAS,EAAE;oBACpE,MAAM,IAAI,+BAAgB,CACxB,+EAA+E,EAC/E,8BAA8B,EAC9B,GAAG,CACJ,CAAA;iBACF;gBAED,IAAI,OAAO,CAAC,QAAQ,EAAE;oBACpB,8BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;iBACjC;gBAED,OAAO,OAAsB,CAAA;YAC/B,CAAC,CAAC,CAAA;SACH;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,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,aAAa;wBACnB,MAAM,EAAE;4BACN,KAAK,EAAE,WAAW;4BAClB,cAAc,EAAE,OAAO,CAAC,cAAc;4BACtC,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;4BAClD,GAAG,OAAO,CAAC,MAAM;yBAClB;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 actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const ga4_functions_1 = require("../ga4-functions");
|
|
4
5
|
const ga4_properties_1 = require("../ga4-properties");
|
|
5
6
|
const action = {
|
|
@@ -9,7 +10,6 @@ const action = {
|
|
|
9
10
|
fields: {
|
|
10
11
|
client_id: { ...ga4_properties_1.client_id },
|
|
11
12
|
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,12 +42,26 @@ 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
|
+
}
|
|
45
60
|
return request('https://www.google-analytics.com/mp/collect', {
|
|
46
61
|
method: 'POST',
|
|
47
62
|
json: {
|
|
48
63
|
client_id: payload.client_id,
|
|
49
64
|
user_id: payload.user_id,
|
|
50
|
-
timestamp_micros: ga4_functions_1.convertTimestamp(payload.timestamp_micros),
|
|
51
65
|
events: [
|
|
52
66
|
{
|
|
53
67
|
name: 'select_promotion',
|
|
@@ -57,9 +71,9 @@ const action = {
|
|
|
57
71
|
location_id: payload.location_id,
|
|
58
72
|
promotion_id: payload.promotion_id,
|
|
59
73
|
promotion_name: payload.promotion_name,
|
|
60
|
-
items:
|
|
74
|
+
items: googleItems,
|
|
61
75
|
engagement_time_msec: payload.engagement_time_msec,
|
|
62
|
-
...
|
|
76
|
+
...payload.params
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
79
|
],
|