diff --git a/src/v0/destinations/tiktok_ads/data/TikTokTrackV2.json b/src/v0/destinations/tiktok_ads/data/TikTokTrackV2.json index 4e43915473..d146fa74a3 100644 --- a/src/v0/destinations/tiktok_ads/data/TikTokTrackV2.json +++ b/src/v0/destinations/tiktok_ads/data/TikTokTrackV2.json @@ -13,11 +13,6 @@ "type": "secondTimestamp" } }, - { - "destKey": "test_event_code", - "sourceKeys": "properties.testEventCode", - "required": false - }, { "destKey": "limited_data_use", "sourceKeys": "properties.limited_data_use", diff --git a/src/v0/destinations/tiktok_ads/routerBatchingTestCases.json b/src/v0/destinations/tiktok_ads/routerBatchingTestCases.json new file mode 100644 index 0000000000..6235cd1ad0 --- /dev/null +++ b/src/v0/destinations/tiktok_ads/routerBatchingTestCases.json @@ -0,0 +1,2208 @@ +[ + { + "description": "Single event is mapped to single tiktok event in config and over the max_batch_limit", + "input": [ + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "page": { + "url": "http://demo.mywebsite.com/purchase", + "referrer": "http://demo.mywebsite.com" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id5" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 5 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id1" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 1 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id2" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 2 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id4" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 4 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + } + ], + "output": [ + { + "batchedRequest": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://business-api.tiktok.com/open_api/v1.3/event/track/", + "headers": { + "Access-Token": "dummyAccessToken", + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "event_source_id": "dummyPixelCode", + "event_source": "web", + "partner_name": "RudderStack", + "data": [ + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase", + "referrer": "http://demo.mywebsite.com" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id5" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id1" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id2" + }, + "event": "CompletePayment" + } + ] + }, + "JSON_ARRAY": {}, + "XML": {}, + "FORM": {} + }, + "files": {} + }, + "metadata": [ + { + "jobId": 5 + }, + { + "jobId": 1 + }, + { + "jobId": 2 + } + ], + "batched": true, + "statusCode": 200, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + }, + { + "batchedRequest": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://business-api.tiktok.com/open_api/v1.3/event/track/", + "headers": { + "Access-Token": "dummyAccessToken", + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "event_source_id": "dummyPixelCode", + "event_source": "web", + "partner_name": "RudderStack", + "data": [ + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id4" + }, + "event": "CompletePayment" + } + ] + }, + "JSON_ARRAY": {}, + "XML": {}, + "FORM": {} + }, + "files": {} + }, + "metadata": [ + { + "jobId": 4 + } + ], + "batched": true, + "statusCode": 200, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + } + ] + }, + { + "description": "Single event is mapped to multiple tiktok event in config and exceeding max batch size", + "input": [ + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "page": { + "url": "http://demo.mywebsite.com/purchase", + "referrer": "http://demo.mywebsite.com" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id5" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 5 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id1" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "addToCart", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 1 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id2" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 2 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id4" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 4 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + } + ], + "output": [ + { + "batchedRequest": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://business-api.tiktok.com/open_api/v1.3/event/track/", + "headers": { + "Access-Token": "dummyAccessToken", + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "event_source_id": "dummyPixelCode", + "event_source": "web", + "partner_name": "RudderStack", + "data": [ + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase", + "referrer": "http://demo.mywebsite.com" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id5" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id1" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id1" + }, + "event": "download" + } + ] + }, + "JSON_ARRAY": {}, + "XML": {}, + "FORM": {} + }, + "files": {} + }, + "metadata": [ + { + "jobId": 5 + }, + { + "jobId": 1 + } + ], + "batched": true, + "statusCode": 200, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "batchedRequest": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://business-api.tiktok.com/open_api/v1.3/event/track/", + "headers": { + "Access-Token": "dummyAccessToken", + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "event_source_id": "dummyPixelCode", + "event_source": "web", + "partner_name": "RudderStack", + "data": [ + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id2" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id4" + }, + "event": "CompletePayment" + } + ] + }, + "JSON_ARRAY": {}, + "XML": {}, + "FORM": {} + }, + "files": {} + }, + "metadata": [ + { + "jobId": 2 + }, + { + "jobId": 4 + } + ], + "batched": true, + "statusCode": 200, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + } + ] + }, + { + "description": "One input event is invalid with one event to multiple events", + "input": [ + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "page": { + "url": "http://demo.mywebsite.com/purchase", + "referrer": "http://demo.mywebsite.com" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id5" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 5 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id1" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "abc", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 1 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id2" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 2 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id4" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 4 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + } + ], + "output": [ + { + "batchedRequest": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://business-api.tiktok.com/open_api/v1.3/event/track/", + "headers": { + "Access-Token": "dummyAccessToken", + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "event_source_id": "dummyPixelCode", + "event_source": "web", + "partner_name": "RudderStack", + "data": [ + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase", + "referrer": "http://demo.mywebsite.com" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id5" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id2" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id4" + }, + "event": "CompletePayment" + } + ] + }, + "JSON_ARRAY": {}, + "XML": {}, + "FORM": {} + }, + "files": {} + }, + "metadata": [ + { + "jobId": 5 + }, + { + "jobId": 2 + }, + { + "jobId": 4 + } + ], + "batched": true, + "statusCode": 200, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "batched": false, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ], + "hashUserProperties": false, + "pixelCode": "dummyPixelCode", + "version": "v2" + } + }, + "error": "Event name (abc) is not valid, must be mapped to one of standard events", + "metadata": [ + { + "jobId": 1 + } + ], + "statTags": { + "errorCategory": "dataValidation", + "errorType": "instrumentation" + }, + "statusCode": 400 + } + ] + }, + { + "description": "Some input events are test events with one event to multiple events", + "input": [ + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "page": { + "url": "http://demo.mywebsite.com/purchase", + "referrer": "http://demo.mywebsite.com" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id5" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 5 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id1" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "addToCart", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 1 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id2" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "testEventCode": "Some test event code for testing setup", + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 2 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + }, + { + "message": { + "anonymousId": "21e13f4bc7ceddad", + "channel": "web", + "context": { + "app": { + "build": "1.0.0", + "name": "RudderLabs JavaScript SDK", + "namespace": "com.rudderlabs.javascript", + "version": "1.0.0" + }, + "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "ip": "13.57.97.131", + "locale": "en-US", + "externalId": [ + { + "type": "tiktokExternalId", + "id": "id4" + } + ] + }, + "messageId": "84e26acc-56a5-4835-8233-591137fca468", + "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", + "originalTimestamp": "2019-10-14T09:03:17.562Z", + "timestamp": "2020-09-17T19:49:27Z", + "type": "track", + "event": "checkout step completed", + "properties": { + "eventId": "1616318632825_357", + "clickId": "dummyClickId", + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "currency": "USD", + "value": 46.0, + "url": "http://demo.mywebsite.com/purchase", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" + }, + "integrations": { + "All": true + }, + "sentAt": "2019-10-14T09:03:22.563Z" + }, + "metadata": { + "jobId": 4 + }, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + } + ], + "output": [ + { + "batchedRequest": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://business-api.tiktok.com/open_api/v1.3/event/track/", + "headers": { + "Access-Token": "dummyAccessToken", + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "event_source_id": "dummyPixelCode", + "event_source": "web", + "partner_name": "RudderStack", + "data": [ + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase", + "referrer": "http://demo.mywebsite.com" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id5" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id1" + }, + "event": "CompletePayment" + }, + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id1" + }, + "event": "download" + } + ] + }, + "JSON_ARRAY": {}, + "XML": {}, + "FORM": {} + }, + "files": {} + }, + "metadata": [ + { + "jobId": 5 + }, + { + "jobId": 1 + } + ], + "batched": true, + "statusCode": 200, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "batchedRequest": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://business-api.tiktok.com/open_api/v1.3/event/track/", + "headers": { + "Access-Token": "dummyAccessToken", + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "event_source_id": "dummyPixelCode", + "event_source": "web", + "partner_name": "RudderStack", + "data": [ + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id4" + }, + "event": "CompletePayment" + } + ] + }, + "JSON_ARRAY": {}, + "XML": {}, + "FORM": {} + }, + "files": {} + }, + "metadata": [ + { + "jobId": 4 + } + ], + "batched": true, + "statusCode": 200, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2", + "eventsToStandard": [ + { + "from": "addToCart", + "to": "CompletePayment" + }, + { + "from": "addToCart", + "to": "download" + } + ] + } + } + }, + { + "batchedRequest": [ + { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://business-api.tiktok.com/open_api/v1.3/event/track/", + "headers": { + "Access-Token": "dummyAccessToken", + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "event_source_id": "dummyPixelCode", + "event_source": "web", + "partner_name": "RudderStack", + "test_event_code": "Some test event code for testing setup", + "data": [ + { + "event_id": "1616318632825_357", + "event_time": 1600372167, + "properties": { + "contents": [ + { + "price": 8, + "quantity": 2, + "content_type": "socks", + "content_id": "1077218" + }, + { + "price": 30, + "quantity": 1, + "content_type": "dress", + "content_id": "1197218" + } + ], + "content_type": "product", + "currency": "USD", + "value": 46 + }, + "page": { + "url": "http://demo.mywebsite.com/purchase" + }, + "user": { + "locale": "en-US", + "email": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc", + "phone": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", + "ip": "13.57.97.131", + "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + "external_id": "id2" + }, + "event": "CompletePayment" + } + ] + }, + "JSON_ARRAY": {}, + "XML": {}, + "FORM": {} + }, + "files": {} + } + ], + "metadata": [ + { + "jobId": 2 + } + ], + "batched": false, + "statusCode": 200, + "destination": { + "Config": { + "accessToken": "dummyAccessToken", + "pixelCode": "dummyPixelCode", + "hashUserProperties": false, + "version": "v2" + } + } + } + ] + } +] diff --git a/src/v0/destinations/tiktok_ads/transformV2.js b/src/v0/destinations/tiktok_ads/transformV2.js index 690f38ff0f..f13e456cc3 100644 --- a/src/v0/destinations/tiktok_ads/transformV2.js +++ b/src/v0/destinations/tiktok_ads/transformV2.js @@ -108,6 +108,7 @@ const trackResponseBuilder = async (message, { Config }) => { event_source: 'web', event_source_id: pixelCode, partner_name: PARTNER_NAME, + test_event_code: message.properties?.testEventCode, }; response.body.JSON.data = responseList; return response; @@ -148,7 +149,7 @@ const process = async (event) => { * inputEvent: *{ event: { - pixelCode: "dummyPixelCode", + event_source_id: "dummyPixelCode", event_source: "web", partner_name: "RudderStack", data: [ @@ -259,7 +260,7 @@ const process = async (event) => { }, body: { JSON: { - pixelCode: "A1T8T4UYGVIQA8ORZMX9", + event_source_id: "asdfg", event_source: "web", partner_name: "RudderStack", data: [ @@ -554,7 +555,7 @@ Returns [ { event: { - pixelCode: "dummyPixelCode", + event_source_id: "dummyPixelCode", event_source: "web", partner_name: "RudderStack", data: [ @@ -663,8 +664,8 @@ const batchEvents = (eventsChunk, maxBatchSize) => { if (Array.isArray(eventData) && eventData?.length > maxBatchSize - data.length) { // Partner name must be added above "data": [..]; events.push({ - events: { - pixelCode, + event: { + event_source_id: pixelCode, event_source: 'web', partner_name: PARTNER_NAME, data: [...data], @@ -681,7 +682,7 @@ const batchEvents = (eventsChunk, maxBatchSize) => { // Partner name must be added above "data": [..]; events.push({ event: { - pixelCode, + event_source_id: pixelCode, event_source: 'web', partner_name: PARTNER_NAME, data: [...data], diff --git a/src/v0/destinations/tiktok_ads/transformV2.test.js b/src/v0/destinations/tiktok_ads/transformV2.test.js new file mode 100644 index 0000000000..d47643355a --- /dev/null +++ b/src/v0/destinations/tiktok_ads/transformV2.test.js @@ -0,0 +1,25 @@ +const { processRouterDest } = require('./transformV2'); + +jest.mock('axios'); +jest.mock(`./config`, () => { + const originalConfig = jest.requireActual(`./config`); + return { + ...originalConfig, + maxBatchSizeV2: 3, + }; +}); +const fs = require('fs'); +const path = require('path'); + +const testDataFile = fs.readFileSync(path.resolve(__dirname, `routerBatchingTestCases.json`)); + +const testData = JSON.parse(testDataFile); + +describe(`Router Batching Tests`, () => { + testData.forEach((event, index) => { + it(`${index} -> ${event.description}`, async () => { + const output = await processRouterDest(event.input); + expect(output).toEqual(event.output); + }); + }); +}); diff --git a/src/v0/destinations/tiktok_ads/util.test.js b/src/v0/destinations/tiktok_ads/util.test.js index c0e82f07f9..67473ad9dd 100644 --- a/src/v0/destinations/tiktok_ads/util.test.js +++ b/src/v0/destinations/tiktok_ads/util.test.js @@ -107,7 +107,7 @@ describe('hashUserField utility test', () => { const hashedUser = hashUserField(user); expect(hashedUser).toEqual({ - external_id: expect.any(String), + external_id: "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3", email: '973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b', phone: '422ce82c6fc1724ac878042f7d055653ab5e983d186e616826a72d4384b68af8', }); diff --git a/test/integrations/destinations/tiktok_ads/router/data.ts b/test/integrations/destinations/tiktok_ads/router/data.ts index 4a0993dd01..acaf78d1f5 100644 --- a/test/integrations/destinations/tiktok_ads/router/data.ts +++ b/test/integrations/destinations/tiktok_ads/router/data.ts @@ -1085,7 +1085,7 @@ export const data = [ "params": {}, "body": { "JSON": { - "pixelCode": "dummyPixelCode", + "event_source_id": "dummyPixelCode", "event_source": "web", "partner_name": "RudderStack", "data": [