From bedbcdbf64318bfa444dc152bd0835ca6eed3a84 Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Thu, 9 Nov 2023 16:33:35 +0530 Subject: [PATCH 1/3] feat: add delivery_category as part of contents, remove flattening custom_data in FB conversions --- src/v0/destinations/facebook_conversions/transform.js | 8 +++++--- src/v0/destinations/facebook_conversions/utils.js | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/v0/destinations/facebook_conversions/transform.js b/src/v0/destinations/facebook_conversions/transform.js index dec1ef2e6c..fb48c0f1a1 100644 --- a/src/v0/destinations/facebook_conversions/transform.js +++ b/src/v0/destinations/facebook_conversions/transform.js @@ -13,7 +13,6 @@ const { EventType } = require('../../../constants'); const { constructPayload, extractCustomFields, - flattenJson, getIntegrationsObj, getValidDynamicFormConfig, simpleProcessRouterDest, @@ -74,8 +73,11 @@ const responseBuilderSimple = (message, category, destination) => { commonData.action_source = getActionSource(commonData, actionSource); let customData = {}; - customData = flattenJson( - extractCustomFields(message, customData, ['properties'], FB_CONVERSIONS_DEFAULT_EXCLUSION), + customData = extractCustomFields( + message, + customData, + ['properties'], + FB_CONVERSIONS_DEFAULT_EXCLUSION, ); customData = transformedPayloadData( diff --git a/src/v0/destinations/facebook_conversions/utils.js b/src/v0/destinations/facebook_conversions/utils.js index 270fac8c45..2f50ce3127 100644 --- a/src/v0/destinations/facebook_conversions/utils.js +++ b/src/v0/destinations/facebook_conversions/utils.js @@ -44,7 +44,11 @@ const getCategoryFromEvent = (eventName) => { return category; }; -const populateContentsAndContentIDs = (productPropertiesArray, fallbackQuantity) => { +const populateContentsAndContentIDs = ( + productPropertiesArray, + fallbackQuantity, + fallbackDeliveryCategory, +) => { const contentIds = []; const contents = []; if (Array.isArray(productPropertiesArray)) { @@ -57,6 +61,7 @@ const populateContentsAndContentIDs = (productPropertiesArray, fallbackQuantity) id: productId, quantity: productProps.quantity || fallbackQuantity || 1, item_price: productProps.price, + delivery_category: productProps.delivery_category || fallbackDeliveryCategory, }); } } @@ -142,6 +147,7 @@ const populateCustomDataBasedOnCategory = (customData, message, category, catego const { contentIds, contents } = populateContentsAndContentIDs( message.properties?.products, message.properties?.quantity, + message.properties?.delivery_category, ); const contentCategory = eventTypeCustomData.content_category; From a878932fe149c20806865c70ebec68496d372a77 Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Fri, 10 Nov 2023 16:41:45 +0530 Subject: [PATCH 2/3] feat: update API version to v18.0 --- .../destinations/facebook_conversions/config.js | 2 +- test/__tests__/data/facebook_conversions.json | 16 ++++++++-------- .../data/facebook_conversions_router_output.json | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/v0/destinations/facebook_conversions/config.js b/src/v0/destinations/facebook_conversions/config.js index fc04f13be6..0c1fc12e15 100644 --- a/src/v0/destinations/facebook_conversions/config.js +++ b/src/v0/destinations/facebook_conversions/config.js @@ -1,7 +1,7 @@ const { getMappingConfig } = require('../../util'); const ENDPOINT = (datasetId, accessToken) => - `https://graph.facebook.com/v17.0/${datasetId}/events?access_token=${accessToken}`; + `https://graph.facebook.com/v18.0/${datasetId}/events?access_token=${accessToken}`; const CONFIG_CATEGORIES = { USERDATA: { diff --git a/test/__tests__/data/facebook_conversions.json b/test/__tests__/data/facebook_conversions.json index 62d0a49c0f..60e548e403 100644 --- a/test/__tests__/data/facebook_conversions.json +++ b/test/__tests__/data/facebook_conversions.json @@ -241,7 +241,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -338,7 +338,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -435,7 +435,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -532,7 +532,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -636,7 +636,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -734,7 +734,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -831,7 +831,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -928,7 +928,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { diff --git a/test/__tests__/data/facebook_conversions_router_output.json b/test/__tests__/data/facebook_conversions_router_output.json index d376a91027..653a91dd58 100644 --- a/test/__tests__/data/facebook_conversions_router_output.json +++ b/test/__tests__/data/facebook_conversions_router_output.json @@ -4,7 +4,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -64,7 +64,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { From 34d3e4a688cd69f08283c1fe860e672188897f23 Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Mon, 13 Nov 2023 11:12:34 +0530 Subject: [PATCH 3/3] feat: updated tests --- test/__tests__/data/facebook_conversions.json | 244 ++++++++++++++++-- .../facebook_conversions_router_input.json | 4 +- .../facebook_conversions_router_output.json | 4 +- ...rsions.js => facebook_conversions.test.js} | 0 4 files changed, 231 insertions(+), 21 deletions(-) rename test/__tests__/{facebook_conversions.js => facebook_conversions.test.js} (100%) diff --git a/test/__tests__/data/facebook_conversions.json b/test/__tests__/data/facebook_conversions.json index 60e548e403..cc4d9a1421 100644 --- a/test/__tests__/data/facebook_conversions.json +++ b/test/__tests__/data/facebook_conversions.json @@ -120,7 +120,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -201,7 +201,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -250,7 +250,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"spin_result\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"value\":400,\"currency\":\"USD\"}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"spin_result\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"value\":400,\"currency\":\"USD\"}}" ] } }, @@ -298,7 +298,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -347,7 +347,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Search\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Search\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -395,7 +395,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -444,7 +444,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddToCart\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddToCart\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -492,7 +492,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -541,7 +541,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -596,7 +596,7 @@ } ] }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -645,7 +645,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"products[0].product_id\":1234,\"products[0].quantity\":5,\"products[0].price\":55,\"content_ids\":[1234],\"contents\":[{\"id\":1234,\"quantity\":5,\"item_price\":55}],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"products\":[{\"product_id\":1234,\"quantity\":5,\"price\":55}],\"content_ids\":[1234],\"contents\":[{\"id\":1234,\"quantity\":5,\"item_price\":55}],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -694,7 +694,7 @@ "additional_bet_index": 0, "category": "randomCategory" }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -743,7 +743,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"category\":\"randomCategory\",\"content_ids\":[\"randomCategory\"],\"contents\":[{\"id\":\"randomCategory\",\"quantity\":1}],\"content_type\":\"product_group\",\"content_category\":\"randomCategory\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"category\":\"randomCategory\",\"content_ids\":[\"randomCategory\"],\"contents\":[{\"id\":\"randomCategory\",\"quantity\":1}],\"content_type\":\"product_group\",\"content_category\":\"randomCategory\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -791,7 +791,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -840,7 +840,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddToWishlist\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddToWishlist\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -888,7 +888,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -937,7 +937,217 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddPaymentInfo\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddPaymentInfo\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"currency\":\"USD\",\"value\":400}}" + ] + } + }, + "files": {} + } + }, + { + "description": "Track event with standard event order completed with delivery_category in products array", + "input": { + "message": { + "anonymousId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", + "channel": "web", + "context": { + "device": { + "id": "df16bffa-5c3d-4fbb-9bce-3bab098129a7R", + "manufacturer": "Xiaomi", + "model": "Redmi 6", + "name": "xiaomi" + }, + "network": { + "carrier": "Banglalink" + }, + "os": { + "name": "android", + "version": "8.1.0" + }, + "screen": { + "height": "100", + "density": 50 + }, + "traits": { + "email": " aBc@gmail.com ", + "address": { + "zip": 1234 + }, + "anonymousId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1" + } + }, + "event": "order completed", + "integrations": { + "All": true + }, + "message_id": "a80f82be-9bdc-4a9f-b2a5-15621ee41df8", + "properties": { + "revenue": 400, + "additional_bet_index": 0, + "products": [ + { + "product_id": 1234, + "quantity": 5, + "price": 55, + "delivery_category": "home_delivery" + } + ] + }, + "timestamp": "2023-11-12T15:46:51.693229+05:30", + "type": "track" + }, + "destination": { + "Config": { + "limitedDataUsage": true, + "blacklistPiiProperties": [ + { + "blacklistPiiProperties": "", + "blacklistPiiHash": false + } + ], + "accessToken": "09876", + "datasetId": "dummyID", + "eventsToEvents": [ + { + "from": "", + "to": "" + } + ], + "eventCustomProperties": [ + { + "eventCustomProperties": "" + } + ], + "removeExternalId": true, + "whitelistPiiProperties": [ + { + "whitelistPiiProperties": "" + } + ], + "actionSource": "website" + }, + "Enabled": true + } + }, + "output": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", + "headers": {}, + "params": {}, + "body": { + "JSON": {}, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": { + "data": [ + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Purchase\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"products\":[{\"product_id\":1234,\"quantity\":5,\"price\":55,\"delivery_category\":\"home_delivery\"}],\"content_ids\":[1234],\"contents\":[{\"id\":1234,\"quantity\":5,\"item_price\":55,\"delivery_category\":\"home_delivery\"}],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400,\"num_items\":1}}" + ] + } + }, + "files": {} + } + }, + { + "description": "Track event with standard event order completed with delivery_category in properties", + "input": { + "message": { + "anonymousId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", + "channel": "web", + "context": { + "device": { + "id": "df16bffa-5c3d-4fbb-9bce-3bab098129a7R", + "manufacturer": "Xiaomi", + "model": "Redmi 6", + "name": "xiaomi" + }, + "network": { + "carrier": "Banglalink" + }, + "os": { + "name": "android", + "version": "8.1.0" + }, + "screen": { + "height": "100", + "density": 50 + }, + "traits": { + "email": " aBc@gmail.com ", + "address": { + "zip": 1234 + }, + "anonymousId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1" + } + }, + "event": "order completed", + "integrations": { + "All": true + }, + "message_id": "a80f82be-9bdc-4a9f-b2a5-15621ee41df8", + "properties": { + "revenue": 400, + "additional_bet_index": 0, + "delivery_category": "home_delivery", + "products": [ + { + "product_id": 1234, + "quantity": 5, + "price": 55 + } + ] + }, + "timestamp": "2023-11-12T15:46:51.693229+05:30", + "type": "track" + }, + "destination": { + "Config": { + "limitedDataUsage": true, + "blacklistPiiProperties": [ + { + "blacklistPiiProperties": "", + "blacklistPiiHash": false + } + ], + "accessToken": "09876", + "datasetId": "dummyID", + "eventsToEvents": [ + { + "from": "", + "to": "" + } + ], + "eventCustomProperties": [ + { + "eventCustomProperties": "" + } + ], + "removeExternalId": true, + "whitelistPiiProperties": [ + { + "whitelistPiiProperties": "" + } + ], + "actionSource": "website" + }, + "Enabled": true + } + }, + "output": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", + "headers": {}, + "params": {}, + "body": { + "JSON": {}, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": { + "data": [ + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Purchase\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"delivery_category\":\"home_delivery\",\"products\":[{\"product_id\":1234,\"quantity\":5,\"price\":55}],\"content_ids\":[1234],\"contents\":[{\"id\":1234,\"quantity\":5,\"item_price\":55,\"delivery_category\":\"home_delivery\"}],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400,\"num_items\":1}}" ] } }, diff --git a/test/__tests__/data/facebook_conversions_router_input.json b/test/__tests__/data/facebook_conversions_router_input.json index 4abe66d3c4..b8865d124e 100644 --- a/test/__tests__/data/facebook_conversions_router_input.json +++ b/test/__tests__/data/facebook_conversions_router_input.json @@ -41,7 +41,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -119,7 +119,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { diff --git a/test/__tests__/data/facebook_conversions_router_output.json b/test/__tests__/data/facebook_conversions_router_output.json index 653a91dd58..542c173090 100644 --- a/test/__tests__/data/facebook_conversions_router_output.json +++ b/test/__tests__/data/facebook_conversions_router_output.json @@ -13,7 +13,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"spin_result\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"value\":400,\"currency\":\"USD\"}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"spin_result\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"value\":400,\"currency\":\"USD\"}}" ] } }, @@ -73,7 +73,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Search\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Search\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, diff --git a/test/__tests__/facebook_conversions.js b/test/__tests__/facebook_conversions.test.js similarity index 100% rename from test/__tests__/facebook_conversions.js rename to test/__tests__/facebook_conversions.test.js