@segment/action-destinations 3.239.5 → 3.241.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/aggregations-io/index.js +17 -7
- package/dist/destinations/aggregations-io/index.js.map +1 -1
- package/dist/destinations/aggregations-io/types.d.ts +8 -0
- package/dist/destinations/aggregations-io/types.js +8 -0
- package/dist/destinations/aggregations-io/types.js.map +1 -0
- package/dist/destinations/amazon-ads/generated-types.d.ts +3 -0
- package/dist/destinations/amazon-ads/generated-types.js.map +1 -0
- package/dist/destinations/amazon-ads/index.d.ts +4 -0
- package/dist/destinations/amazon-ads/index.js +87 -0
- package/dist/destinations/amazon-ads/index.js.map +1 -0
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +2 -0
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js +3 -0
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js.map +1 -0
- package/dist/destinations/amazon-ads/syncAudiences/index.d.ts +5 -0
- package/dist/destinations/amazon-ads/syncAudiences/index.js +15 -0
- package/dist/destinations/amazon-ads/syncAudiences/index.js.map +1 -0
- package/dist/destinations/amazon-ads/types.d.ts +22 -0
- package/dist/destinations/amazon-ads/types.js +11 -0
- package/dist/destinations/amazon-ads/types.js.map +1 -0
- package/dist/destinations/braze/trackEvent/generated-types.d.ts +1 -0
- package/dist/destinations/braze/trackEvent/index.js +8 -0
- package/dist/destinations/braze/trackEvent/index.js.map +1 -1
- package/dist/destinations/braze/trackPurchase/generated-types.d.ts +1 -0
- package/dist/destinations/braze/trackPurchase/index.js +8 -0
- package/dist/destinations/braze/trackPurchase/index.js.map +1 -1
- package/dist/destinations/braze/utils.js +15 -11
- package/dist/destinations/braze/utils.js.map +1 -1
- package/dist/destinations/courier/generated-types.d.ts +4 -0
- package/dist/destinations/courier/generated-types.js +3 -0
- package/dist/destinations/courier/generated-types.js.map +1 -0
- package/dist/destinations/courier/index.d.ts +4 -0
- package/dist/destinations/courier/index.js +44 -0
- package/dist/destinations/courier/index.js.map +1 -0
- package/dist/destinations/courier/postToCourier/generated-types.d.ts +5 -0
- package/dist/destinations/courier/postToCourier/generated-types.js +3 -0
- package/dist/destinations/courier/postToCourier/generated-types.js.map +1 -0
- package/dist/destinations/courier/postToCourier/index.js +35 -0
- package/dist/destinations/courier/postToCourier/index.js.map +1 -0
- package/dist/destinations/criteo-audiences/criteo-audiences.js +11 -6
- package/dist/destinations/criteo-audiences/criteo-audiences.js.map +1 -1
- package/dist/destinations/display-video-360/index.js +1 -1
- package/dist/destinations/display-video-360/index.js.map +1 -1
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +3 -1
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
- package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js +1 -1
- package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/constants.d.ts +1 -1
- package/dist/destinations/facebook-conversions-api/constants.js +1 -1
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +26 -0
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -1
- package/dist/destinations/hubspot/utils.d.ts +10 -0
- package/dist/destinations/index.js +6 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/kameleoon/index.js +1 -1
- package/dist/destinations/kameleoon/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/api.test.js +43 -25
- package/dist/destinations/linkedin-conversions/api/api.test.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/index.d.ts +3 -2
- package/dist/destinations/linkedin-conversions/api/index.js +31 -15
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/generated-types.d.ts +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/index.js +2 -1
- package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/types.d.ts +6 -7
- package/dist/destinations/schematic/generated-types.d.ts +3 -0
- package/dist/destinations/schematic/generated-types.js +3 -0
- package/dist/destinations/schematic/generated-types.js.map +1 -0
- package/dist/destinations/schematic/identifyUser/generated-types.d.ts +18 -0
- package/dist/destinations/schematic/identifyUser/generated-types.js +3 -0
- package/dist/destinations/schematic/identifyUser/generated-types.js.map +1 -0
- package/dist/destinations/schematic/identifyUser/index.d.ts +5 -0
- package/dist/destinations/schematic/identifyUser/index.js +114 -0
- package/dist/destinations/schematic/identifyUser/index.js.map +1 -0
- package/dist/destinations/schematic/index.d.ts +4 -0
- package/dist/destinations/schematic/index.js +58 -0
- package/dist/destinations/schematic/index.js.map +1 -0
- package/dist/destinations/schematic/trackEvent/generated-types.d.ts +13 -0
- package/dist/destinations/schematic/trackEvent/generated-types.js +3 -0
- package/dist/destinations/schematic/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/schematic/trackEvent/index.d.ts +5 -0
- package/dist/destinations/schematic/trackEvent/index.js +89 -0
- package/dist/destinations/schematic/trackEvent/index.js.map +1 -0
- package/dist/destinations/surveysparrow/createContact/generated-types.d.ts +10 -0
- package/dist/destinations/surveysparrow/createContact/generated-types.js +3 -0
- package/dist/destinations/surveysparrow/createContact/generated-types.js.map +1 -0
- package/dist/destinations/surveysparrow/createContact/index.d.ts +5 -0
- package/dist/destinations/surveysparrow/createContact/index.js +105 -0
- package/dist/destinations/surveysparrow/createContact/index.js.map +1 -0
- package/dist/destinations/surveysparrow/generated-types.d.ts +3 -0
- package/dist/destinations/surveysparrow/generated-types.js +3 -0
- package/dist/destinations/surveysparrow/generated-types.js.map +1 -0
- package/dist/destinations/surveysparrow/index.d.ts +4 -0
- package/dist/destinations/surveysparrow/index.js +40 -0
- package/dist/destinations/surveysparrow/index.js.map +1 -0
- package/dist/destinations/surveysparrow/triggerSurvey/generated-types.d.ts +10 -0
- package/dist/destinations/surveysparrow/triggerSurvey/generated-types.js +3 -0
- package/dist/destinations/surveysparrow/triggerSurvey/generated-types.js.map +1 -0
- package/dist/destinations/surveysparrow/triggerSurvey/index.d.ts +8 -0
- package/dist/destinations/surveysparrow/triggerSurvey/index.js +165 -0
- package/dist/destinations/surveysparrow/triggerSurvey/index.js.map +1 -0
- package/dist/destinations/tiktok-conversions-sandbox/common_fields.d.ts +2 -0
- package/dist/destinations/tiktok-conversions-sandbox/common_fields.js +244 -0
- package/dist/destinations/tiktok-conversions-sandbox/common_fields.js.map +1 -0
- package/dist/destinations/tiktok-conversions-sandbox/formatter.d.ts +3 -0
- package/dist/destinations/tiktok-conversions-sandbox/formatter.js +43 -0
- package/dist/destinations/tiktok-conversions-sandbox/formatter.js.map +1 -0
- package/dist/destinations/tiktok-conversions-sandbox/generated-types.d.ts +4 -0
- package/dist/destinations/tiktok-conversions-sandbox/generated-types.js +3 -0
- package/dist/destinations/tiktok-conversions-sandbox/generated-types.js.map +1 -0
- package/dist/destinations/tiktok-conversions-sandbox/index.d.ts +4 -0
- package/dist/destinations/tiktok-conversions-sandbox/index.js +247 -0
- package/dist/destinations/tiktok-conversions-sandbox/index.js.map +1 -0
- package/dist/destinations/tiktok-conversions-sandbox/reportWebEvent/generated-types.d.ts +33 -0
- package/dist/destinations/tiktok-conversions-sandbox/reportWebEvent/generated-types.js +3 -0
- package/dist/destinations/tiktok-conversions-sandbox/reportWebEvent/generated-types.js.map +1 -0
- package/dist/destinations/tiktok-conversions-sandbox/reportWebEvent/index.d.ts +5 -0
- package/dist/destinations/tiktok-conversions-sandbox/reportWebEvent/index.js +16 -0
- package/dist/destinations/tiktok-conversions-sandbox/reportWebEvent/index.js.map +1 -0
- package/dist/destinations/tiktok-conversions-sandbox/utils.d.ts +4 -0
- package/dist/destinations/tiktok-conversions-sandbox/utils.js +65 -0
- package/dist/destinations/tiktok-conversions-sandbox/utils.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions/common_fields.js +20 -179
- package/dist/destinations/tiktok-offline-conversions/common_fields.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions/formatter.d.ts +0 -1
- package/dist/destinations/tiktok-offline-conversions/formatter.js +1 -11
- package/dist/destinations/tiktok-offline-conversions/formatter.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions/index.js +15 -169
- package/dist/destinations/tiktok-offline-conversions/index.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/generated-types.d.ts +2 -25
- package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js +29 -4
- package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/generated-types.d.ts +5 -18
- package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.js +126 -5
- package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions-sandbox/common_fields.d.ts +2 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/common_fields.js +244 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/common_fields.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/formatter.d.ts +3 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/formatter.js +43 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/formatter.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/generated-types.d.ts +4 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/generated-types.js +3 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/generated-types.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/index.d.ts +4 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/index.js +251 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/index.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/reportOfflineEvent/generated-types.js +3 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/reportOfflineEvent/generated-types.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/reportOfflineEvent/index.d.ts +5 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/reportOfflineEvent/index.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackNonPaymentOfflineConversion/generated-types.d.ts +33 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackNonPaymentOfflineConversion/generated-types.js +3 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackNonPaymentOfflineConversion/generated-types.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackNonPaymentOfflineConversion/index.d.ts +5 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackNonPaymentOfflineConversion/index.js +16 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackNonPaymentOfflineConversion/index.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackPaymentOfflineConversion/generated-types.d.ts +33 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackPaymentOfflineConversion/generated-types.js +3 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackPaymentOfflineConversion/generated-types.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackPaymentOfflineConversion/index.d.ts +5 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackPaymentOfflineConversion/index.js +16 -0
- package/dist/destinations/tiktok-offline-conversions-sandbox/trackPaymentOfflineConversion/index.js.map +1 -0
- package/dist/destinations/{tiktok-offline-conversions → tiktok-offline-conversions-sandbox}/utils.js +10 -9
- package/dist/destinations/tiktok-offline-conversions-sandbox/utils.js.map +1 -0
- package/package.json +4 -4
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/generated-types.js.map +0 -1
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/index.js.map +0 -1
- package/dist/destinations/tiktok-offline-conversions/utils.js.map +0 -1
- /package/dist/destinations/{tiktok-offline-conversions/reportOfflineEvent → amazon-ads}/generated-types.js +0 -0
- /package/dist/destinations/{tiktok-offline-conversions/reportOfflineEvent → courier/postToCourier}/index.d.ts +0 -0
- /package/dist/destinations/{tiktok-offline-conversions → tiktok-offline-conversions-sandbox}/reportOfflineEvent/generated-types.d.ts +0 -0
- /package/dist/destinations/{tiktok-offline-conversions → tiktok-offline-conversions-sandbox}/reportOfflineEvent/index.js +0 -0
- /package/dist/destinations/{tiktok-offline-conversions → tiktok-offline-conversions-sandbox}/utils.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common_fields.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-offline-conversions/common_fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAA+B;IACtD,KAAK,EAAE;QACL,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"common_fields.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-offline-conversions/common_fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAA+B;IACtD,KAAK,EAAE;QACL,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,0NAA0N;KAC7N;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,gOAAgO;QAClO,OAAO,EAAE;YACP,OAAO,EAAE,aAAa;SACvB;KACF;IACD,SAAS,EAAE;QACT,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,wFAAwF;QACrG,OAAO,EAAE;YACP,OAAO,EAAE,aAAa;SACvB;KACF;IACD,aAAa,EAAE;QACb,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,qNAAqN;QACvN,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;Y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EAAE,KAAK,EAAE,OAAO,EAAE;SACnC;QACD,OAAO,EAAE,UAAU;KACpB;CACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.formatPhones = exports.formatEmails = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const formatEmails = (email_addresses) => {
|
|
6
6
|
const result = [];
|
|
@@ -27,16 +27,6 @@ const formatPhones = (phone_numbers) => {
|
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
29
|
exports.formatPhones = formatPhones;
|
|
30
|
-
function formatUserIds(userIds) {
|
|
31
|
-
const result = [];
|
|
32
|
-
if (userIds) {
|
|
33
|
-
userIds.forEach((userId) => {
|
|
34
|
-
result.push(hashAndEncode(userId.toLowerCase()));
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
exports.formatUserIds = formatUserIds;
|
|
40
30
|
function hashAndEncode(property) {
|
|
41
31
|
return crypto_1.createHash('sha256').update(property).digest('hex');
|
|
42
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-offline-conversions/formatter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAK5B,MAAM,YAAY,GAAG,CAAC,eAAqC,EAAY,EAAE;IAC9E,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,eAAe,EAAE;QACnB,eAAe,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,EAAE;YACxC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;KACH;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AARY,QAAA,YAAY,gBAQxB;AAOM,MAAM,YAAY,GA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IAEjC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,EAAE;QACtC,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAClD,IAAI,cAAc,KAAK,IAAI,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qCAAqC,CAAC,CAAA;SAC/D;QAED,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAA;QAEzD,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAC7D,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAhBY,QAAA,YAAY,gBAgBxB;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5D,CAAC"}
|
|
@@ -6,49 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const actions_core_1 = require("@segment/actions-core");
|
|
7
7
|
const trackPaymentOfflineConversion_1 = __importDefault(require("./trackPaymentOfflineConversion"));
|
|
8
8
|
const trackNonPaymentOfflineConversion_1 = __importDefault(require("./trackNonPaymentOfflineConversion"));
|
|
9
|
-
const reportOfflineEvent_1 = __importDefault(require("./reportOfflineEvent"));
|
|
10
|
-
const productProperties = {
|
|
11
|
-
price: {
|
|
12
|
-
'@path': '$.price'
|
|
13
|
-
},
|
|
14
|
-
quantity: {
|
|
15
|
-
'@path': '$.quantity'
|
|
16
|
-
},
|
|
17
|
-
content_category: {
|
|
18
|
-
'@path': '$.category'
|
|
19
|
-
},
|
|
20
|
-
content_id: {
|
|
21
|
-
'@path': '$.product_id'
|
|
22
|
-
},
|
|
23
|
-
content_name: {
|
|
24
|
-
'@path': '$.name'
|
|
25
|
-
},
|
|
26
|
-
brand: {
|
|
27
|
-
'@path': '$.brand'
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const singleProductContents = {
|
|
31
|
-
...actions_core_1.defaultValues(reportOfflineEvent_1.default.fields),
|
|
32
|
-
contents: {
|
|
33
|
-
'@arrayPath': [
|
|
34
|
-
'$.properties',
|
|
35
|
-
{
|
|
36
|
-
...productProperties
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const multiProductContents = {
|
|
42
|
-
...actions_core_1.defaultValues(reportOfflineEvent_1.default.fields),
|
|
43
|
-
contents: {
|
|
44
|
-
'@arrayPath': [
|
|
45
|
-
'$.properties.products',
|
|
46
|
-
{
|
|
47
|
-
...productProperties
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
9
|
const destination = {
|
|
53
10
|
name: 'TikTok Offline Conversions',
|
|
54
11
|
slug: 'actions-tiktok-offline-conversions',
|
|
@@ -58,14 +15,14 @@ const destination = {
|
|
|
58
15
|
fields: {
|
|
59
16
|
accessToken: {
|
|
60
17
|
label: 'Access Token',
|
|
61
|
-
description: 'Your TikTok Access Token. Please see TikTok’s [Events API
|
|
18
|
+
description: 'Your TikTok Access Token. Please see TikTok’s [Events API documentation](https://ads.tiktok.com/marketing_api/docs?rid=mcxl4tclmfa&id=1758051319816193) for information on how to generate an access token via the TikTok Ads Manager or API.',
|
|
62
19
|
type: 'string',
|
|
63
20
|
required: true
|
|
64
21
|
},
|
|
65
22
|
eventSetID: {
|
|
66
23
|
label: 'Event Set ID',
|
|
67
24
|
type: 'string',
|
|
68
|
-
description: 'Your TikTok Offline Event Set ID. Please see TikTok’s [Events API
|
|
25
|
+
description: 'Your TikTok Offline Event Set ID. Please see TikTok’s [Events API documentation](https://ads.tiktok.com/marketing_api/docs?rid=mcxl4tclmfa&id=1758051319816193) for information on how to find this value.',
|
|
69
26
|
required: true
|
|
70
27
|
}
|
|
71
28
|
},
|
|
@@ -92,159 +49,48 @@ const destination = {
|
|
|
92
49
|
presets: [
|
|
93
50
|
{
|
|
94
51
|
name: 'Complete Payment',
|
|
95
|
-
subscribe: 'event = "
|
|
96
|
-
partnerAction: '
|
|
52
|
+
subscribe: 'type = "track" and event = "Order Completed"',
|
|
53
|
+
partnerAction: 'trackPaymentOfflineConversion',
|
|
97
54
|
mapping: {
|
|
98
|
-
...
|
|
55
|
+
...actions_core_1.defaultValues(trackPaymentOfflineConversion_1.default.fields),
|
|
99
56
|
event: 'CompletePayment'
|
|
100
57
|
},
|
|
101
58
|
type: 'automatic'
|
|
102
59
|
},
|
|
103
60
|
{
|
|
104
61
|
name: 'Contact',
|
|
105
|
-
subscribe: 'event = "
|
|
106
|
-
partnerAction: '
|
|
62
|
+
subscribe: 'type = "track" and event = "User Contacted Call Center"',
|
|
63
|
+
partnerAction: 'trackNonPaymentOfflineConversion',
|
|
107
64
|
mapping: {
|
|
108
|
-
...actions_core_1.defaultValues(
|
|
65
|
+
...actions_core_1.defaultValues(trackNonPaymentOfflineConversion_1.default.fields),
|
|
109
66
|
event: 'Contact'
|
|
110
67
|
},
|
|
111
68
|
type: 'automatic'
|
|
112
69
|
},
|
|
113
70
|
{
|
|
114
71
|
name: 'Subscribe',
|
|
115
|
-
subscribe: 'event = "
|
|
116
|
-
partnerAction: '
|
|
72
|
+
subscribe: 'type = "track" and event = "User Subscribed In Store"',
|
|
73
|
+
partnerAction: 'trackNonPaymentOfflineConversion',
|
|
117
74
|
mapping: {
|
|
118
|
-
...actions_core_1.defaultValues(
|
|
75
|
+
...actions_core_1.defaultValues(trackNonPaymentOfflineConversion_1.default.fields),
|
|
119
76
|
event: 'Subscribe'
|
|
120
77
|
},
|
|
121
78
|
type: 'automatic'
|
|
122
79
|
},
|
|
123
80
|
{
|
|
124
81
|
name: 'Submit Form',
|
|
125
|
-
subscribe: 'event = "Form Submitted"',
|
|
126
|
-
partnerAction: '
|
|
82
|
+
subscribe: 'type = "track" and event = "Form Submitted"',
|
|
83
|
+
partnerAction: 'trackNonPaymentOfflineConversion',
|
|
127
84
|
mapping: {
|
|
128
|
-
...actions_core_1.defaultValues(
|
|
85
|
+
...actions_core_1.defaultValues(trackNonPaymentOfflineConversion_1.default.fields),
|
|
129
86
|
event: 'SubmitForm'
|
|
130
87
|
},
|
|
131
88
|
type: 'automatic'
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: 'Page View',
|
|
135
|
-
subscribe: 'type="page"',
|
|
136
|
-
partnerAction: 'reportOfflineEvent',
|
|
137
|
-
mapping: {
|
|
138
|
-
...multiProductContents,
|
|
139
|
-
event: 'PageView'
|
|
140
|
-
},
|
|
141
|
-
type: 'automatic'
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
name: 'View Content',
|
|
145
|
-
subscribe: 'event = "Product Viewed"',
|
|
146
|
-
partnerAction: 'reportOfflineEvent',
|
|
147
|
-
mapping: {
|
|
148
|
-
...singleProductContents,
|
|
149
|
-
event: 'ViewContent'
|
|
150
|
-
},
|
|
151
|
-
type: 'automatic'
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: 'Click Button',
|
|
155
|
-
subscribe: 'event = "Product Clicked"',
|
|
156
|
-
partnerAction: 'reportOfflineEvent',
|
|
157
|
-
mapping: {
|
|
158
|
-
...singleProductContents,
|
|
159
|
-
event: 'ClickButton'
|
|
160
|
-
},
|
|
161
|
-
type: 'automatic'
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
name: 'Search',
|
|
165
|
-
subscribe: 'event = "Products Searched"',
|
|
166
|
-
partnerAction: 'reportOfflineEvent',
|
|
167
|
-
mapping: {
|
|
168
|
-
...singleProductContents,
|
|
169
|
-
event: 'Search'
|
|
170
|
-
},
|
|
171
|
-
type: 'automatic'
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
name: 'Add to Wishlist',
|
|
175
|
-
subscribe: 'event = "Product Added to Wishlist"',
|
|
176
|
-
partnerAction: 'reportOfflineEvent',
|
|
177
|
-
mapping: {
|
|
178
|
-
...singleProductContents,
|
|
179
|
-
event: 'AddToWishlist'
|
|
180
|
-
},
|
|
181
|
-
type: 'automatic'
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
name: 'Add to Cart',
|
|
185
|
-
subscribe: 'event = "Product Added"',
|
|
186
|
-
partnerAction: 'reportOfflineEvent',
|
|
187
|
-
mapping: {
|
|
188
|
-
...singleProductContents,
|
|
189
|
-
event: 'AddToCart'
|
|
190
|
-
},
|
|
191
|
-
type: 'automatic'
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
name: 'Initiate Checkout',
|
|
195
|
-
subscribe: 'event = "Checkout Started"',
|
|
196
|
-
partnerAction: 'reportOfflineEvent',
|
|
197
|
-
mapping: {
|
|
198
|
-
...multiProductContents,
|
|
199
|
-
event: 'InitiateCheckout'
|
|
200
|
-
},
|
|
201
|
-
type: 'automatic'
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
name: 'Add Payment Info',
|
|
205
|
-
subscribe: 'event = "Payment Info Entered"',
|
|
206
|
-
partnerAction: 'reportOfflineEvent',
|
|
207
|
-
mapping: {
|
|
208
|
-
...multiProductContents,
|
|
209
|
-
event: 'AddPaymentInfo'
|
|
210
|
-
},
|
|
211
|
-
type: 'automatic'
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
name: 'Place an Order',
|
|
215
|
-
subscribe: 'event = "Order Completed"',
|
|
216
|
-
partnerAction: 'reportOfflineEvent',
|
|
217
|
-
mapping: {
|
|
218
|
-
...multiProductContents,
|
|
219
|
-
event: 'PlaceAnOrder'
|
|
220
|
-
},
|
|
221
|
-
type: 'automatic'
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
name: 'Download',
|
|
225
|
-
subscribe: 'event = "Download Link Clicked"',
|
|
226
|
-
partnerAction: 'reportOfflineEvent',
|
|
227
|
-
mapping: {
|
|
228
|
-
...actions_core_1.defaultValues(reportOfflineEvent_1.default.fields),
|
|
229
|
-
event: 'Download'
|
|
230
|
-
},
|
|
231
|
-
type: 'automatic'
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
name: 'Complete Registration',
|
|
235
|
-
subscribe: 'event = "Signed Up"',
|
|
236
|
-
partnerAction: 'reportOfflineEvent',
|
|
237
|
-
mapping: {
|
|
238
|
-
...actions_core_1.defaultValues(reportOfflineEvent_1.default.fields),
|
|
239
|
-
event: 'CompleteRegistration'
|
|
240
|
-
},
|
|
241
|
-
type: 'automatic'
|
|
242
89
|
}
|
|
243
90
|
],
|
|
244
91
|
actions: {
|
|
245
92
|
trackPaymentOfflineConversion: trackPaymentOfflineConversion_1.default,
|
|
246
|
-
trackNonPaymentOfflineConversion: trackNonPaymentOfflineConversion_1.default
|
|
247
|
-
reportOfflineEvent: reportOfflineEvent_1.default
|
|
93
|
+
trackNonPaymentOfflineConversion: trackNonPaymentOfflineConversion_1.default
|
|
248
94
|
}
|
|
249
95
|
};
|
|
250
96
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-offline-conversions/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAE5E,oGAA2E;AAC3E,0GAAiF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-offline-conversions/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAE5E,oGAA2E;AAC3E,0GAAiF;AAEjF,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE,oCAAoC;IAC1C,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,cAAc;gBACrB,WAAW,EACT,+OAA+O;gBACjP,IAAI,EAAE,Q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AAK,EAAE,WAAW;aACnB;YACD,IAAI,EAAE,WAAW;SAClB;QACD;YACE,IAAI,EAAE,aAAa;YACnB,SAAS,EAAE,6CAA6C;YACxD,aAAa,EAAE,kCAAkC;YACjD,OAAO,EAAE;gBACP,GAAG,4BAAa,CAAC,0CAAgC,CAAC,MAAM,CAAC;gBACzD,KAAK,EAAE,YAAY;aACpB;YACD,IAAI,EAAE,WAAW;SAClB;KACF;IACD,OAAO,EAAE;QACP,6BAA6B,EAA7B,uCAA6B;QAC7B,gCAAgC,EAAhC,0CAAgC;KACjC;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,33 +1,10 @@
|
|
|
1
1
|
export interface Payload {
|
|
2
2
|
event: string;
|
|
3
3
|
event_id?: string;
|
|
4
|
-
timestamp
|
|
4
|
+
timestamp: string;
|
|
5
5
|
phone_numbers?: string[];
|
|
6
6
|
email_addresses?: string[];
|
|
7
7
|
order_id?: string;
|
|
8
8
|
shop_id?: string;
|
|
9
|
-
|
|
10
|
-
ttclid?: string;
|
|
11
|
-
ttp?: string;
|
|
12
|
-
lead_id?: string;
|
|
13
|
-
locale?: string;
|
|
14
|
-
url?: string;
|
|
15
|
-
referrer?: string;
|
|
16
|
-
ip?: string;
|
|
17
|
-
user_agent?: string;
|
|
18
|
-
contents?: {
|
|
19
|
-
price?: number;
|
|
20
|
-
quantity?: number;
|
|
21
|
-
content_category?: string;
|
|
22
|
-
content_id?: string;
|
|
23
|
-
content_name?: string;
|
|
24
|
-
brand?: string;
|
|
25
|
-
}[];
|
|
26
|
-
content_type?: string;
|
|
27
|
-
currency?: string;
|
|
28
|
-
value?: number;
|
|
29
|
-
description?: string;
|
|
30
|
-
query?: string;
|
|
31
|
-
limited_data_use?: boolean;
|
|
32
|
-
test_event_code?: string;
|
|
9
|
+
event_channel?: string;
|
|
33
10
|
}
|
package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const common_fields_1 = require("../common_fields");
|
|
4
|
-
const
|
|
5
|
+
const formatter_1 = require("../formatter");
|
|
5
6
|
const action = {
|
|
6
|
-
title: '
|
|
7
|
-
description:
|
|
7
|
+
title: 'Track Non Payment Offline Conversion',
|
|
8
|
+
description: 'Send a non payment related event to the TikTok Offline Conversions API',
|
|
8
9
|
fields: {
|
|
9
10
|
...common_fields_1.commonFields
|
|
10
11
|
},
|
|
11
12
|
perform: (request, { payload, settings }) => {
|
|
12
|
-
|
|
13
|
+
const phone_numbers = formatter_1.formatPhones(payload.phone_numbers);
|
|
14
|
+
const emails = formatter_1.formatEmails(payload.email_addresses);
|
|
15
|
+
if (phone_numbers.length < 1 && emails.length < 1)
|
|
16
|
+
throw new actions_core_1.PayloadValidationError('TikTok Offline Conversions API requires an email address and/or phone number');
|
|
17
|
+
return request('https://business-api.tiktok.com/open_api/v1.3/offline/track/', {
|
|
18
|
+
method: 'post',
|
|
19
|
+
json: {
|
|
20
|
+
event_set_id: settings.eventSetID,
|
|
21
|
+
event: payload.event,
|
|
22
|
+
event_id: payload.event_id ? `${payload.event_id}` : undefined,
|
|
23
|
+
timestamp: payload.timestamp,
|
|
24
|
+
context: {
|
|
25
|
+
user: {
|
|
26
|
+
phone_numbers,
|
|
27
|
+
emails
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
properties: {
|
|
31
|
+
order_id: payload.order_id,
|
|
32
|
+
shop_id: payload.shop_id,
|
|
33
|
+
event_channel: payload.event_channel
|
|
34
|
+
},
|
|
35
|
+
partner_name: 'Segment'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
13
38
|
}
|
|
14
39
|
};
|
|
15
40
|
exports.default = action;
|
package/dist/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-offline-conversions/trackNonPaymentOfflineConversion/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAGhF,oDAA+C;AAC/C,4CAAyD;AAEzD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,sCAAsC;IAC7C,WAAW,EAAE,wEAAwE;IACrF,MAAM,EAAE;QACN,GAAG,4BAAY;KAChB;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,MAAM,aAAa,GAAG,wBAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;QACzD,MAAM,MAAM,GAAG,wBAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;QAEpD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YAC/C,MAAM,IAAI,qCAAsB,CAAC,8EAA8E,CAAC,CAAA;QAElH,OAAO,OAAO,CAAC,8DAA8D,EAAE;YAC7E,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,YAAY,EAAE,QAAQ,CAAC,UAAU;gBACjC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;gBAC9D,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,OAAO,EAAE;oBACP,IAAI,EAAE;wBACJ,aAAa;wBACb,MAAM;qBACP;iBACF;gBACD,UAAU,EAAE;oBACV,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,aAAa,EAAE,OAAO,CAAC,aAAa;iBACrC;gBACD,YAAY,EAAE,SAAS;aACxB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -6,28 +6,15 @@ export interface Payload {
|
|
|
6
6
|
email_addresses?: string[];
|
|
7
7
|
order_id?: string;
|
|
8
8
|
shop_id?: string;
|
|
9
|
-
|
|
10
|
-
ttclid?: string;
|
|
11
|
-
ttp?: string;
|
|
12
|
-
lead_id?: string;
|
|
13
|
-
locale?: string;
|
|
14
|
-
url?: string;
|
|
15
|
-
referrer?: string;
|
|
16
|
-
ip?: string;
|
|
17
|
-
user_agent?: string;
|
|
9
|
+
event_channel?: string;
|
|
18
10
|
contents?: {
|
|
19
11
|
price?: number;
|
|
20
12
|
quantity?: number;
|
|
21
|
-
|
|
13
|
+
content_type?: string;
|
|
22
14
|
content_id?: string;
|
|
23
15
|
content_name?: string;
|
|
24
|
-
|
|
16
|
+
content_category?: string;
|
|
25
17
|
}[];
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
value?: number;
|
|
29
|
-
description?: string;
|
|
30
|
-
query?: string;
|
|
31
|
-
limited_data_use?: boolean;
|
|
32
|
-
test_event_code?: string;
|
|
18
|
+
currency: string;
|
|
19
|
+
value: number;
|
|
33
20
|
}
|
|
@@ -1,15 +1,136 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
3
4
|
const common_fields_1 = require("../common_fields");
|
|
4
|
-
const
|
|
5
|
+
const formatter_1 = require("../formatter");
|
|
5
6
|
const action = {
|
|
6
|
-
title: '
|
|
7
|
-
description:
|
|
7
|
+
title: 'Track Payment Offline Conversion',
|
|
8
|
+
description: 'Send details of an in-store purchase or console purchase to the Tiktok Offline Events API',
|
|
8
9
|
fields: {
|
|
9
|
-
...common_fields_1.commonFields
|
|
10
|
+
...common_fields_1.commonFields,
|
|
11
|
+
timestamp: {
|
|
12
|
+
label: 'Event Timestamp',
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Timestamp that the event took place, in ISO 8601 format. e.g. 2019-06-12T19:11:01.152Z',
|
|
15
|
+
default: {
|
|
16
|
+
'@path': '$.timestamp'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
contents: {
|
|
20
|
+
label: 'Contents',
|
|
21
|
+
type: 'object',
|
|
22
|
+
multiple: true,
|
|
23
|
+
description: 'Array of product or content items for the offline event.',
|
|
24
|
+
properties: {
|
|
25
|
+
price: {
|
|
26
|
+
label: 'Price',
|
|
27
|
+
description: 'Price of the product or content item. Price is a required field for all content items.',
|
|
28
|
+
type: 'number'
|
|
29
|
+
},
|
|
30
|
+
quantity: {
|
|
31
|
+
label: 'Quantity',
|
|
32
|
+
description: 'Quantity of this product ot item in the offline event. Quantity is a required field for all content items.',
|
|
33
|
+
type: 'number'
|
|
34
|
+
},
|
|
35
|
+
content_type: {
|
|
36
|
+
label: 'Content Type',
|
|
37
|
+
description: 'Product type',
|
|
38
|
+
type: 'string'
|
|
39
|
+
},
|
|
40
|
+
content_id: {
|
|
41
|
+
label: 'Content ID',
|
|
42
|
+
description: 'Product or content item identifier. Content ID is a required field for all product or content items.',
|
|
43
|
+
type: 'string'
|
|
44
|
+
},
|
|
45
|
+
content_name: {
|
|
46
|
+
label: 'Content Name',
|
|
47
|
+
description: 'Name of the product or content item.',
|
|
48
|
+
type: 'string'
|
|
49
|
+
},
|
|
50
|
+
content_category: {
|
|
51
|
+
label: 'Content Category',
|
|
52
|
+
description: 'Category of the product or content item.',
|
|
53
|
+
type: 'string'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
default: {
|
|
57
|
+
'@arrayPath': [
|
|
58
|
+
'$.properties.products',
|
|
59
|
+
{
|
|
60
|
+
price: {
|
|
61
|
+
'@path': 'price'
|
|
62
|
+
},
|
|
63
|
+
quantity: {
|
|
64
|
+
'@path': 'quantity'
|
|
65
|
+
},
|
|
66
|
+
content_type: {
|
|
67
|
+
'@path': 'type'
|
|
68
|
+
},
|
|
69
|
+
content_id: {
|
|
70
|
+
'@path': 'product_id'
|
|
71
|
+
},
|
|
72
|
+
content_name: {
|
|
73
|
+
'@path': 'name'
|
|
74
|
+
},
|
|
75
|
+
content_category: {
|
|
76
|
+
'@path': 'category'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
currency: {
|
|
83
|
+
label: 'Currency',
|
|
84
|
+
type: 'string',
|
|
85
|
+
required: true,
|
|
86
|
+
description: 'ISO 4217 code. Required for revenue reporting. Example: "USD".List of currencies currently supported: AED, ARS, AUD, BDT, BHD, BIF, BOB, BRL, CAD, CHF, CLP, CNY, COP, CRC, CZK, DKK, DZD, EGP, EUR, GBP, GTQ, HKD, HNL, HUF, IDR, ILS, INR, ISK, JPY, KES, KHR, KRW, KWD, KZT, MAD, MOP, MXN, MYR, NGN, NIO, NOK, NZD, OMR, PEN, PHP, PHP, PKR, PLN, PYG, QAR, RON, RUB, SAR, SEK, SGD, THB, TRY, TWD, UAH, USD, VES, VND, ZAR.',
|
|
87
|
+
default: {
|
|
88
|
+
'@path': '$.properties.currency'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
value: {
|
|
92
|
+
label: 'Value',
|
|
93
|
+
type: 'number',
|
|
94
|
+
required: true,
|
|
95
|
+
description: 'Revenue of total products or content items. Required for revenue reporting. Must be a number. e.g. 101.99 and not "101.99 USD"',
|
|
96
|
+
default: {
|
|
97
|
+
'@if': {
|
|
98
|
+
exists: { '@path': '$.properties.value' },
|
|
99
|
+
then: { '@path': '$.properties.value' },
|
|
100
|
+
else: { '@path': '$.properties.revenue' }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
10
104
|
},
|
|
11
105
|
perform: (request, { payload, settings }) => {
|
|
12
|
-
|
|
106
|
+
const phone_numbers = formatter_1.formatPhones(payload.phone_numbers);
|
|
107
|
+
const emails = formatter_1.formatEmails(payload.email_addresses);
|
|
108
|
+
if (phone_numbers.length < 1 && emails.length < 1)
|
|
109
|
+
throw new actions_core_1.PayloadValidationError('TikTok Offline Conversions API requires an email address and/or phone number');
|
|
110
|
+
return request('https://business-api.tiktok.com/open_api/v1.3/offline/track/', {
|
|
111
|
+
method: 'post',
|
|
112
|
+
json: {
|
|
113
|
+
event_set_id: settings.eventSetID,
|
|
114
|
+
event: payload.event,
|
|
115
|
+
event_id: payload.event_id ? `${payload.event_id}` : undefined,
|
|
116
|
+
timestamp: payload.timestamp,
|
|
117
|
+
context: {
|
|
118
|
+
user: {
|
|
119
|
+
phone_numbers,
|
|
120
|
+
emails
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
properties: {
|
|
124
|
+
order_id: payload.order_id,
|
|
125
|
+
shop_id: payload.shop_id,
|
|
126
|
+
contents: payload.contents,
|
|
127
|
+
currency: payload.currency,
|
|
128
|
+
value: payload.value,
|
|
129
|
+
event_channel: payload.event_channel
|
|
130
|
+
},
|
|
131
|
+
partner_name: 'Segment'
|
|
132
|
+
}
|
|
133
|
+
});
|
|
13
134
|
}
|
|
14
135
|
};
|
|
15
136
|
exports.default = action;
|
package/dist/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-offline-conversions/trackPaymentOfflineConversion/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAGhF,oDAA+C;AAC/C,4CAAyD;AAEzD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kCAAkC;IACzC,WAAW,EAAE,2FAA2F;IACxG,MAAM,EAAE;QACN,GAAG,4BAAY;Q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