@segment/action-destinations 3.50.0 → 3.50.1-alpha.3

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.
Files changed (32) hide show
  1. package/dist/destinations/gainsight-px-cloud-action/common-fields.js +5 -267
  2. package/dist/destinations/gainsight-px-cloud-action/common-fields.js.map +1 -1
  3. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/generated-types.d.ts +0 -58
  4. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.js +1 -22
  5. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.js.map +1 -1
  6. package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.d.ts +0 -57
  7. package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.js +1 -13
  8. package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.js.map +1 -1
  9. package/dist/destinations/gainsight-px-cloud-action/index.js +5 -1
  10. package/dist/destinations/gainsight-px-cloud-action/index.js.map +1 -1
  11. package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.d.ts +2 -0
  12. package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.js +4 -2
  13. package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.js.map +1 -1
  14. package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.d.ts +0 -58
  15. package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.js +1 -21
  16. package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.js.map +1 -1
  17. package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.d.ts +0 -61
  18. package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.js +1 -44
  19. package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.js.map +1 -1
  20. package/dist/destinations/metronome/index.js +1 -1
  21. package/dist/destinations/metronome/index.js.map +1 -1
  22. package/dist/destinations/metronome/sendEvent/index.js +5 -7
  23. package/dist/destinations/metronome/sendEvent/index.js.map +1 -1
  24. package/dist/destinations/tiktok-conversions/index.js +75 -19
  25. package/dist/destinations/tiktok-conversions/index.js.map +1 -1
  26. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.d.ts +3 -3
  27. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js +9 -3
  28. package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js.map +1 -1
  29. package/dist/destinations/tiktok-conversions/reportWebEvent/generated-types.d.ts +16 -6
  30. package/dist/destinations/tiktok-conversions/reportWebEvent/index.js +116 -27
  31. package/dist/destinations/tiktok-conversions/reportWebEvent/index.js.map +1 -1
  32. package/package.json +4 -4
@@ -1,63 +1,2 @@
1
1
  export interface Payload {
2
- name: string | null;
3
- properties: {
4
- url?: string;
5
- title?: string;
6
- referrer?: string;
7
- path?: string;
8
- };
9
- anonymousId?: string | null;
10
- context: {
11
- campaign?: {
12
- source?: string;
13
- medium?: string;
14
- name?: string;
15
- term?: string;
16
- content?: string;
17
- };
18
- location?: {
19
- city?: string;
20
- country?: string;
21
- latitude?: number;
22
- longitude?: number;
23
- region?: string;
24
- speed?: number;
25
- };
26
- page?: {
27
- path?: string;
28
- referrer?: string;
29
- search?: string;
30
- title?: string;
31
- url?: string;
32
- };
33
- screen?: {
34
- width?: number;
35
- height?: number;
36
- };
37
- app?: {
38
- name?: string;
39
- version?: string;
40
- build?: string;
41
- };
42
- device?: {
43
- [k: string]: unknown;
44
- };
45
- network?: {
46
- [k: string]: unknown;
47
- };
48
- library?: {
49
- name?: string;
50
- version?: string;
51
- };
52
- ip?: string;
53
- locale?: string;
54
- userAgent?: string;
55
- };
56
- messageId: string;
57
- receivedAt: string | number;
58
- sentAt: string | number;
59
- timestamp: string | number;
60
- userId: string | null;
61
- type: string;
62
- version?: number | null;
63
2
  }
@@ -1,54 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const regional_endpoints_1 = require("../regional-endpoints");
4
- const common_fields_1 = require("../common-fields");
5
4
  const action = {
6
5
  title: 'Track Page View',
7
6
  description: 'Send a page view event to Gainsight PX',
8
7
  defaultSubscription: 'type = "page"',
9
- fields: {
10
- name: {
11
- label: 'Page Name',
12
- type: 'string',
13
- allowNull: true,
14
- required: true,
15
- description: 'The name of the page',
16
- default: {
17
- '@path': '$.name'
18
- }
19
- },
20
- properties: {
21
- label: 'Page Properties',
22
- type: 'object',
23
- description: 'Page Properties',
24
- required: true,
25
- properties: {
26
- url: {
27
- label: 'Page Url',
28
- type: 'string'
29
- },
30
- title: {
31
- label: 'Page Title',
32
- type: 'string'
33
- },
34
- referrer: {
35
- label: 'Page Referrer',
36
- type: 'string'
37
- },
38
- path: {
39
- label: 'Path portion of the current page URL',
40
- type: 'string'
41
- }
42
- },
43
- default: {
44
- url: { '@path': '$.properties.url' },
45
- title: { '@path': '$.properties.title' },
46
- referrer: { '@path': '$.properties.referrer' },
47
- path: { '@path': '$.properties.path' }
48
- }
49
- },
50
- ...common_fields_1.commonFields
51
- },
8
+ fields: {},
52
9
  perform: (request, { payload, settings }) => {
53
10
  return request(regional_endpoints_1.getEndpointByRegion('track', settings.dataCenter), {
54
11
  method: 'post',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/gainsight-px-cloud-action/trackPageView/index.ts"],"names":[],"mappings":";;AAGA,8DAA2D;AAC3D,oDAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,eAAe;IACpC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,sBAAsB;YACnC,OAAO,EAAE;gBACP,OAAO,EAAE,QAAQ;aAClB;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH,KAAK,EAAE,UAAU;oBACjB,IAAI,EAAE,QAAQ;iBACf;gBACD,KAAK,EAAE;oBACL,KAAK,EAAE,YAAY;oBACnB,IAAI,EAAE,QAAQ;iBACf;gBACD,QAAQ,EAAE;oBACR,KAAK,EAAE,eAAe;oBACtB,IAAI,EAAE,QAAQ;iBACf;gBACD,IAAI,EAAE;oBACJ,KAAK,EAAE,sCAAsC;oBAC7C,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,OAAO,EAAE;gBACP,GAAG,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE;gBACpC,KAAK,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;gBACxC,QAAQ,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;gBAC9C,IAAI,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;aACvC;SACF;QACD,GAAG,4BAAY;KAChB;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAE1C,OAAO,OAAO,CAAC,wCAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE;YAChE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/gainsight-px-cloud-action/trackPageView/index.ts"],"names":[],"mappings":";;AAGA,8DAA2D;AAE3D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,eAAe;IACpC,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAE1C,OAAO,OAAO,CAAC,wCAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE;YAChE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -20,7 +20,7 @@ const destination = {
20
20
  }
21
21
  },
22
22
  testAuthentication: async (request) => {
23
- const response = await request('https://api.getmetronome.com/v1/ingest', {
23
+ const response = await request('https://api.metronome.com/v1/ingest', {
24
24
  method: 'post',
25
25
  json: [],
26
26
  throwHttpErrors: false
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/metronome/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAG5E,4DAAmC;AAEnC,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,mBAAmB;IAEzB,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,0BAA0B;gBACvC,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,wCAAwC,EAAE;gBACvE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,EAAE;gBACR,eAAe,EAAE,KAAK;aACvB,CAAC,CAAA;YAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC3B,OAAO,IAAI,CAAA;aACZ;YACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;QACtC,CAAC;KACF;IACD,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC9B,OAAO;YACL,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,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,EAAE;QACP,SAAS,EAAT,mBAAS;KACV;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,gCAAgC;YACtC,SAAS,EAAE,gBAAgB;YAC3B,aAAa,EAAE,WAAW;YAC1B,OAAO,EAAE,4BAAa,CAAC,mBAAS,CAAC,MAAM,CAAC;SACzC;KACF;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -7,7 +7,7 @@ const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
7
7
  function serializeEvent(event) {
8
8
  return {
9
9
  ...event,
10
- timestamp: dayjs_1.default.utc(event.timestamp).toISOString(),
10
+ timestamp: dayjs_1.default.utc(event.timestamp).toISOString()
11
11
  };
12
12
  }
13
13
  const action = {
@@ -58,16 +58,14 @@ const action = {
58
58
  default: {
59
59
  '@path': '$.properties'
60
60
  }
61
- },
61
+ }
62
62
  },
63
63
  perform: (request, { payload }) => {
64
- return request('https://api.getmetronome.com/v1/ingest', {
64
+ return request('https://api.metronome.com/v1/ingest', {
65
65
  method: 'post',
66
- json: [
67
- serializeEvent(payload)
68
- ]
66
+ json: [serializeEvent(payload)]
69
67
  });
70
- },
68
+ }
71
69
  };
72
70
  exports.default = action;
73
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/metronome/sendEvent/index.ts"],"names":[],"mappings":";;;;;AAGA,+DAAsC;AAEtC,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO;QACL,GAAG,KAAK;QAWR,SAAS,EAAE,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;KACpD,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,4BAA4B;IACzC,MAAM,EAAE;QACN,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,+GAA+G;YAC5H,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,iFAAiF;YAC9F,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mBAAmB;aAC7B;SACF;QACD,SAAS,EAAE;YACT,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAEhC,OAAO,OAAO,CAAC,wCAAwC,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,cAAc,CAAC,OAAO,CAAC;aACxB;SACF,CAAC,CAAA;IACJ,CAAC;CAOF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/metronome/sendEvent/index.ts"],"names":[],"mappings":";;;;;AAGA,+DAAsC;AAEtC,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO;QACL,GAAG,KAAK;QAWR,SAAS,EAAE,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CA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AA"}
@@ -5,50 +5,106 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const actions_core_1 = require("@segment/actions-core");
7
7
  const reportWebEvent_1 = __importDefault(require("./reportWebEvent"));
8
- const presets = [
9
- {
10
- name: 'Initiate Checkout',
11
- subscribe: 'event = "Checkout Started"',
12
- partnerAction: 'reportWebEvent',
13
- mapping: {
14
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
15
- event: 'IntiateCheckout'
8
+ const tiktokDefaultValues = (fields, preset) => {
9
+ let contents = {};
10
+ const inner_contents = {
11
+ price: {
12
+ '@path': '$.price'
13
+ },
14
+ quantity: {
15
+ '@path': '$.quantity'
16
+ },
17
+ content_type: {
18
+ '@path': '$.category'
19
+ },
20
+ content_id: {
21
+ '@path': '$.product_id'
16
22
  }
17
- },
23
+ };
24
+ if (['AddToCart', 'AddToWishlist', 'Search', 'ViewContent'].includes(preset)) {
25
+ contents = {
26
+ '@arrayPath': [
27
+ '$.properties',
28
+ {
29
+ ...inner_contents
30
+ }
31
+ ]
32
+ };
33
+ }
34
+ else if (['AddPaymentInfo', 'InitiateCheckout', 'PlaceAnOrder'].includes(preset)) {
35
+ contents = {
36
+ '@arrayPath': [
37
+ '$.properties.products',
38
+ {
39
+ ...inner_contents
40
+ }
41
+ ]
42
+ };
43
+ }
44
+ return { ...actions_core_1.defaultValues(fields), contents: contents };
45
+ };
46
+ const presets = [
18
47
  {
19
48
  name: 'View Content',
20
49
  subscribe: 'type="page"',
21
50
  partnerAction: 'reportWebEvent',
22
51
  mapping: {
23
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
52
+ ...tiktokDefaultValues(reportWebEvent_1.default.fields, 'ViewContent'),
24
53
  event: 'ViewContent'
25
54
  }
26
55
  },
27
56
  {
28
- name: 'Products Searched',
57
+ name: 'Search',
29
58
  subscribe: 'event = "Products Searched"',
30
59
  partnerAction: 'reportWebEvent',
31
60
  mapping: {
32
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
61
+ ...tiktokDefaultValues(reportWebEvent_1.default.fields, 'Search'),
33
62
  event: 'Search'
34
63
  }
35
64
  },
65
+ {
66
+ name: 'Add to Wishlist',
67
+ subscribe: 'event = "Product Added to Wishlist"',
68
+ partnerAction: 'reportWebEvent',
69
+ mapping: {
70
+ ...tiktokDefaultValues(reportWebEvent_1.default.fields, 'AddToWishlist'),
71
+ event: 'AddToWishlist'
72
+ }
73
+ },
74
+ {
75
+ name: 'Add to Cart',
76
+ subscribe: 'event = "Product Added"',
77
+ partnerAction: 'reportWebEvent',
78
+ mapping: {
79
+ ...tiktokDefaultValues(reportWebEvent_1.default.fields, 'AddToCart'),
80
+ event: 'AddToCart'
81
+ }
82
+ },
83
+ {
84
+ name: 'Initiate Checkout',
85
+ subscribe: 'event = "Checkout Started"',
86
+ partnerAction: 'reportWebEvent',
87
+ mapping: {
88
+ ...tiktokDefaultValues(reportWebEvent_1.default.fields, 'InitiateCheckout'),
89
+ event: 'InitiateCheckout'
90
+ }
91
+ },
36
92
  {
37
93
  name: 'Add Payment Info',
38
94
  subscribe: 'event = "Payment Info Entered"',
39
95
  partnerAction: 'reportWebEvent',
40
96
  mapping: {
41
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
97
+ ...tiktokDefaultValues(reportWebEvent_1.default.fields, 'AddPaymentInfo'),
42
98
  event: 'AddPaymentInfo'
43
99
  }
44
100
  },
45
101
  {
46
- name: 'Order Completed',
102
+ name: 'Place an Order',
47
103
  subscribe: 'event = "Order Completed"',
48
104
  partnerAction: 'reportWebEvent',
49
105
  mapping: {
50
- ...actions_core_1.defaultValues(reportWebEvent_1.default.fields),
51
- event: 'PlaceOrder'
106
+ ...tiktokDefaultValues(reportWebEvent_1.default.fields, 'PlaceAnOrder'),
107
+ event: 'PlaceAnOrder'
52
108
  }
53
109
  }
54
110
  ];
@@ -61,14 +117,14 @@ const destination = {
61
117
  fields: {
62
118
  accessToken: {
63
119
  label: 'Access Token',
64
- description: "TikTok Long Term Access Token. You can generate this from the TikTok Marketing API portal. Please follow TikTok's [Authorization guide](https://ads.tiktok.com/athena/docs/index.html?plat_id=-1&doc_id=100010&id=100681&key=e98b971a296ae45d8e35a22fba032d1c06f5973de9aab73ce07b82f230cf3afd) for more info.",
120
+ description: 'Your TikTok Access Token. Please see TikToks [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
121
  type: 'string',
66
122
  required: true
67
123
  },
68
124
  pixel_code: {
69
125
  label: 'Pixel Code',
70
126
  type: 'string',
71
- description: 'An ID for your pixel. Required to send events to the TikTok pixel.',
127
+ 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
128
  required: true
73
129
  }
74
130
  },
@@ -77,7 +133,7 @@ const destination = {
77
133
  method: 'post',
78
134
  json: {
79
135
  pixel_code: settings.pixel_code,
80
- event: "Test Event",
136
+ event: 'Test Event',
81
137
  timestamp: '',
82
138
  context: {}
83
139
  }
@@ -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,mBAAmB;QACzB,SAAS,EAAE,4BAA4B;QACvC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,iBAAiB;SACzB;KACF;IACD;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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,EAAE,EAAE;iBACZ;aACF,CAAC,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
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/tiktok-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AAGrD,sEAA6C;AAE7C,MAAM,mBAAmB,GAAG,CAAC,MAAkC,EAAE,MAAc,EAAE,EAAE;IACjF,IAAI,QAAQ,GAAG,EAAE,CAAA;IACjB,MAAM,cAAc,GAAG;QACrB,KAAK,EAAE;YACL,OAAO,EAAE,SAAS;SACnB;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,YAAY;SACtB;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,YAAY;SACtB;QACD,UAAU,EAAE;YACV,OAAO,EAAE,cAAc;SACxB;KACF,CAAA;IACD,IAAI,CAAC,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC5E,QAAQ,GAAG;YACT,YAAY,EAAE;gBACZ,cAAc;gBACd;oBACE,GAAG,cAAc;iBAClB;aACF;SACF,CAAA;KACF;SAAM,IAAI,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAClF,QAAQ,GAAG;YACT,YAAY,EAAE;gBACZ,uBAAuB;gBACvB;oBACE,GAAG,cAAc;iBAClB;aACF;SACF,CAAA;KACF;IAED,OAAO,EAAE,GAAG,4BAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AACzD,CAAC,CAAA;AAGD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D;QACE,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,2BAA2B;QACtC,aAAa,EAAE,gBAAgB;QAC/B,OAAO,EAAE;YACP,GAAG,mBAAmB,CAAC,wBAAc,CAAC,MAAM,EAAE,cAAc,CAAC;YAC7D,KAAK,EAAE,cAAc;SACtB;KACF;CACF,CAAA;AAED,MAAM,WAAW,GAAoC;IAInD,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,cAAc;gBACrB,WAAW,EACT,+NAA+N;gBACjO,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,UAAU,EAAE;gBACV,KAAK,EAAE,YAAY;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,gLAAgL;gBAClL,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAG5C,OAAO,OAAO,CAAC,4DAA4D,EAAE;gBAC3E,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,UAAU,EAAE,QAAQ,CAAC,UAAU;oBAC/B,KAAK,EAAE,YAAY;oBACnB,SAAS,EAAE,EAAE;oBACb,OAAO,EAAE,EAAE;iBACZ;aACF,CAAC,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?: string): string;
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
- return hashAndEncode(email.toLowerCase());
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
- return hashAndEncode(userId.toLowerCase().trim());
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,KAAa;IACvC,OAAO,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;AAC3C,CAAC;AAFD,kCAEC;AAOD,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;AACnD,CAAC;AAFD,oCAEC;AAOD,SAAgB,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IAErB,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
+ {"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?: string;
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: string;
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
- description: 'Conversion event name. Please refer to the "Supported Web Events" section on this [page](https://ads.tiktok.com/marketing_api/docs?id=1701890979375106) for accepted event names.',
12
- default: {
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': '$.type'
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,105 @@ 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
+ properties: {
117
+ price: {
118
+ label: 'Price',
119
+ description: 'Price of the item.',
120
+ type: 'number'
121
+ },
122
+ quantity: {
123
+ label: 'Quantity',
124
+ description: 'Number of items.',
125
+ type: 'number'
126
+ },
127
+ content_type: {
128
+ label: 'Content Type',
129
+ description: 'Type of the product item.',
130
+ type: 'string'
131
+ },
132
+ content_id: {
133
+ label: 'Content ID',
134
+ description: 'ID of the product item.',
135
+ type: 'string'
136
+ }
137
+ }
138
+ },
139
+ currency: {
140
+ label: 'Currency',
141
+ type: 'string',
142
+ description: 'Currency for the value specified as ISO 4217 code.',
143
+ default: {
144
+ '@path': '$.properties.currency'
145
+ }
146
+ },
147
+ value: {
148
+ label: 'Value',
149
+ type: 'number',
150
+ description: 'Value of the order or items sold.',
151
+ default: {
152
+ '@if': {
153
+ exists: { '@path': '$.properties.value' },
154
+ then: { '@path': '$.properties.value' },
155
+ else: { '@path': '$.properties.revenue' }
156
+ }
157
+ }
158
+ },
159
+ description: {
160
+ label: 'Description',
161
+ type: 'string',
162
+ description: 'A string description of the web event.'
163
+ },
164
+ query: {
165
+ label: 'Query',
166
+ type: 'string',
167
+ description: 'The text string that was searched for.',
168
+ default: {
169
+ '@path': '$.properties.query'
170
+ }
92
171
  }
93
172
  },
94
173
  perform: (request, { payload, settings }) => {
95
- const eventId = payload.event_id
96
- ? payload.event_id.toString() + '_' + (Math.random() + 1).toString(36).substring(7)
97
- : '';
98
174
  const userData = {
99
175
  hashedExternalId: formatter_1.formatUserId(payload.external_id),
100
- hashedEmail: formatter_1.formatEmail(payload.email || ''),
176
+ hashedEmail: formatter_1.formatEmail(payload.email),
101
177
  hashedPhoneNumber: formatter_1.formatPhone(payload.phone_number)
102
178
  };
103
179
  return request('https://business-api.tiktok.com/open_api/v1.2/pixel/track/', {
@@ -105,7 +181,7 @@ const action = {
105
181
  json: {
106
182
  pixel_code: settings.pixel_code,
107
183
  event: payload.event,
108
- event_id: eventId,
184
+ event_id: payload.event_id ? payload.event_id + '_seg' : undefined,
109
185
  timestamp: payload.timestamp,
110
186
  context: {
111
187
  user: {
@@ -115,7 +191,20 @@ const action = {
115
191
  },
116
192
  ad: {
117
193
  callback: payload.ttclid
118
- }
194
+ },
195
+ page: {
196
+ url: payload.url,
197
+ referrer: payload.referrer
198
+ },
199
+ ip: payload.ip,
200
+ user_agent: payload.user_agent
201
+ },
202
+ properties: {
203
+ contents: payload.contents,
204
+ currency: payload.currency,
205
+ value: payload.value,
206
+ description: payload.description,
207
+ query: payload.query
119
208
  }
120
209
  }
121
210
  });
@@ -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,WAAW,EACT,mLAAmL;YACrL,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;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;YACd,WAAW,EAAE,0DAA0D;SACxE;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EAAE,sCAAsC;YACnD,IAAI,EAAE,Q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J,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
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;YACd,WAAW,EAAE,0DAA0D;YACvE,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QAED,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,kKAAkK;YACpK,IAAI,EAAE,QAAQ;YACd,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,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EACT,sHAAsH;YACxH,IAAI,EAAE,QAAQ;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,O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