@segment/action-destinations 3.49.2-alpha.1 → 3.49.2-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-enhanced-conversions/postConversion/formatter.js +0 -3
- package/dist/destinations/google-enhanced-conversions/postConversion/formatter.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/postConversion/generated-types.d.ts +0 -1
- package/dist/destinations/google-enhanced-conversions/postConversion/index.js +1 -10
- package/dist/destinations/google-enhanced-conversions/postConversion/index.js.map +1 -1
- package/dist/destinations/tiktok-conversions/index.js +32 -14
- package/dist/destinations/tiktok-conversions/index.js.map +1 -1
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.d.ts +3 -3
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js +9 -3
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js.map +1 -1
- package/dist/destinations/tiktok-conversions/reportWebEvent/generated-types.d.ts +16 -6
- package/dist/destinations/tiktok-conversions/reportWebEvent/index.js +177 -27
- package/dist/destinations/tiktok-conversions/reportWebEvent/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -9,9 +9,6 @@ function cleanData(data) {
|
|
|
9
9
|
const obj = {};
|
|
10
10
|
for (const key in data) {
|
|
11
11
|
const value = data[key];
|
|
12
|
-
if (key === 'is_app_incrementality' && data[key] === 0) {
|
|
13
|
-
obj[key] = 0;
|
|
14
|
-
}
|
|
15
12
|
if (Array.isArray(value)) {
|
|
16
13
|
const filtered = value.filter((item) => item);
|
|
17
14
|
if (filtered.length !== 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/postConversion/formatter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAUnC,SAAgB,SAAS,CAAC,IAAgB;IACxC,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,OAAO,EAAE,CAAA;KACV;IACD,MAAM,GAAG,GAA+B,EAAE,CAAA;IAC1C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;QACvB,IAAI,
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/postConversion/formatter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAUnC,SAAgB,SAAS,CAAC,IAAgB;IACxC,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,OAAO,EAAE,CAAA;KACV;IACD,MAAM,GAAG,GAA+B,EAAE,CAAA;IAC1C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAExB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;YAC7C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzB,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;aACpB;SACF;aAAM,IAAI,KAAK,EAAE;YAChB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACjB;KACF;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAlBD,8BAkBC;AAKD,SAAgB,WAAW,CAAC,KAAa;IACvC,IAAI,cAAc,CAAA;IAClB,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE;QAEnG,cAAc,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAGtD,MAAM,IAAI,G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E,CAAA;IACxB,OAAO,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAA;AACrE,CAAC;AAHD,wCAGC;AAED,SAAgB,YAAY,CAAC,MAAe;IAC1C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAA;IACtB,OAAO,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;AAC5C,CAAC;AAHD,oCAGC;AAED,SAAgB,UAAU,CAAC,IAAa;IACtC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAA;IACpB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;AAClD,CAAC;AAHD,gCAGC;AAED,SAAgB,YAAY,CAAC,MAAe;IAC1C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAA;IACtB,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;AACpD,CAAC;AAHD,oCAGC;AAED,SAAS,aAAa,CAAC,QAAgB;IAErC,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACvG,CAAC"}
|
|
@@ -53,13 +53,6 @@ const action = {
|
|
|
53
53
|
'@path': '$.timestamp'
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
is_app_incrementality: {
|
|
57
|
-
label: 'App Conversion for Incrementality Study',
|
|
58
|
-
description: 'Set to true if this is an app conversion for an incrementality study.',
|
|
59
|
-
type: 'boolean',
|
|
60
|
-
required: true,
|
|
61
|
-
default: false
|
|
62
|
-
},
|
|
63
56
|
value: {
|
|
64
57
|
label: 'Value',
|
|
65
58
|
description: 'The monetary value attributed to the conversion event.',
|
|
@@ -180,8 +173,7 @@ const action = {
|
|
|
180
173
|
conversion_time: +new Date(payload.conversion_time) * 1000,
|
|
181
174
|
label: payload.conversion_label,
|
|
182
175
|
value: payload.value,
|
|
183
|
-
currency_code: payload.currency_code
|
|
184
|
-
is_app_incrementality: payload.is_app_incrementality ? 1 : 0
|
|
176
|
+
currency_code: payload.currency_code
|
|
185
177
|
});
|
|
186
178
|
const address = formatter_1.cleanData({
|
|
187
179
|
hashed_first_name: formatter_1.formatFirstName(payload.first_name),
|
|
@@ -192,7 +184,6 @@ const action = {
|
|
|
192
184
|
postcode: payload.post_code,
|
|
193
185
|
country: payload.country
|
|
194
186
|
});
|
|
195
|
-
console.log('this is the conversionData:', conversionData);
|
|
196
187
|
if (!payload.email && !Object.keys(address).length) {
|
|
197
188
|
throw new actions_core_1.IntegrationError('Either a valid email address or at least one address property (firstName, lastName, street, city, region, postalCode, or country) is required to send a valid conversion.', 'Missing required fields.', 400);
|
|
198
189
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/postConversion/index.ts"],"names":[],"mappings":";;AAAA,wDAAqF;AAIrF,2CASoB;AAYpB,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,wCAAwC;IACrD,MAAM,EAAE;QAEN,gBAAgB,EAAE;YAChB,KAAK,EAAE,kBAAkB;YACzB,WAAW,EACT,yMAAyM;YAC3M,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;SACZ;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,qEAAqE;YAClF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;iBACpC;aACF;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,UAAU;YACjB,WAAW,EACT,gSAAgS;YAClS,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,sBAAsB;aAChC;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/postConversion/index.ts"],"names":[],"mappings":";;AAAA,wDAAqF;AAIrF,2CASoB;AAYpB,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,wCAAwC;IACrD,MAAM,EAAE;QAEN,gBAAgB,EAAE;YAChB,KAAK,EAAE,kBAAkB;YACzB,WAAW,EACT,yMAAyM;YAC3M,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;SACZ;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,qEAAqE;YAClF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;iBACpC;aACF;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,UAAU;YACjB,WAAW,EACT,gSAAgS;YAClS,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,sBAAs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,MAAM,GAAG,CAAA;SACV;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -7,30 +7,48 @@ const actions_core_1 = require("@segment/actions-core");
|
|
|
7
7
|
const reportWebEvent_1 = __importDefault(require("./reportWebEvent"));
|
|
8
8
|
const presets = [
|
|
9
9
|
{
|
|
10
|
-
name: '
|
|
11
|
-
subscribe: '
|
|
10
|
+
name: 'View Content',
|
|
11
|
+
subscribe: 'type="page"',
|
|
12
12
|
partnerAction: 'reportWebEvent',
|
|
13
13
|
mapping: {
|
|
14
14
|
...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
|
|
15
|
-
event: '
|
|
15
|
+
event: 'ViewContent'
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
name: '
|
|
20
|
-
subscribe: '
|
|
19
|
+
name: 'Search',
|
|
20
|
+
subscribe: 'event = "Products Searched"',
|
|
21
21
|
partnerAction: 'reportWebEvent',
|
|
22
22
|
mapping: {
|
|
23
23
|
...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
|
|
24
|
-
event: '
|
|
24
|
+
event: 'Search'
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
name: '
|
|
29
|
-
subscribe: 'event = "
|
|
28
|
+
name: 'Add to Wishlist',
|
|
29
|
+
subscribe: 'event = "Product Added to Wishlist"',
|
|
30
30
|
partnerAction: 'reportWebEvent',
|
|
31
31
|
mapping: {
|
|
32
32
|
...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
|
|
33
|
-
event: '
|
|
33
|
+
event: 'AddToWishlist'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Add to Cart',
|
|
38
|
+
subscribe: 'event = "Product Added"',
|
|
39
|
+
partnerAction: 'reportWebEvent',
|
|
40
|
+
mapping: {
|
|
41
|
+
...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
|
|
42
|
+
event: 'AddToCart'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Initiate Checkout',
|
|
47
|
+
subscribe: 'event = "Checkout Started"',
|
|
48
|
+
partnerAction: 'reportWebEvent',
|
|
49
|
+
mapping: {
|
|
50
|
+
...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
|
|
51
|
+
event: 'InitiateCheckout'
|
|
34
52
|
}
|
|
35
53
|
},
|
|
36
54
|
{
|
|
@@ -43,12 +61,12 @@ const presets = [
|
|
|
43
61
|
}
|
|
44
62
|
},
|
|
45
63
|
{
|
|
46
|
-
name: 'Order
|
|
64
|
+
name: 'Place an Order',
|
|
47
65
|
subscribe: 'event = "Order Completed"',
|
|
48
66
|
partnerAction: 'reportWebEvent',
|
|
49
67
|
mapping: {
|
|
50
68
|
...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
|
|
51
|
-
event: '
|
|
69
|
+
event: 'PlaceAnOrder'
|
|
52
70
|
}
|
|
53
71
|
}
|
|
54
72
|
];
|
|
@@ -61,14 +79,14 @@ const destination = {
|
|
|
61
79
|
fields: {
|
|
62
80
|
accessToken: {
|
|
63
81
|
label: 'Access Token',
|
|
64
|
-
description:
|
|
82
|
+
description: 'Your TikTok Access Token. Please see TikTok’s [Events API documentation](https://ads.tiktok.com/marketing_api/docs?id=1701890979375106) for information on how to generate an access token via the TikTok Ads Manager or API.',
|
|
65
83
|
type: 'string',
|
|
66
84
|
required: true
|
|
67
85
|
},
|
|
68
86
|
pixel_code: {
|
|
69
87
|
label: 'Pixel Code',
|
|
70
88
|
type: 'string',
|
|
71
|
-
description: '
|
|
89
|
+
description: 'Your TikTok Pixel ID. Please see TikTok’s [Events API documentation](https://ads.tiktok.com/marketing_api/docs?id=1701890979375106) for information on how to find this value.',
|
|
72
90
|
required: true
|
|
73
91
|
}
|
|
74
92
|
},
|
|
@@ -77,7 +95,7 @@ const destination = {
|
|
|
77
95
|
method: 'post',
|
|
78
96
|
json: {
|
|
79
97
|
pixel_code: settings.pixel_code,
|
|
80
|
-
event:
|
|
98
|
+
event: 'Test Event',
|
|
81
99
|
timestamp: '',
|
|
82
100
|
context: {}
|
|
83
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AAGrD,sEAA6C;AAG7C,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AAGrD,sEAA6C;AAG7C,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,aAAa;SACrB;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,6BAA6B;QACxC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,QAAQ;SAChB;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,qCAAqC;QAChD,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,eAAe;SACvB;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,yBAAyB;QACpC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,WAAW;SACnB;KACF;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,SAAS,E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AC,CAAA;QACJ,CAAC;KACF;IACD,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,OAAO,EAAE,EAAE,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE;SAClD,CAAA;IACH,CAAC;IACD,OAAO;IACP,OAAO,EAAE;QACP,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function formatEmail(email: string): string;
|
|
2
|
-
export declare function formatUserId(userId: string): string;
|
|
3
|
-
export declare function formatPhone(phone
|
|
1
|
+
export declare function formatEmail(email: string | undefined): string | undefined;
|
|
2
|
+
export declare function formatUserId(userId: string | undefined): string | undefined;
|
|
3
|
+
export declare function formatPhone(phone: string | undefined): string | undefined;
|
|
@@ -3,16 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.formatPhone = exports.formatUserId = exports.formatEmail = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
function formatEmail(email) {
|
|
6
|
-
|
|
6
|
+
if (email) {
|
|
7
|
+
return hashAndEncode(email.toLowerCase());
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
7
10
|
}
|
|
8
11
|
exports.formatEmail = formatEmail;
|
|
9
12
|
function formatUserId(userId) {
|
|
10
|
-
|
|
13
|
+
if (userId) {
|
|
14
|
+
return hashAndEncode(userId.toLowerCase().trim());
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
11
17
|
}
|
|
12
18
|
exports.formatUserId = formatUserId;
|
|
13
19
|
function formatPhone(phone) {
|
|
14
20
|
if (!phone)
|
|
15
|
-
return
|
|
21
|
+
return undefined;
|
|
16
22
|
const validatedPhone = phone.match(/[0-9]{0,14}/g);
|
|
17
23
|
if (validatedPhone === null) {
|
|
18
24
|
throw new Error(`${phone} is not a valid E.164 phone number.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-conversions/reportWebEvent/formatter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAKnC,SAAgB,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-conversions/reportWebEvent/formatter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAKnC,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,KAAK,EAAE;QACT,OAAO,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;KAC1C;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AALD,kCAKC;AAOD,SAAgB,YAAY,CAAC,MAA0B;IACrD,IAAI,MAAM,EAAE;QACV,OAAO,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;KAClD;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AALD,oCAKC;AAOD,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAE5B,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAClD,IAAI,cAAc,KAAK,IAAI,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qCAAqC,CAAC,CAAA;KAC/D;IAED,IAAI,cAAc,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAA;IAEvD,cAAc,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IAChD,OAAO,aAAa,CAAC,cAAc,CAAC,CAAA;AACtC,CAAC;AAZD,kCAYC;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5D,CAAC"}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
export interface Payload {
|
|
2
|
-
event
|
|
2
|
+
event: string;
|
|
3
3
|
event_id?: string;
|
|
4
4
|
timestamp?: string;
|
|
5
|
-
type?: string;
|
|
6
|
-
properties?: {
|
|
7
|
-
[k: string]: unknown;
|
|
8
|
-
};
|
|
9
5
|
phone_number?: string;
|
|
10
6
|
email?: string;
|
|
11
|
-
external_id
|
|
7
|
+
external_id?: string;
|
|
12
8
|
ttclid?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
referrer?: string;
|
|
11
|
+
ip?: string;
|
|
12
|
+
user_agent?: string;
|
|
13
|
+
contents?: {
|
|
14
|
+
price?: number;
|
|
15
|
+
quantity?: number;
|
|
16
|
+
content_type?: string;
|
|
17
|
+
content_id?: string;
|
|
18
|
+
}[];
|
|
19
|
+
currency?: string;
|
|
20
|
+
value?: number;
|
|
21
|
+
description?: string;
|
|
22
|
+
query?: string;
|
|
13
23
|
}
|
|
@@ -8,10 +8,8 @@ const action = {
|
|
|
8
8
|
event: {
|
|
9
9
|
label: 'Event Name',
|
|
10
10
|
type: 'string',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'@path': '$.event'
|
|
14
|
-
}
|
|
11
|
+
required: true,
|
|
12
|
+
description: 'Conversion event name. Please refer to the "Supported Web Events" section on in TikTok’s [Events API documentation](https://ads.tiktok.com/marketing_api/docs?id=1701890979375106) for accepted event names.'
|
|
15
13
|
},
|
|
16
14
|
event_id: {
|
|
17
15
|
label: 'Event ID',
|
|
@@ -24,25 +22,14 @@ const action = {
|
|
|
24
22
|
timestamp: {
|
|
25
23
|
label: 'Event Timestamp',
|
|
26
24
|
type: 'string',
|
|
27
|
-
description: 'Timestamp that the event took place, in ISO 8601 format.'
|
|
28
|
-
},
|
|
29
|
-
type: {
|
|
30
|
-
label: 'Segment Event Type',
|
|
31
|
-
description: 'The Segment event type, e.g. "page".',
|
|
32
|
-
type: 'string',
|
|
25
|
+
description: 'Timestamp that the event took place, in ISO 8601 format.',
|
|
33
26
|
default: {
|
|
34
|
-
'@path': '$.
|
|
27
|
+
'@path': '$.timestamp'
|
|
35
28
|
}
|
|
36
29
|
},
|
|
37
|
-
properties: {
|
|
38
|
-
label: 'Properties associated with the event',
|
|
39
|
-
description: 'Additional properties such as content info, description, and currency.',
|
|
40
|
-
type: 'object',
|
|
41
|
-
required: false
|
|
42
|
-
},
|
|
43
30
|
phone_number: {
|
|
44
31
|
label: 'Phone Number',
|
|
45
|
-
description: 'Phone number of the user who triggered the conversion event, in E.164 standard format, e.g. +14150000000.',
|
|
32
|
+
description: 'Phone number of the user who triggered the conversion event, in E.164 standard format, e.g. +14150000000. Segment will hash this value before sending to TikTok.',
|
|
46
33
|
type: 'string',
|
|
47
34
|
default: {
|
|
48
35
|
'@if': {
|
|
@@ -54,7 +41,7 @@ const action = {
|
|
|
54
41
|
},
|
|
55
42
|
email: {
|
|
56
43
|
label: 'Email',
|
|
57
|
-
description: 'Email address of the user who triggered the conversion event.',
|
|
44
|
+
description: 'Email address of the user who triggered the conversion event. Segment will hash this value before sending to TikTok.',
|
|
58
45
|
type: 'string',
|
|
59
46
|
format: 'email',
|
|
60
47
|
default: {
|
|
@@ -67,9 +54,8 @@ const action = {
|
|
|
67
54
|
},
|
|
68
55
|
external_id: {
|
|
69
56
|
label: 'External ID',
|
|
70
|
-
description: 'Uniquely identifies the user who triggered the conversion event.',
|
|
57
|
+
description: 'Uniquely identifies the user who triggered the conversion event. Segment will hash this value before sending to TikTok.',
|
|
71
58
|
type: 'string',
|
|
72
|
-
required: true,
|
|
73
59
|
default: {
|
|
74
60
|
'@if': {
|
|
75
61
|
exists: { '@path': '$.userId' },
|
|
@@ -89,15 +75,166 @@ const action = {
|
|
|
89
75
|
else: { '@path': '$.traits.ttclid' }
|
|
90
76
|
}
|
|
91
77
|
}
|
|
78
|
+
},
|
|
79
|
+
url: {
|
|
80
|
+
label: 'Page URL',
|
|
81
|
+
type: 'string',
|
|
82
|
+
description: 'The page URL where the conversion event took place.',
|
|
83
|
+
default: {
|
|
84
|
+
'@path': '$.context.page.url'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
referrer: {
|
|
88
|
+
label: 'Page Referrer',
|
|
89
|
+
type: 'string',
|
|
90
|
+
description: 'The page referrer.',
|
|
91
|
+
default: {
|
|
92
|
+
'@path': '$.context.page.referrer'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
ip: {
|
|
96
|
+
label: 'IP Address',
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'IP address of the browser.',
|
|
99
|
+
default: {
|
|
100
|
+
'@path': '$.context.ip'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
user_agent: {
|
|
104
|
+
label: 'User Agent',
|
|
105
|
+
type: 'string',
|
|
106
|
+
description: 'User agent from the user’s device.',
|
|
107
|
+
default: {
|
|
108
|
+
'@path': '$.context.userAgent'
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
contents: {
|
|
112
|
+
label: 'Contents',
|
|
113
|
+
type: 'object',
|
|
114
|
+
multiple: true,
|
|
115
|
+
description: 'Related items in a web event.',
|
|
116
|
+
default: {
|
|
117
|
+
'@if': {
|
|
118
|
+
exists: {
|
|
119
|
+
'@arrayPath': [
|
|
120
|
+
'$.properties.products',
|
|
121
|
+
{
|
|
122
|
+
price: {
|
|
123
|
+
'@path': '$.price'
|
|
124
|
+
},
|
|
125
|
+
quantity: {
|
|
126
|
+
'@path': '$.quantity'
|
|
127
|
+
},
|
|
128
|
+
content_type: {
|
|
129
|
+
'@path': '$.content_type'
|
|
130
|
+
},
|
|
131
|
+
content_id: {
|
|
132
|
+
'@path': '$.content_id'
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
then: {
|
|
138
|
+
'@arrayPath': [
|
|
139
|
+
'$.properties.products',
|
|
140
|
+
{
|
|
141
|
+
price: {
|
|
142
|
+
'@path': '$.price'
|
|
143
|
+
},
|
|
144
|
+
quantity: {
|
|
145
|
+
'@path': '$.quantity'
|
|
146
|
+
},
|
|
147
|
+
content_type: {
|
|
148
|
+
'@path': '$.content_type'
|
|
149
|
+
},
|
|
150
|
+
content_id: {
|
|
151
|
+
'@path': '$.content_id'
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
else: {
|
|
157
|
+
'@arrayPath': [
|
|
158
|
+
'$.properties',
|
|
159
|
+
{
|
|
160
|
+
price: {
|
|
161
|
+
'@path': '$.price'
|
|
162
|
+
},
|
|
163
|
+
quantity: {
|
|
164
|
+
'@path': '$.quantity'
|
|
165
|
+
},
|
|
166
|
+
content_type: {
|
|
167
|
+
'@path': '$.content_type'
|
|
168
|
+
},
|
|
169
|
+
content_id: {
|
|
170
|
+
'@path': '$.content_id'
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
properties: {
|
|
178
|
+
price: {
|
|
179
|
+
label: 'Price',
|
|
180
|
+
description: 'Price of the item.',
|
|
181
|
+
type: 'number'
|
|
182
|
+
},
|
|
183
|
+
quantity: {
|
|
184
|
+
label: 'Quantity',
|
|
185
|
+
description: 'Number of items.',
|
|
186
|
+
type: 'number'
|
|
187
|
+
},
|
|
188
|
+
content_type: {
|
|
189
|
+
label: 'Content Type',
|
|
190
|
+
description: 'Type of the product item.',
|
|
191
|
+
type: 'string'
|
|
192
|
+
},
|
|
193
|
+
content_id: {
|
|
194
|
+
label: 'Content ID',
|
|
195
|
+
description: 'ID of the product item.',
|
|
196
|
+
type: 'string'
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
currency: {
|
|
201
|
+
label: 'Currency',
|
|
202
|
+
type: 'string',
|
|
203
|
+
description: 'Currency for the value specified as ISO 4217 code.',
|
|
204
|
+
default: {
|
|
205
|
+
'@path': '$.properties.currency'
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
value: {
|
|
209
|
+
label: 'Value',
|
|
210
|
+
type: 'number',
|
|
211
|
+
description: 'Value of the order or items sold.',
|
|
212
|
+
default: {
|
|
213
|
+
'@if': {
|
|
214
|
+
exists: { '@path': '$.properties.value' },
|
|
215
|
+
then: { '@path': '$.properties.value' },
|
|
216
|
+
else: { '@path': '$.properties.revenue' }
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
description: {
|
|
221
|
+
label: 'Description',
|
|
222
|
+
type: 'string',
|
|
223
|
+
description: 'A string description of the web event.'
|
|
224
|
+
},
|
|
225
|
+
query: {
|
|
226
|
+
label: 'Query',
|
|
227
|
+
type: 'string',
|
|
228
|
+
description: 'The text string that was searched for.',
|
|
229
|
+
default: {
|
|
230
|
+
'@path': '$.properties.query'
|
|
231
|
+
}
|
|
92
232
|
}
|
|
93
233
|
},
|
|
94
234
|
perform: (request, { payload, settings }) => {
|
|
95
|
-
const eventId = payload.event_id
|
|
96
|
-
? payload.event_id.toString() + '_' + (Math.random() + 1).toString(36).substring(7)
|
|
97
|
-
: '';
|
|
98
235
|
const userData = {
|
|
99
236
|
hashedExternalId: formatter_1.formatUserId(payload.external_id),
|
|
100
|
-
hashedEmail: formatter_1.formatEmail(payload.email
|
|
237
|
+
hashedEmail: formatter_1.formatEmail(payload.email),
|
|
101
238
|
hashedPhoneNumber: formatter_1.formatPhone(payload.phone_number)
|
|
102
239
|
};
|
|
103
240
|
return request('https://business-api.tiktok.com/open_api/v1.2/pixel/track/', {
|
|
@@ -105,7 +242,7 @@ const action = {
|
|
|
105
242
|
json: {
|
|
106
243
|
pixel_code: settings.pixel_code,
|
|
107
244
|
event: payload.event,
|
|
108
|
-
event_id:
|
|
245
|
+
event_id: payload.event_id,
|
|
109
246
|
timestamp: payload.timestamp,
|
|
110
247
|
context: {
|
|
111
248
|
user: {
|
|
@@ -115,7 +252,20 @@ const action = {
|
|
|
115
252
|
},
|
|
116
253
|
ad: {
|
|
117
254
|
callback: payload.ttclid
|
|
118
|
-
}
|
|
255
|
+
},
|
|
256
|
+
page: {
|
|
257
|
+
url: payload.url,
|
|
258
|
+
referrer: payload.referrer
|
|
259
|
+
},
|
|
260
|
+
ip: payload.ip,
|
|
261
|
+
user_agent: payload.user_agent
|
|
262
|
+
},
|
|
263
|
+
properties: {
|
|
264
|
+
contents: payload.contents,
|
|
265
|
+
currency: payload.currency,
|
|
266
|
+
value: payload.value,
|
|
267
|
+
description: payload.description,
|
|
268
|
+
query: payload.query
|
|
119
269
|
}
|
|
120
270
|
}
|
|
121
271
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-conversions/reportWebEvent/index.ts"],"names":[],"mappings":";;AAGA,2CAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,6JAA6J;IAC/J,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/tiktok-conversions/reportWebEvent/index.ts"],"names":[],"mappings":";;AAGA,2CAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,6JAA6J;IAC/J,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,8MAA8M;SACjN;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wDAAwD;YACrE,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,QAAQ;YAC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AC/B;gBACD,UAAU,EAAE;oBACV,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,KAAK,EAAE,OAAO,CAAC,KAAK;iBACrB;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.49.2-alpha.
|
|
4
|
+
"version": "3.49.2-alpha.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@amplitude/ua-parser-js": "^0.7.25",
|
|
41
|
-
"@segment/actions-core": "^3.22.
|
|
42
|
-
"@segment/actions-shared": "^1.3.
|
|
41
|
+
"@segment/actions-core": "^3.22.1-alpha.2",
|
|
42
|
+
"@segment/actions-shared": "^1.3.1-alpha.2",
|
|
43
43
|
"cheerio": "^1.0.0-rc.10",
|
|
44
44
|
"dayjs": "^1.10.7",
|
|
45
45
|
"escape-goat": "^3",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"<rootDir>/test/setup-after-env.ts"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "858128cc97cfa37fa9afd2294360f5841ffe7ed1"
|
|
66
66
|
}
|