From 6c11be97cc3b86df70e1b9d82dd7c4d3771b814c Mon Sep 17 00:00:00 2001 From: Will Date: Thu, 17 Oct 2024 04:59:12 +0100 Subject: [PATCH 01/21] Should filter out falsey reserved attributes from Intercom destination (#3767) * Should filter out reserved attributes from Intercom destination even if they are falsey * Fix presence check to allow null values --------- Co-authored-by: Manish Kumar <144022547+manish339k@users.noreply.github.com> --- src/cdk/v2/destinations/intercom/utils.js | 2 +- src/cdk/v2/destinations/intercom/utils.test.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cdk/v2/destinations/intercom/utils.js b/src/cdk/v2/destinations/intercom/utils.js index 22af726e84..a75f8155af 100644 --- a/src/cdk/v2/destinations/intercom/utils.js +++ b/src/cdk/v2/destinations/intercom/utils.js @@ -257,7 +257,7 @@ const filterCustomAttributes = (payload, type, destination, message) => { let customAttributes = { ...get(payload, 'custom_attributes') }; if (customAttributes) { ReservedAttributesList.forEach((trait) => { - if (customAttributes[trait]) delete customAttributes[trait]; + if (trait in customAttributes) delete customAttributes[trait]; }); if (isDefinedAndNotNull(customAttributes) && Object.keys(customAttributes).length > 0) { customAttributes = diff --git a/src/cdk/v2/destinations/intercom/utils.test.js b/src/cdk/v2/destinations/intercom/utils.test.js index c2bf3f8e89..e2c1fb9a07 100644 --- a/src/cdk/v2/destinations/intercom/utils.test.js +++ b/src/cdk/v2/destinations/intercom/utils.test.js @@ -318,6 +318,18 @@ describe('filterCustomAttributes utility test', () => { expect(result).toBeUndefined(); }); + it('Should filter out custom attributes that are reserved attributes and that are false', () => { + const payload = { custom_attributes: { unsubscribedFromEmails: false } }; + const result = filterCustomAttributes(payload, 'user', { Config: { apiVersion: 'v2' } }); + expect(result).toBeUndefined(); + }); + + it('Should filter out custom attributes that are reserved attributes and that are null', () => { + const payload = { custom_attributes: { unsubscribedFromEmails: null } }; + const result = filterCustomAttributes(payload, 'user', { Config: { apiVersion: 'v2' } }); + expect(result).toBeUndefined(); + }); + it('Should return a flattened object when custom attributes are not null, not reserved attributes and nested', () => { const payload = { custom_attributes: { source: 'rudder-js-sdk', data: { nestedAttribute: 'nestedValue' } }, From b33eadca7000d7364a8c22c9627e96135270a6a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 10:26:21 +0530 Subject: [PATCH 02/21] chore(deps): bump koa and @types/koa (#3709) Bumps [koa](https://github.com/koajs/koa) and [@types/koa](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/koa). These dependencies needed to be updated together. Updates `koa` from 2.15.0 to 2.15.3 - [Changelog](https://github.com/koajs/koa/blob/2.15.3/History.md) - [Commits](https://github.com/koajs/koa/compare/2.15.0...2.15.3) Updates `@types/koa` from 2.13.12 to 2.15.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/koa) --- updated-dependencies: - dependency-name: koa dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: "@types/koa" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> --- package-lock.json | 14 ++++++++------ package.json | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4295bd74c..d3b578f685 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "json-size": "^1.0.0", "jsontoxml": "^1.0.1", "jstoxml": "^5.0.2", - "koa": "^2.14.1", + "koa": "^2.15.3", "koa-bodyparser": "^4.4.0", "koa2-swagger-ui": "^5.7.0", "libphonenumber-js": "^1.11.1", @@ -83,7 +83,7 @@ "@types/fast-json-stable-stringify": "^2.1.0", "@types/jest": "^29.5.1", "@types/jsonpath": "^0.2.4", - "@types/koa": "^2.13.6", + "@types/koa": "^2.15.0", "@types/koa-bodyparser": "^4.3.10", "@types/lodash": "^4.14.197", "@types/node": "^20.2.5", @@ -7791,8 +7791,9 @@ "license": "MIT" }, "node_modules/@types/koa": { - "version": "2.13.12", - "license": "MIT", + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.15.0.tgz", + "integrity": "sha512-7QFsywoE5URbuVnG3loe03QXuGajrnotr3gQkXcEBShORai23MePfFYdhz90FEtBBpkyIYQbVD+evKtloCgX3g==", "dependencies": { "@types/accepts": "*", "@types/content-disposition": "*", @@ -16327,8 +16328,9 @@ } }, "node_modules/koa": { - "version": "2.15.0", - "license": "MIT", + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/koa/-/koa-2.15.3.tgz", + "integrity": "sha512-j/8tY9j5t+GVMLeioLaxweJiKUayFhlGqNTzf2ZGwL0ZCQijd2RLHK0SLW5Tsko8YyyqCZC2cojIb0/s62qTAg==", "dependencies": { "accepts": "^1.3.5", "cache-content-type": "^1.0.0", diff --git a/package.json b/package.json index 6b41457633..f5d44d8e2b 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "json-size": "^1.0.0", "jsontoxml": "^1.0.1", "jstoxml": "^5.0.2", - "koa": "^2.14.1", + "koa": "^2.15.3", "koa-bodyparser": "^4.4.0", "koa2-swagger-ui": "^5.7.0", "libphonenumber-js": "^1.11.1", @@ -128,7 +128,7 @@ "@types/fast-json-stable-stringify": "^2.1.0", "@types/jest": "^29.5.1", "@types/jsonpath": "^0.2.4", - "@types/koa": "^2.13.6", + "@types/koa": "^2.15.0", "@types/koa-bodyparser": "^4.3.10", "@types/lodash": "^4.14.197", "@types/node": "^20.2.5", From d730dafbbd2de30b67c35db8ca05396a98a8d2e0 Mon Sep 17 00:00:00 2001 From: Akash Chetty Date: Thu, 17 Oct 2024 12:12:42 +0530 Subject: [PATCH 03/21] fix: populate source destination info env set properly (#3806) --- src/warehouse/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/warehouse/index.js b/src/warehouse/index.js index 4afa8f72c2..3491a257da 100644 --- a/src/warehouse/index.js +++ b/src/warehouse/index.js @@ -30,7 +30,7 @@ const whExtractEventTableColumnMappingRules = require('./config/WHExtractEventTa const maxColumnsInEvent = parseInt(process.env.WH_MAX_COLUMNS_IN_EVENT || '200', 10); const WH_POPULATE_SRC_DEST_INFO_IN_CONTEXT = - process.env.WH_POPULATE_SRC_DEST_INFO_IN_CONTEXT || true; + process.env.WH_POPULATE_SRC_DEST_INFO_IN_CONTEXT !== 'false'; const getDataType = (key, val, options, jsonKey = false) => { const type = typeof val; From 88c6175391cf4575a57936aced898465ad78b55e Mon Sep 17 00:00:00 2001 From: Sudip Paul <67197965+ItsSudip@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:40:44 +0530 Subject: [PATCH 04/21] fix: add missing fields to pinterest_tag mapping (#3814) * feat: add missing fields on the pinterest_tag mapping * chore: fix test cases * chore: remove redundant old implementation * chore: remove test cases related to pinterest_tag * chore: fix test cases * chore: fix lint issue * chore: fix lint issue again * chore: revert service.api.test.ts changes --- .../v2/destinations/pinterest_tag/config.js | 19 + .../pinterest_tag/procWorkflow.yaml | 24 +- .../pinterest_tag/rtWorkflow.yaml | 2 +- .../v2/destinations/pinterest_tag/utils.js | 150 +++++++ .../destinations/pinterest_tag/utils.test.js | 2 +- src/v0/destinations/pinterest_tag/config.js | 31 -- .../data/pinterestCommonConfig.json | 61 --- .../data/pinterestCustomConfig.json | 38 -- .../data/pinterestUserConfig.json | 93 ---- .../destinations/pinterest_tag/transform.js | 202 --------- src/v0/destinations/pinterest_tag/utils.js | 416 ------------------ test/__tests__/data/pinterest_tag_input.json | 15 + test/__tests__/data/pinterest_tag_output.json | 61 +++ .../pinterest_tag_router_batch_output.json | 104 ++++- .../data/pinterest_tag_router_input.json | 16 + .../data/pinterest_tag_router_output.json | 72 +++ test/__tests__/pinterestConversion.test.js | 54 --- .../proc/batch_input_multiplex.json | 2 + .../destination/proc/multiplex_failure.json | 5 +- .../proc/multiplex_partial_failure.json | 6 +- .../destination/proc/multiplex_success.json | 1 + .../destination/router/failure_test.json | 7 +- test/apitests/service.api.test.ts | 1 - .../pinterest_tag/processor/data.ts | 200 +++++++-- .../destinations/pinterest_tag/router/data.ts | 148 ++++++- .../destinations/pinterest_tag/step/data.ts | 286 ++++++++++-- 26 files changed, 997 insertions(+), 1019 deletions(-) create mode 100644 src/cdk/v2/destinations/pinterest_tag/config.js create mode 100644 src/cdk/v2/destinations/pinterest_tag/utils.js rename src/{v0 => cdk/v2}/destinations/pinterest_tag/utils.test.js (97%) delete mode 100644 src/v0/destinations/pinterest_tag/config.js delete mode 100644 src/v0/destinations/pinterest_tag/data/pinterestCommonConfig.json delete mode 100644 src/v0/destinations/pinterest_tag/data/pinterestCustomConfig.json delete mode 100644 src/v0/destinations/pinterest_tag/data/pinterestUserConfig.json delete mode 100644 src/v0/destinations/pinterest_tag/transform.js delete mode 100644 src/v0/destinations/pinterest_tag/utils.js delete mode 100644 test/__tests__/pinterestConversion.test.js diff --git a/src/cdk/v2/destinations/pinterest_tag/config.js b/src/cdk/v2/destinations/pinterest_tag/config.js new file mode 100644 index 0000000000..9e019e1436 --- /dev/null +++ b/src/cdk/v2/destinations/pinterest_tag/config.js @@ -0,0 +1,19 @@ +const ENDPOINT = 'https://ct.pinterest.com/events/v3'; +// ref: https://developers.pinterest.com/docs/api/v5/#tag/conversion_events +const getV5EventsEndpoint = (adAccountId) => + `https://api.pinterest.com/v5/ad_accounts/${adAccountId}/events`; + +const API_VERSION = { + v3: 'legacyApi', + v5: 'newApi', +}; + +// ref: https://s.pinimg.com/ct/docs/conversions_api/dist/v3.html +const MAX_BATCH_SIZE = 1000; + +module.exports = { + ENDPOINT, + MAX_BATCH_SIZE, + getV5EventsEndpoint, + API_VERSION, +}; diff --git a/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml b/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml index 1122a80404..64d391c888 100644 --- a/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml +++ b/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml @@ -3,8 +3,8 @@ bindings: path: ../../../../constants - path: ../../bindings/jsontemplate exportAll: true - - path: ../../../../v0/destinations/pinterest_tag/utils - - path: ../../../../v0/destinations/pinterest_tag/config + - path: ./utils + - path: ./config - name: removeUndefinedValues path: ../../../../v0/util - name: removeUndefinedAndNullAndEmptyValues @@ -66,7 +66,10 @@ steps: "opt_out": .context.device.adTrackingEnabled !== undefined ? !.context.device.adTrackingEnabled, "event_id": $.getOneByPaths(., ^.destination.Config.deduplicationKey) ?? .messageId, "app_id": ^.destination.Config.appId, - "advertiser_id": ^.destination.Config.advertiserId + "advertiser_id": ^.destination.Config.advertiserId, + "partner_name": .properties.partnerName, + "device_carrier": .context.network.carrier, + "wifi": .context.network.wifi }); $.outputs.apiVersion === {{$.API_VERSION.v5}} ? commonFields = commonFields{~["advertiser_id"]}; $.removeUndefinedValues(commonFields) @@ -103,7 +106,8 @@ steps: "client_ip_address": .context.ip ?? .request_ip, "client_user_agent": .context.userAgent, "external_id": {{{{$.getGenericPaths("userId")}}}}, - "click_id": .properties.clickId + "click_id": .properties.clickId, + "partner_id": .traits.partnerId ?? .context.traits.partnerId }); !.destination.Config.sendExternalId ? userFields = userFields{~["external_id"]} : null; userFields = $.removeUndefinedAndNullAndEmptyValues(userFields); @@ -129,7 +133,11 @@ steps: "num_items": .properties.numOfItems && Number(.properties.numOfItems), "order_id": .properties.order_id, "search_string": .properties.query, - "opt_out_type": .properties.optOutType + "opt_out_type": .properties.optOutType, + "content_name": .properties.contentName, + "content_category": .properties.contentCategory, + "content_brand": .properties.contentBrand, + "np": .properties.np }); $.removeUndefinedValues(customFields) @@ -143,7 +151,11 @@ steps: "content_ids": products.(.product_id ?? .sku ?? .id)[], "contents": .message.properties@prop.products.({ "quantity": Number(.quantity ?? prop.quantity ?? 1), - "item_price": String(.price ?? prop.price) + "item_price": String(.price ?? prop.price), + "item_name": String(.name), + "id": .product_id ?? .sku, + "item_category": .category, + "item_brand": .brand })[] } else: diff --git a/src/cdk/v2/destinations/pinterest_tag/rtWorkflow.yaml b/src/cdk/v2/destinations/pinterest_tag/rtWorkflow.yaml index 215ead12b1..bd4a9439f0 100644 --- a/src/cdk/v2/destinations/pinterest_tag/rtWorkflow.yaml +++ b/src/cdk/v2/destinations/pinterest_tag/rtWorkflow.yaml @@ -1,5 +1,5 @@ bindings: - - path: ../../../../v0/destinations/pinterest_tag/config + - path: ./config - name: batchMultiplexedEvents path: ../../../../v0/util/index steps: diff --git a/src/cdk/v2/destinations/pinterest_tag/utils.js b/src/cdk/v2/destinations/pinterest_tag/utils.js new file mode 100644 index 0000000000..31a897f133 --- /dev/null +++ b/src/cdk/v2/destinations/pinterest_tag/utils.js @@ -0,0 +1,150 @@ +/* eslint-disable no-param-reassign */ +const sha256 = require('sha256'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); + +const { API_VERSION } = require('./config'); + +const VALID_ACTION_SOURCES = ['app_android', 'app_ios', 'web', 'offline']; + +const ecomEventMaps = [ + { + src: ['order completed'], + dest: 'checkout', + }, + { + src: ['product added'], + dest: 'add_to_cart', + }, + { + src: ['products searched', 'product list filtered'], + dest: 'search', + }, +]; + +const USER_NON_ARRAY_PROPERTIES = ['client_user_agent', 'client_ip_address']; + +const getHashedValue = (key, value) => { + switch (key) { + case 'em': + case 'ct': + case 'st': + case 'country': + case 'ln': + case 'fn': + case 'ge': + value = Array.isArray(value) + ? value.map((val) => val.toString().trim().toLowerCase()) + : value.toString().trim().toLowerCase(); + break; + case 'ph': + // phone numbers should only contain digits & should not contain leading zeros + value = Array.isArray(value) + ? value.map((val) => val.toString().replace(/\D/g, '').replace(/^0+/, '')) + : value.toString().replace(/\D/g, '').replace(/^0+/, ''); + break; + case 'zp': + // zip fields should only contain digits + value = Array.isArray(value) + ? value.map((val) => val.toString().trim().replace(/\D/g, '')) + : value.toString().replace(/\D/g, ''); + break; + case 'hashed_maids': + case 'external_id': + case 'db': + // no action needed on value + break; + default: + return String(value); + } + return Array.isArray(value) ? value.map((val) => sha256(val)) : [sha256(value)]; +}; + +/** + * + * @param {*} userPayload Payload mapped from user fields + * @returns + * Further Processing the user fields following the instructions of Pinterest Conversion API + * Ref: https://s.pinimg.com/ct/docs/conversions_api/dist/v3.html + */ +const processUserPayload = (userPayload) => { + Object.keys(userPayload).forEach((key) => { + userPayload[key] = getHashedValue(key, userPayload[key]); + }); + return userPayload; +}; + +/** + * + * @param {*} eventName // ["WatchVideo", "ViewCategory", "Custom"] + * @returns // ["watch_video", "view_category", "custom""] + * This function will return the snake case name of the destination config mapped event + */ +const convertToSnakeCase = (eventName) => + eventName.map((str) => + str + .replace(/([a-z])([A-Z])/g, '$1_$2') + .replace(/\s+/g, '_') + .toLowerCase(), + ); + +/** + * + * @param {*} userPayload + * @param {*} message + * @returns converts every single hashed user data property to array, except for + * "client_user_agent", "client_ip_address" + * + */ +const processHashedUserPayload = (userPayload, message) => { + const processedHashedUserPayload = {}; + Object.keys(userPayload).forEach((key) => { + if (!USER_NON_ARRAY_PROPERTIES.includes(key)) { + if (Array.isArray(userPayload[key])) { + processedHashedUserPayload[key] = [...userPayload[key]]; + } else { + processedHashedUserPayload[key] = [userPayload[key]]; + } + } else { + processedHashedUserPayload[key] = userPayload[key]; + } + }); + // multiKeyMap will works on only specific values like m, male, MALE, f, F, Female + // if hashed data is sent from the user, it is directly set over here + const gender = message.traits?.gender || message.context?.traits?.gender; + if (gender && Array.isArray(gender)) { + processedHashedUserPayload.ge = [...gender]; + } else if (gender) { + processedHashedUserPayload.ge = [gender]; + } + return processedHashedUserPayload; +}; + +const validateInput = (message, { Config }) => { + const { apiVersion = API_VERSION.v3, advertiserId, adAccountId, conversionToken } = Config; + if (apiVersion === API_VERSION.v3 && !advertiserId) { + throw new ConfigurationError('Advertiser Id not found. Aborting'); + } + + if (apiVersion === API_VERSION.v5) { + if (!adAccountId) { + throw new ConfigurationError('Ad Account ID not found. Aborting'); + } + + if (!conversionToken) { + throw new ConfigurationError('Conversion Token not found. Aborting'); + } + } + + if (!message.type) { + throw new InstrumentationError('Event type is required'); + } +}; + +module.exports = { + processUserPayload, + processHashedUserPayload, + VALID_ACTION_SOURCES, + ecomEventMaps, + convertToSnakeCase, + validateInput, +}; diff --git a/src/v0/destinations/pinterest_tag/utils.test.js b/src/cdk/v2/destinations/pinterest_tag/utils.test.js similarity index 97% rename from src/v0/destinations/pinterest_tag/utils.test.js rename to src/cdk/v2/destinations/pinterest_tag/utils.test.js index 6b4cef9567..1c1d080ef5 100644 --- a/src/v0/destinations/pinterest_tag/utils.test.js +++ b/src/cdk/v2/destinations/pinterest_tag/utils.test.js @@ -1,4 +1,4 @@ -const { processUserPayload } = require('../../../../src/v0/destinations/pinterest_tag/utils'); +const { processUserPayload } = require('./utils'); const userFields = [ { diff --git a/src/v0/destinations/pinterest_tag/config.js b/src/v0/destinations/pinterest_tag/config.js deleted file mode 100644 index 9216b6f61b..0000000000 --- a/src/v0/destinations/pinterest_tag/config.js +++ /dev/null @@ -1,31 +0,0 @@ -const { getMappingConfig } = require('../../util'); - -const ENDPOINT = 'https://ct.pinterest.com/events/v3'; -// ref: https://developers.pinterest.com/docs/api/v5/#tag/conversion_events -const getV5EventsEndpoint = (adAccountId) => - `https://api.pinterest.com/v5/ad_accounts/${adAccountId}/events`; - -const API_VERSION = { - v3: 'legacyApi', - v5: 'newApi', -}; - -// ref: https://s.pinimg.com/ct/docs/conversions_api/dist/v3.html -const MAX_BATCH_SIZE = 1000; - -const CONFIG_CATEGORIES = { - USER_CONFIGS: { name: 'pinterestUserConfig' }, - COMMON_CONFIGS: { name: 'pinterestCommonConfig' }, - CUSTOM_CONFIGS: { name: 'pinterestCustomConfig' }, -}; -const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname); - -module.exports = { - ENDPOINT, - MAX_BATCH_SIZE, - USER_CONFIGS: MAPPING_CONFIG[CONFIG_CATEGORIES.USER_CONFIGS.name], - COMMON_CONFIGS: MAPPING_CONFIG[CONFIG_CATEGORIES.COMMON_CONFIGS.name], - CUSTOM_CONFIGS: MAPPING_CONFIG[CONFIG_CATEGORIES.CUSTOM_CONFIGS.name], - getV5EventsEndpoint, - API_VERSION, -}; diff --git a/src/v0/destinations/pinterest_tag/data/pinterestCommonConfig.json b/src/v0/destinations/pinterest_tag/data/pinterestCommonConfig.json deleted file mode 100644 index 52645fa25a..0000000000 --- a/src/v0/destinations/pinterest_tag/data/pinterestCommonConfig.json +++ /dev/null @@ -1,61 +0,0 @@ -[ - { - "destKey": "event_name", - "sourceKeys": "event" - }, - { - "destKey": "event_time", - "sourceKeys": "timestamp", - "sourceFromGenericMap": true, - "required": true, - "metadata": { - "type": "secondTimestamp" - } - }, - { - "destKey": "event_source_url", - "sourceKeys": "pageUrl", - "sourceFromGenericMap": true - }, - { - "destKey": "action_source", - "sourceKeys": [ - "traits.action_source", - "context.traits.action_source", - "traits.actionSource", - "context.traits.actionSource", - "properties.action_source", - "properties.actionSource", - "channel" - ], - "required": true - }, - { - "destKey": "app_name", - "sourceKeys": ["properties.appName", "context.app.name"] - }, - { - "destKey": "app_version", - "sourceKeys": ["properties.appVersion", "context.app.version"] - }, - { - "destKey": "device_brand", - "sourceKeys": ["properties.manufacturer", "context.device.manufacturer"] - }, - { - "destKey": "device_model", - "sourceKeys": ["properties.deviceModel", "context.device.model"] - }, - { - "destKey": "device_type", - "sourceKeys": ["properties.deviceType", "context.device.type"] - }, - { - "destKey": "os_version", - "sourceKeys": "context.os.version" - }, - { - "destKey": "language", - "sourceKeys": ["properties.language", "context.traits.language", "context.locale"] - } -] diff --git a/src/v0/destinations/pinterest_tag/data/pinterestCustomConfig.json b/src/v0/destinations/pinterest_tag/data/pinterestCustomConfig.json deleted file mode 100644 index 55c9e1e9ed..0000000000 --- a/src/v0/destinations/pinterest_tag/data/pinterestCustomConfig.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "destKey": "currency", - "sourceKeys": "properties.currency", - "required": false - }, - { - "destKey": "value", - "sourceKeys": ["properties.value", "properties.total", "properties.revenue"], - "required": false, - "metadata": { - "type": "toString" - } - }, - { - "destKey": "num_items", - "sourceKeys": "properties.numOfItems", - "metadata": { - "type": "toInt" - }, - "required": false - }, - { - "destKey": "order_id", - "sourceKeys": "properties.order_id", - "required": false - }, - { - "destKey": "search_string", - "sourceKeys": "properties.query", - "required": false - }, - { - "destKey": "opt_out_type", - "sourceKeys": "properties.optOutType", - "required": false - } -] diff --git a/src/v0/destinations/pinterest_tag/data/pinterestUserConfig.json b/src/v0/destinations/pinterest_tag/data/pinterestUserConfig.json deleted file mode 100644 index b95f539e7c..0000000000 --- a/src/v0/destinations/pinterest_tag/data/pinterestUserConfig.json +++ /dev/null @@ -1,93 +0,0 @@ -[ - { - "destKey": "em", - "sourceKeys": "emailOnly", - "sourceFromGenericMap": true, - "required": false - }, - { - "destKey": "ph", - "sourceKeys": "phone", - "sourceFromGenericMap": true, - "required": false - }, - { - "destKey": "ge", - "sourceKeys": ["traits.gender", "context.traits.gender"], - "required": false, - "metadata": { - "multikeyMap": [ - { - "sourceVal": ["f", "F", "Female", "female", "FEMALE"], - "destVal": "f" - }, - { - "sourceVal": ["m", "M", "Male", "male", "MALE"], - "destVal": "m" - }, - { - "sourceVal": ["n", "N", "non-binary", "non binary", "Non-Binary", "Non Binary"], - "destVal": "n" - } - ] - } - }, - { - "destKey": "db", - "sourceKeys": "birthday", - "required": false, - "sourceFromGenericMap": true - }, - { - "destKey": "ln", - "sourceKeys": "lastName", - "required": false, - "sourceFromGenericMap": true - }, - { - "destKey": "fn", - "sourceKeys": "firstName", - "required": false, - "sourceFromGenericMap": true - }, - { - "destKey": "ct", - "sourceKeys": ["traits.address.city", "context.traits.address.city"], - "required": false - }, - { - "destKey": "st", - "sourceKeys": ["traits.address.state", "context.traits.address.state"], - "required": false - }, - { - "destKey": "zp", - "sourceKeys": ["traits.address.zip", "context.traits.address.zip"], - "required": false - }, - { - "destKey": "country", - "sourceKeys": ["traits.address.country", "context.traits.address.country"], - "required": false - }, - { - "destKey": "hashed_maids", - "sourceKeys": ["context.device.advertisingId"], - "required": false - }, - { - "destKey": "client_ip_address", - "sourceKeys": ["context.ip", "request_ip"], - "required": false - }, - { - "destKey": "client_user_agent", - "sourceKeys": "context.userAgent", - "required": false - }, - { - "destKey": "external_id", - "sourceKeys": "userId", - "sourceFromGenericMap": true - } -] diff --git a/src/v0/destinations/pinterest_tag/transform.js b/src/v0/destinations/pinterest_tag/transform.js deleted file mode 100644 index f8ccfd48ea..0000000000 --- a/src/v0/destinations/pinterest_tag/transform.js +++ /dev/null @@ -1,202 +0,0 @@ -const { get } = require('lodash'); -const { InstrumentationError } = require('@rudderstack/integrations-lib'); -const { EventType } = require('../../../constants'); -const { - defaultRequestConfig, - defaultPostRequestConfig, - getSuccessRespEvents, - constructPayload, - defaultBatchRequestConfig, - removeUndefinedAndNullValues, - batchMultiplexedEvents, - handleRtTfSingleEventError, -} = require('../../util'); -const { - processUserPayload, - processCommonPayload, - deduceEventName, - postProcessEcomFields, - checkUserPayloadValidity, - processHashedUserPayload, - validateInput, -} = require('./utils'); - -const { - ENDPOINT, - MAX_BATCH_SIZE, - USER_CONFIGS, - getV5EventsEndpoint, - API_VERSION, -} = require('./config'); - -const responseBuilderSimple = (finalPayload, { Config }) => { - const { apiVersion = API_VERSION.v3, adAccountId, conversionToken, sendAsTestEvent } = Config; - const response = defaultRequestConfig(); - response.endpoint = ENDPOINT; - response.method = defaultPostRequestConfig.requestMethod; - response.body.JSON = removeUndefinedAndNullValues(finalPayload); - - response.headers = { 'Content-Type': 'application/json' }; - - if (apiVersion === API_VERSION.v5) { - response.endpoint = getV5EventsEndpoint(adAccountId); - response.headers = { - 'Content-Type': 'application/json', - Authorization: `Bearer ${conversionToken}`, - }; - } - if (sendAsTestEvent) { - response.params = { - test: true, - }; - } - - return response; -}; - -/** - * - * @param {*} message - * @param {*} destination.Config - * @param {*} messageType - * @param {*} eventName - * @returns the output of each input payload. - * message deduplication logic looks like below: - * This facility is provided *only* for the users who are using the *new configuration*. - * if "enableDeduplication" is set to *true* and "deduplicationKey" is set via webapp, that key value will be - * sent as "event_id". On it's absence it will fallback to "messageId". - * And if "enableDeduplication" is set to false, it will fallback to "messageId" - */ -const commonFieldResponseBuilder = (message, { Config }, messageType, eventName) => { - let processedUserPayload; - const { appId, advertiserId, deduplicationKey, sendingUnHashedData, sendExternalId, apiVersion } = - Config; - // ref: https://s.pinimg.com/ct/docs/conversions_api/dist/v3.html - const processedCommonPayload = processCommonPayload(message); - - processedCommonPayload.event_id = get(message, `${deduplicationKey}`) || message.messageId; - const userPayload = constructPayload(message, USER_CONFIGS, 'pinterest'); - - if (!sendExternalId) { - delete userPayload.external_id; - } - - const isValidUserPayload = checkUserPayloadValidity(userPayload); - if (isValidUserPayload === false) { - throw new InstrumentationError( - 'It is required at least one of em, hashed_maids or pair of client_ip_address and client_user_agent', - ); - } - - /** - * User can configure hashed checkbox to false if they are sending already hashed data to Rudderstack - * Otherwise we will hash data user data by default. - */ - if (sendingUnHashedData) { - processedUserPayload = processUserPayload(userPayload); - } else { - // when user is sending already hashed data to Rudderstack - processedUserPayload = processHashedUserPayload(userPayload, message); - } - - let response = { - ...processedCommonPayload, - event_name: eventName, - app_id: appId, - advertiser_id: advertiserId, - user_data: processedUserPayload, - }; - - if (apiVersion === API_VERSION.v5) { - delete response.advertiser_id; - } - - if (messageType === EventType.TRACK) { - response = postProcessEcomFields(message, response); - } - - return response; -}; - -const process = (event) => { - const toSendEvents = []; - const respList = []; - const deducedEventNameArray = []; - const { message, destination } = event; - const messageType = message.type?.toLowerCase(); - - validateInput(message, destination); - - switch (messageType) { - case EventType.PAGE: - case EventType.SCREEN: - case EventType.TRACK: - deducedEventNameArray.push(...deduceEventName(message, destination.Config)); - deducedEventNameArray.forEach((eventName) => { - toSendEvents.push(commonFieldResponseBuilder(message, destination, messageType, eventName)); - }); - - break; - default: - throw new InstrumentationError(`message type ${messageType} is not supported`); - } - - toSendEvents.forEach((sendEvent) => { - respList.push(responseBuilderSimple(sendEvent, destination)); - }); - return respList; -}; - -const generateBatchedPayloadForArray = (events) => { - const { batchedRequest } = defaultBatchRequestConfig(); - const batchResponseList = events.map((event) => event.body.JSON); - batchedRequest.body.JSON = { data: batchResponseList }; - batchedRequest.endpoint = events[0].endpoint; - batchedRequest.headers = events[0].headers; - - return batchedRequest; -}; - -const batchEvents = (successRespList) => { - const batchResponseList = []; - const batchedEvents = batchMultiplexedEvents(successRespList, MAX_BATCH_SIZE); - batchedEvents.forEach((batch) => { - const batchedRequest = generateBatchedPayloadForArray(batch.events); - batchResponseList.push( - getSuccessRespEvents(batchedRequest, batch.metadata, batch.destination, true), - ); - }); - - return batchResponseList; -}; - -const processRouterDest = (inputs, reqMetadata) => { - const successRespList = []; - const batchErrorRespList = []; - inputs.forEach((input) => { - try { - let resp = input.message; - // transform if not already done - if (!input.message.statusCode) { - resp = process(input); - } - - successRespList.push({ - message: Array.isArray(resp) ? resp : [resp], - metadata: input.metadata, - destination: input.destination, - }); - } catch (error) { - batchErrorRespList.push(handleRtTfSingleEventError(input, error, reqMetadata)); - } - }); - - let batchResponseList = []; - if (successRespList.length > 0) { - batchResponseList = batchEvents(successRespList); - } - - return [...batchResponseList, ...batchErrorRespList]; -}; - -module.exports = { process, processRouterDest }; diff --git a/src/v0/destinations/pinterest_tag/utils.js b/src/v0/destinations/pinterest_tag/utils.js deleted file mode 100644 index 57d595571f..0000000000 --- a/src/v0/destinations/pinterest_tag/utils.js +++ /dev/null @@ -1,416 +0,0 @@ -/* eslint-disable no-param-reassign */ -const sha256 = require('sha256'); -const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); -const { EventType } = require('../../../constants'); -const { - constructPayload, - isDefinedAndNotNull, - isDefined, - getHashFromArrayWithDuplicate, - removeUndefinedAndNullValues, - validateEventName, -} = require('../../util'); -const { COMMON_CONFIGS, CUSTOM_CONFIGS, API_VERSION } = require('./config'); - -const VALID_ACTION_SOURCES = ['app_android', 'app_ios', 'web', 'offline']; - -const ecomEventMaps = [ - { - src: ['order completed'], - dest: 'checkout', - }, - { - src: ['product added'], - dest: 'add_to_cart', - }, - { - src: ['products searched', 'product list filtered'], - dest: 'search', - }, -]; - -const USER_NON_ARRAY_PROPERTIES = ['client_user_agent', 'client_ip_address']; - -const getHashedValue = (key, value) => { - switch (key) { - case 'em': - case 'ct': - case 'st': - case 'country': - case 'ln': - case 'fn': - case 'ge': - value = Array.isArray(value) - ? value.map((val) => val.toString().trim().toLowerCase()) - : value.toString().trim().toLowerCase(); - break; - case 'ph': - // phone numbers should only contain digits & should not contain leading zeros - value = Array.isArray(value) - ? value.map((val) => val.toString().replace(/\D/g, '').replace(/^0+/, '')) - : value.toString().replace(/\D/g, '').replace(/^0+/, ''); - break; - case 'zp': - // zip fields should only contain digits - value = Array.isArray(value) - ? value.map((val) => val.toString().trim().replace(/\D/g, '')) - : value.toString().replace(/\D/g, ''); - break; - case 'hashed_maids': - case 'external_id': - case 'db': - // no action needed on value - break; - default: - return String(value); - } - return Array.isArray(value) ? value.map((val) => sha256(val)) : [sha256(value)]; -}; - -/** - * - * @param {*} userPayload Payload mapped from user fields - * @returns - * Further Processing the user fields following the instructions of Pinterest Conversion API - * Ref: https://s.pinimg.com/ct/docs/conversions_api/dist/v3.html - */ -const processUserPayload = (userPayload) => { - Object.keys(userPayload).forEach((key) => { - userPayload[key] = getHashedValue(key, userPayload[key]); - }); - return userPayload; -}; - -/** - * - * @param {*} message - * @returns opt_out status - * - */ - -const deduceOptOutStatus = (message) => { - const adTrackingEnabled = message.context?.device?.adTrackingEnabled; - let optOut; - - // for ios - if (isDefinedAndNotNull(adTrackingEnabled)) { - if (adTrackingEnabled === true) { - optOut = false; - } else if (adTrackingEnabled === false) { - optOut = true; - } - } - - return optOut; -}; - -/** - * - * @param {*} message - * @returns - * Maps the required common parameters accross event types. Checks for the correct - * action source types and deduces opt_out status - * Ref: https://s.pinimg.com/ct/docs/conversions_api/dist/v3.html - */ -const processCommonPayload = (message) => { - const commonPayload = constructPayload(message, COMMON_CONFIGS); - const presentActionSource = commonPayload.action_source; - if (presentActionSource && !VALID_ACTION_SOURCES.includes(presentActionSource.toLowerCase())) { - throw new InstrumentationError( - `Action source must be one of ${VALID_ACTION_SOURCES.join(', ')}`, - ); - } - - commonPayload.opt_out = deduceOptOutStatus(message); - - return commonPayload; -}; - -/** - * - * @param {*} eventName // ["WatchVideo", "ViewCategory", "Custom"] - * @returns // ["watch_video", "view_category", "custom""] - * This function will return the snake case name of the destination config mapped event - */ -const convertToSnakeCase = (eventName) => - eventName.map((str) => - str - .replace(/([a-z])([A-Z])/g, '$1_$2') - .replace(/\s+/g, '_') - .toLowerCase(), - ); - -/** - * - * @param {*} message - * @param {*} Config - * @returns - * For the few ecommerce events the mapping is like following: - * const ecomEventMaps = [ - { - src: ["order completed"], - dest: "checkout", - }, - { - src: ["product added"], - dest: "add_to_cart", - }, - { - src: ["products searched", "product list filtered"], - dest: "search", - }, - ]; - * For others, it depends on mapping from the UI. If any event, other than mapped events are sent, - * will be labled as "custom" events. - */ -const deduceTrackScreenEventName = (message, Config) => { - let eventName; - const { event, name } = message; - const { eventsMapping, sendAsCustomEvent } = Config; - const trackEventOrScreenName = event || name; - if (!trackEventOrScreenName) { - throw new InstrumentationError('event_name could not be mapped. Aborting'); - } - validateEventName(trackEventOrScreenName); - - /* - Step 1: If the event is not amongst the above list of ecommerce events, will look for - the event mapping in the UI. In case it is similar, will map to that. - */ - if (eventsMapping.length > 0) { - const keyMap = getHashFromArrayWithDuplicate(eventsMapping, 'from', 'to', false); - eventName = keyMap[trackEventOrScreenName]; - } - if (isDefined(eventName)) { - return convertToSnakeCase([...eventName]); - } - - /* - Step 2: To find if the particular event is amongst the list of standard - Rudderstack ecommerce events, used specifically for Pinterest Conversion API - mappings. - */ - if (!eventName) { - const eventMapInfo = ecomEventMaps.find((eventMap) => { - if (eventMap.src.includes(trackEventOrScreenName.toLowerCase())) { - return eventMap; - } - return false; - }); - - if (isDefinedAndNotNull(eventMapInfo)) { - return [eventMapInfo.dest]; - } - } - - /* - Step 3: In case both of the above stated cases fail, will check if sendAsCustomEvent toggle is enabled in UI. - If yes, then we will send it as custom event - */ - if (sendAsCustomEvent) { - return ['custom']; - } - - /* - Step 4: In case all of the above stated cases failed, will send the event name as it is. - This is going to be reflected as "unknown" event in conversion API dashboard. - */ - return [trackEventOrScreenName]; -}; - -/** - * - * @param {*} message event.message - * @param {*} Config event.destination.Config - * @returns - * Returns the appropriate event name for each event types - * For identify : "identify". - * For page : "ViewCategory" in case category is present, "PageVisit" otherwise. - * For track : Depends on the event name - */ -const deduceEventName = (message, Config) => { - const { type, category } = message; - let eventName = []; - switch (type) { - case EventType.PAGE: - eventName = isDefinedAndNotNull(category) ? ['view_category'] : ['page_visit']; - break; - case EventType.TRACK: - case EventType.SCREEN: - eventName = deduceTrackScreenEventName(message, Config); - break; - default: - throw new InstrumentationError(`The event of type ${type} is not supported`); - } - return eventName; -}; - -/** - * - * @param {*} rootObject object from where the price, quantity and ids will be fetched - * @param {*} message event.message - * @returns - * Object containing the deduced parameters - */ -const setIdPriceQuantity = (rootObject, message) => { - const contentObj = { - // we are yet to check how the destination behaves if one of quantity and item_price is missing - quantity: parseInt(rootObject.quantity || message.properties.quantity || 1, 10), - item_price: String(rootObject.price || message.properties.price), - }; - return { - contentId: rootObject.product_id || rootObject.sku || rootObject.id, - content: contentObj, - }; -}; - -/** - * @param {*} userPayload Payload mapped from user fields - * @returns returns true if at least one of: em, hashed_maids or combination of client_ip_address and - * client_user_agent is present. And false otherwise. - */ -const checkUserPayloadValidity = (userPayload) => { - const userFields = Object.keys(userPayload); - if (userFields.includes('em') || userFields.includes('hashed_maids')) { - return true; - } - return userFields.includes('client_ip_address') && userFields.includes('client_user_agent'); -}; - -/** - * - * @param {*} userPayload - * @param {*} message - * @returns converts every single hashed user data property to array, except for - * "client_user_agent", "client_ip_address" - * - */ -const processHashedUserPayload = (userPayload, message) => { - const processedHashedUserPayload = {}; - Object.keys(userPayload).forEach((key) => { - if (!USER_NON_ARRAY_PROPERTIES.includes(key)) { - if (Array.isArray(userPayload[key])) { - processedHashedUserPayload[key] = [...userPayload[key]]; - } else { - processedHashedUserPayload[key] = [userPayload[key]]; - } - } else { - processedHashedUserPayload[key] = userPayload[key]; - } - }); - // multiKeyMap will works on only specific values like m, male, MALE, f, F, Female - // if hashed data is sent from the user, it is directly set over here - const gender = message.traits?.gender || message.context?.traits?.gender; - if (gender && Array.isArray(gender)) { - processedHashedUserPayload.ge = [...gender]; - } else if (gender) { - processedHashedUserPayload.ge = [gender]; - } - return processedHashedUserPayload; -}; - -/** - * This function will process the ecommerce fields and return the final payload - * @param {*} message - * @param {*} mandatoryPayload - * @returns - */ -const postProcessEcomFields = (message, mandatoryPayload) => { - let totalQuantity = 0; - let quantityInconsistent = false; - const contentArray = []; - const contentIds = []; - const { properties } = message; - // ref: https://s.pinimg.com/ct/docs/conversions_api/dist/v3.html - let customPayload = constructPayload(message, CUSTOM_CONFIGS); - - // if product array is present will look for the product level information - if (properties.products && Array.isArray(properties.products) && properties.products.length > 0) { - const { products, quantity } = properties; - products.forEach((product) => { - const prodParams = setIdPriceQuantity(product, message); - if (prodParams.contentId) { - contentIds.push(prodParams.contentId); - } - contentArray.push(prodParams.content); - if (!product.quantity) { - quantityInconsistent = true; - } - totalQuantity = product.quantity ? totalQuantity + product.quantity : totalQuantity; - }); - - if (totalQuantity === 0) { - /* - in case any of the products inside product array does not have quantity, - will map the quantity of root level - */ - totalQuantity = quantity; - } - } else { - /* - for the events where product array is not present, root level id, price and - quantity are taken into consideration - */ - const prodParams = setIdPriceQuantity(properties, message); - if (prodParams.contentId) { - contentIds.push(prodParams.contentId); - } - contentArray.push(prodParams.content); - totalQuantity = properties.quantity ? totalQuantity + properties.quantity : totalQuantity; - } - /* - if properties.numOfItems is not provided by the user, the total quantity of the products - will be sent as num_items - */ - if (!isDefinedAndNotNull(customPayload.num_items) && quantityInconsistent === false) { - customPayload.num_items = parseInt(totalQuantity, 10); - } - customPayload = { - ...customPayload, - contents: contentArray, - }; - - if (contentIds.length > 0) { - customPayload.content_ids = contentIds; - } - - return { - ...mandatoryPayload, - custom_data: { ...removeUndefinedAndNullValues(customPayload) }, - }; -}; - -const validateInput = (message, { Config }) => { - const { apiVersion = API_VERSION.v3, advertiserId, adAccountId, conversionToken } = Config; - if (apiVersion === API_VERSION.v3 && !advertiserId) { - throw new ConfigurationError('Advertiser Id not found. Aborting'); - } - - if (apiVersion === API_VERSION.v5) { - if (!adAccountId) { - throw new ConfigurationError('Ad Account ID not found. Aborting'); - } - - if (!conversionToken) { - throw new ConfigurationError('Conversion Token not found. Aborting'); - } - } - - if (!message.type) { - throw new InstrumentationError('Event type is required'); - } -}; - -module.exports = { - processUserPayload, - processCommonPayload, - deduceEventName, - setIdPriceQuantity, - checkUserPayloadValidity, - processHashedUserPayload, - VALID_ACTION_SOURCES, - postProcessEcomFields, - ecomEventMaps, - convertToSnakeCase, - validateInput, -}; diff --git a/test/__tests__/data/pinterest_tag_input.json b/test/__tests__/data/pinterest_tag_input.json index f0755ddb38..15e378caf6 100644 --- a/test/__tests__/data/pinterest_tag_input.json +++ b/test/__tests__/data/pinterest_tag_input.json @@ -47,6 +47,7 @@ "optOutType": "LDP", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -57,6 +58,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -153,6 +155,7 @@ "requestIP": "123.0.0.0", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -163,6 +166,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -554,6 +558,7 @@ "numOfItems": 2, "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -564,6 +569,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -981,6 +987,7 @@ "numOfItems": 2, "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -991,6 +998,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -1773,6 +1781,7 @@ "checkout_id": "fksdjfsdjfisjf9sdfjsd9f", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -1954,6 +1963,7 @@ "optOutType": "LDP", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -1964,6 +1974,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -2065,6 +2076,7 @@ "optOutType": "LDP", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -2075,6 +2087,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -2176,6 +2189,7 @@ "optOutType": "LDP", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -2186,6 +2200,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, diff --git a/test/__tests__/data/pinterest_tag_output.json b/test/__tests__/data/pinterest_tag_output.json index 9fb809d112..dccdb248c9 100644 --- a/test/__tests__/data/pinterest_tag_output.json +++ b/test/__tests__/data/pinterest_tag_output.json @@ -41,10 +41,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -58,6 +66,7 @@ "files": {} } ], + [ { "version": "1", @@ -96,10 +105,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -210,10 +227,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -277,10 +302,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -649,6 +682,10 @@ "content_ids": ["507f1f77bcf86cd799439011"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" } @@ -752,10 +789,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -808,10 +853,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -888,10 +941,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } diff --git a/test/__tests__/data/pinterest_tag_router_batch_output.json b/test/__tests__/data/pinterest_tag_router_batch_output.json index 995d68428a..0eb8f0532a 100644 --- a/test/__tests__/data/pinterest_tag_router_batch_output.json +++ b/test/__tests__/data/pinterest_tag_router_batch_output.json @@ -43,10 +43,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -83,10 +91,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -122,10 +138,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -272,10 +296,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -311,10 +343,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -572,12 +612,20 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { - "item_price": "19", - "quantity": 1 + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", + "quantity": 1, + "item_price": "19" }, { - "item_price": "3", - "quantity": 2 + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", + "quantity": 2, + "item_price": "3" } ], "currency": "USD", @@ -611,12 +659,20 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { - "item_price": "19", - "quantity": 1 + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", + "quantity": 1, + "item_price": "19" }, { - "item_price": "3", - "quantity": 2 + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", + "quantity": 2, + "item_price": "3" } ], "currency": "USD", @@ -650,12 +706,20 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { - "item_price": "19", - "quantity": 1 + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", + "quantity": 1, + "item_price": "19" }, { - "item_price": "3", - "quantity": 2 + "item_brand": "testBrand", + "id": "505bd76785ebb509fc183733", + "item_category": "Games", + "item_name": "Uno Card Game", + "quantity": 2, + "item_price": "3" } ], "currency": "USD", @@ -767,12 +831,20 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { - "item_price": "19", - "quantity": 1 + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", + "quantity": 1, + "item_price": "19" }, { - "item_price": "3", - "quantity": 2 + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", + "quantity": 2, + "item_price": "3" } ], "currency": "USD", diff --git a/test/__tests__/data/pinterest_tag_router_input.json b/test/__tests__/data/pinterest_tag_router_input.json index 26febec456..c1639382d7 100644 --- a/test/__tests__/data/pinterest_tag_router_input.json +++ b/test/__tests__/data/pinterest_tag_router_input.json @@ -48,6 +48,7 @@ "optOutType": "LDP", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -58,6 +59,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -170,6 +172,7 @@ "requestIP": "123.0.0.0", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -180,6 +183,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -395,6 +399,7 @@ "requestIP": "123.0.0.0", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -405,6 +410,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -517,6 +523,7 @@ "requestIP": "123.0.0.0", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -527,6 +534,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -639,6 +647,7 @@ "requestIP": "123.0.0.0", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -649,6 +658,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -866,6 +876,7 @@ "optOutType": "LDP", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -876,6 +887,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -990,6 +1002,7 @@ "requestIP": "123.0.0.0", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -1000,6 +1013,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, @@ -1114,6 +1128,7 @@ "requestIP": "123.0.0.0", "products": [ { + "brand": "testBrand", "sku": "45790-32", "url": "https://www.example.com/product/path", "name": "Monopoly: 3rd Edition", @@ -1124,6 +1139,7 @@ "product_id": "507f1f77bcf86cd799439011" }, { + "brand": "testBrand", "sku": "46493-32", "name": "Uno Card Game", "price": 3, diff --git a/test/__tests__/data/pinterest_tag_router_output.json b/test/__tests__/data/pinterest_tag_router_output.json index 2bfc7c3cf5..a54d328978 100644 --- a/test/__tests__/data/pinterest_tag_router_output.json +++ b/test/__tests__/data/pinterest_tag_router_output.json @@ -43,10 +43,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -83,10 +91,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -122,10 +138,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -196,10 +220,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -235,10 +267,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -465,10 +505,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -504,10 +552,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -542,10 +598,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } @@ -580,10 +644,18 @@ "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], "contents": [ { + "id": "507f1f77bcf86cd799439011", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Monopoly: 3rd Edition", "quantity": 1, "item_price": "19" }, { + "id": "505bd76785ebb509fc183733", + "item_brand": "testBrand", + "item_category": "Games", + "item_name": "Uno Card Game", "quantity": 2, "item_price": "3" } diff --git a/test/__tests__/pinterestConversion.test.js b/test/__tests__/pinterestConversion.test.js deleted file mode 100644 index 4c145f0383..0000000000 --- a/test/__tests__/pinterestConversion.test.js +++ /dev/null @@ -1,54 +0,0 @@ -const integration = "pinterest_tag"; -const name = "Pinterest Conversion API"; - -const fs = require("fs"); -const path = require("path"); - -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); -const { assertRouterOutput } = require('../testHelper'); - -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -// Router Test Data -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -describe(`${name} Tests`, () => { - describe("Processor Tests", () => { - inputData.forEach((input, index) => { - it(`${name} - payload: ${index}`, async () => { - try { - const output = await transformer.process(input); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); - }); - }); - - describe("Router Tests", () => { - inputRouterData.forEach((input, index) => { - it(`Payload: ${index}`, async () => { - let output = await transformer.processRouterDest(input); - assertRouterOutput(output, input); - expect(output).toEqual(expectedRouterData[index]); - }); - }); - }); -}); diff --git a/test/apitests/data_scenarios/destination/proc/batch_input_multiplex.json b/test/apitests/data_scenarios/destination/proc/batch_input_multiplex.json index 7dd8984f28..3ce7c15091 100644 --- a/test/apitests/data_scenarios/destination/proc/batch_input_multiplex.json +++ b/test/apitests/data_scenarios/destination/proc/batch_input_multiplex.json @@ -78,6 +78,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", @@ -254,6 +255,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", diff --git a/test/apitests/data_scenarios/destination/proc/multiplex_failure.json b/test/apitests/data_scenarios/destination/proc/multiplex_failure.json index dc9919fb1a..68c7fc3baa 100644 --- a/test/apitests/data_scenarios/destination/proc/multiplex_failure.json +++ b/test/apitests/data_scenarios/destination/proc/multiplex_failure.json @@ -77,6 +77,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", @@ -206,13 +207,13 @@ "destinationDefinitionId": "" }, "statusCode": 400, - "error": "Missing required value from [\"traits.action_source\",\"context.traits.action_source\",\"traits.actionSource\",\"context.traits.actionSource\",\"properties.action_source\",\"properties.actionSource\",\"channel\"]", + "error": "action_source is required: Workflow: procWorkflow, Step: validateCommonFields, ChildStep: undefined, OriginalError: action_source is required", "statTags": { "errorCategory": "dataValidation", "errorType": "instrumentation", "destType": "PINTEREST_TAG", "module": "destination", - "implementation": "native", + "implementation": "cdkV2", "feature": "processor", "destinationId": "2JIqVoWNvSOHa9ppKOqSo4hPuc0", "workspaceId": "27O0bhB6p5ehfOWeeZlOSsSDTLg" diff --git a/test/apitests/data_scenarios/destination/proc/multiplex_partial_failure.json b/test/apitests/data_scenarios/destination/proc/multiplex_partial_failure.json index 63194f1b87..0e467c26d0 100644 --- a/test/apitests/data_scenarios/destination/proc/multiplex_partial_failure.json +++ b/test/apitests/data_scenarios/destination/proc/multiplex_partial_failure.json @@ -78,6 +78,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", @@ -254,6 +255,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", @@ -543,13 +545,13 @@ "destinationDefinitionId": "" }, "statusCode": 400, - "error": "Action source must be one of app_android, app_ios, web, offline", + "error": "Action source must be one of app_android, app_ios, web, offline: Workflow: procWorkflow, Step: validateCommonFields, ChildStep: undefined, OriginalError: Action source must be one of app_android, app_ios, web, offline", "statTags": { "errorCategory": "dataValidation", "errorType": "instrumentation", "destType": "PINTEREST_TAG", "module": "destination", - "implementation": "native", + "implementation": "cdkV2", "feature": "processor", "destinationId": "2JIqVoWNvSOHa9ppKOqSo4hPuc0", "workspaceId": "27O0bhB6p5ehfOWeeZlOSsSDTLg" diff --git a/test/apitests/data_scenarios/destination/proc/multiplex_success.json b/test/apitests/data_scenarios/destination/proc/multiplex_success.json index bf1b1aae81..66b6c870a9 100644 --- a/test/apitests/data_scenarios/destination/proc/multiplex_success.json +++ b/test/apitests/data_scenarios/destination/proc/multiplex_success.json @@ -78,6 +78,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", diff --git a/test/apitests/data_scenarios/destination/router/failure_test.json b/test/apitests/data_scenarios/destination/router/failure_test.json index 96c5cff54f..9e36da50cb 100644 --- a/test/apitests/data_scenarios/destination/router/failure_test.json +++ b/test/apitests/data_scenarios/destination/router/failure_test.json @@ -141,6 +141,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", @@ -378,6 +379,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", @@ -615,6 +617,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", @@ -991,6 +994,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", @@ -1192,7 +1196,7 @@ "errorType": "instrumentation", "destType": "PINTEREST_TAG", "module": "destination", - "implementation": "native", + "implementation": "cdkV2", "feature": "router", "destinationId": "2JIqVoWNvSOHa9ppKOqSo4hPuc0", "workspaceId": "27O0bhB6p5ehfOWeeZlOSsSDTLg" @@ -1206,6 +1210,7 @@ "DisplayName": "Pinterest Tag", "Config": { "cdkV2TestThreshold": 1, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": [ "tagId", diff --git a/test/apitests/service.api.test.ts b/test/apitests/service.api.test.ts index 30d2c568a6..2a0db6978e 100644 --- a/test/apitests/service.api.test.ts +++ b/test/apitests/service.api.test.ts @@ -449,7 +449,6 @@ describe('Destination api tests', () => { expect(response.status).toEqual(200); expect(JSON.parse(response.text)).toEqual(data.output); }); - test('(webhook) success snceario for batch of input', async () => { const data = getDataFromPath('./data_scenarios/destination/proc/batch_input.json'); const response = await request(server) diff --git a/test/integrations/destinations/pinterest_tag/processor/data.ts b/test/integrations/destinations/pinterest_tag/processor/data.ts index 48b624645f..b856d247d7 100644 --- a/test/integrations/destinations/pinterest_tag/processor/data.ts +++ b/test/integrations/destinations/pinterest_tag/processor/data.ts @@ -26,13 +26,21 @@ export const data = [ lastname: 'Rudderlabs', firstName: 'Test', address: { city: 'Kolkata', state: 'WB', zip: '700114', country: 'IN' }, + partnerId: '12345678', }, device: { advertisingId: 'abc123' }, library: { name: 'rudder-sdk-ruby-sync', version: '1.0.6' }, + network: { + carrier: 'VI', + wifi: true, + }, }, messageId: '7208bbb6-2c4e-45bb-bf5b-ad426f3593e9', timestamp: '2020-08-14T05:30:30.118Z', properties: { + contentBrand: 'LV', + partnerName: 'testPartner', + contentName: 'testContent', tax: 2, total: 27.5, coupon: 'hasbros', @@ -106,55 +114,77 @@ export const data = [ { metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://ct.pinterest.com/events/v3', - headers: { 'Content-Type': 'application/json' }, - params: { test: true }, body: { + FORM: {}, JSON: { action_source: 'web', + advertiser_id: '429047995', + app_id: '429047995', + custom_data: { + content_brand: 'LV', + content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], + content_name: 'testContent', + contents: [ + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + item_price: '19', + quantity: 1, + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + item_price: '3', + quantity: 2, + }, + ], + currency: 'USD', + num_items: 3, + opt_out_type: 'LDP', + order_id: '50314b8e9bcf000000000000', + value: '27.5', + }, + device_carrier: 'VI', + event_id: '7208bbb6-2c4e-45bb-bf5b-ad426f3593e9', event_name: 'watch_video', event_time: 1597383030, - event_id: '7208bbb6-2c4e-45bb-bf5b-ad426f3593e9', - app_id: '429047995', - advertiser_id: '429047995', + partner_name: 'testPartner', user_data: { + click_id: 'dummy_clickId', + client_user_agent: 'chrome', + country: ['582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf'], + ct: ['6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85'], em: ['48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08'], - ph: ['d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b'], - ln: ['dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251'], fn: ['9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'], - ct: ['6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85'], - st: ['3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd'], - zp: ['1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c'], - country: ['582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf'], + ge: ['1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9'], hashed_maids: [ '6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090', ], - client_user_agent: 'chrome', - click_id: 'dummy_clickId', - ge: ['1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9'], - }, - custom_data: { - currency: 'USD', - value: '27.5', - order_id: '50314b8e9bcf000000000000', - opt_out_type: 'LDP', - num_items: 3, - content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], - contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, - ], + ln: ['dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251'], + partner_id: '12345678', + ph: ['d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b'], + st: ['3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd'], + zp: ['1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c'], }, + wifi: true, }, JSON_ARRAY: {}, XML: {}, - FORM: {}, }, + endpoint: 'https://ct.pinterest.com/events/v3', files: {}, + headers: { + 'Content-Type': 'application/json', + }, + method: 'POST', + params: { + test: true, + }, + type: 'REST', userId: '', + version: '1', }, statusCode: 200, }, @@ -302,8 +332,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -835,8 +877,20 @@ export const data = [ order_id: '50314b8e9bcf000000000000', content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -1357,8 +1411,20 @@ export const data = [ order_id: '50314b8e9bcf000000000000', content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -2486,7 +2552,15 @@ export const data = [ order_id: '50314b8e9bcf000000000000', num_items: 1, content_ids: ['507f1f77bcf86cd799439011'], - contents: [{ quantity: 1, item_price: '19' }], + contents: [ + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + ], }, }, JSON_ARRAY: {}, @@ -2785,8 +2859,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -2951,8 +3037,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -2980,7 +3078,7 @@ export const data = [ body: [ { description: - 'Custom event with v5 Api version, with unhashed User Data and the values are an array of strings', + 'Custom event with v5 Api version, with unhashed User Data and the values are an of strings', message: { type: 'track', event: 'random', @@ -3147,8 +3245,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, diff --git a/test/integrations/destinations/pinterest_tag/router/data.ts b/test/integrations/destinations/pinterest_tag/router/data.ts index c02b1781e3..c9ab29a45a 100644 --- a/test/integrations/destinations/pinterest_tag/router/data.ts +++ b/test/integrations/destinations/pinterest_tag/router/data.ts @@ -674,8 +674,20 @@ export const data = [ opt_out_type: 'LDP', content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -710,8 +722,20 @@ export const data = [ opt_out_type: 'LDP', content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -745,8 +769,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -812,8 +848,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -847,8 +895,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -981,7 +1041,7 @@ export const data = [ }, { destType: 'pinterest_tag', - description: 'Test 0', + description: 'Test 1', feature: 'router', module: 'destination', version: 'v0', @@ -1328,8 +1388,20 @@ export const data = [ opt_out_type: 'LDP', content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -1363,8 +1435,20 @@ export const data = [ opt_out_type: 'LDP', content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -1397,8 +1481,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -1431,8 +1527,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -1488,7 +1596,7 @@ export const data = [ }, { destType: 'pinterest_tag', - description: 'Test 0', + description: 'Test 2', feature: 'router', module: 'destination', version: 'v0', diff --git a/test/integrations/destinations/pinterest_tag/step/data.ts b/test/integrations/destinations/pinterest_tag/step/data.ts index cbd0b243bb..b607e3c9fa 100644 --- a/test/integrations/destinations/pinterest_tag/step/data.ts +++ b/test/integrations/destinations/pinterest_tag/step/data.ts @@ -75,6 +75,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -90,6 +91,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -101,6 +103,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -139,8 +144,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -232,6 +249,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -247,6 +265,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -258,6 +277,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -294,8 +316,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -368,6 +402,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -383,6 +418,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -394,6 +430,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -519,6 +558,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -534,6 +574,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -545,13 +586,17 @@ export const data = [ status: 200, body: [ { - error: 'Advertiser Id not found. Aborting', + error: + 'Advertiser Id not found. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Advertiser Id not found. Aborting', + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, statTags: { destType: 'PINTEREST_TAG', errorCategory: 'dataValidation', errorType: 'configuration', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -633,6 +678,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -648,6 +694,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -660,13 +707,16 @@ export const data = [ body: [ { error: - 'It is required at least one of em, hashed_maids or pair of client_ip_address and client_user_agent', + 'It is required at least one of em, hashed_maids or pair of client_ip_address and client_user_agent: Workflow: procWorkflow, Step: validateUserFields, ChildStep: undefined, OriginalError: It is required at least one of em, hashed_maids or pair of client_ip_address and client_user_agent', + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, statTags: { destType: 'PINTEREST_TAG', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -751,6 +801,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -766,6 +817,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -777,6 +829,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -813,8 +868,20 @@ export const data = [ order_id: '50314b8e9bcf000000000000', content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -907,6 +974,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -922,6 +990,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -933,13 +1002,17 @@ export const data = [ status: 200, body: [ { - error: 'Advertiser Id not found. Aborting', + error: + 'Advertiser Id not found. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Advertiser Id not found. Aborting', + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, statTags: { destType: 'PINTEREST_TAG', errorCategory: 'dataValidation', errorType: 'configuration', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -1023,6 +1096,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1038,6 +1112,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1049,13 +1124,17 @@ export const data = [ status: 200, body: [ { - error: 'message type group is not supported', + error: + 'message type group is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type group is not supported', + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, statTags: { destType: 'PINTEREST_TAG', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -1140,6 +1219,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1155,6 +1235,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1166,13 +1247,17 @@ export const data = [ status: 200, body: [ { - error: 'Action source must be one of app_android, app_ios, web, offline', + error: + 'Action source must be one of app_android, app_ios, web, offline: Workflow: procWorkflow, Step: validateCommonFields, ChildStep: undefined, OriginalError: Action source must be one of app_android, app_ios, web, offline', + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, statTags: { destType: 'PINTEREST_TAG', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -1257,6 +1342,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1273,6 +1359,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1284,6 +1371,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -1320,8 +1410,20 @@ export const data = [ order_id: '50314b8e9bcf000000000000', content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -1378,6 +1480,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1393,6 +1496,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1404,6 +1508,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -1488,6 +1595,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1503,6 +1611,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1514,6 +1623,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -1598,6 +1710,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1613,6 +1726,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1624,6 +1738,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -1709,6 +1826,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1724,6 +1842,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1735,6 +1854,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -1821,6 +1943,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1834,6 +1957,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1845,6 +1969,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -1933,6 +2060,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -1946,6 +2074,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -1957,6 +2086,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -2096,6 +2228,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -2114,6 +2247,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -2125,6 +2259,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { body: { JSON: { @@ -2216,6 +2353,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -2232,6 +2370,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -2243,6 +2382,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -2360,6 +2502,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -2376,6 +2519,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -2387,6 +2531,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -2422,7 +2569,15 @@ export const data = [ order_id: '50314b8e9bcf000000000000', num_items: 1, content_ids: ['507f1f77bcf86cd799439011'], - contents: [{ quantity: 1, item_price: '19' }], + contents: [ + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + ], }, }, JSON_ARRAY: {}, @@ -2491,6 +2646,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -2506,6 +2662,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -2517,6 +2674,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { body: { FORM: {}, @@ -2644,6 +2804,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -2662,6 +2823,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -2673,6 +2835,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -2715,8 +2880,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -2810,6 +2987,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -2828,6 +3006,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -2839,6 +3018,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -2878,8 +3060,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -2979,6 +3173,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -2997,6 +3192,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -3008,6 +3204,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', @@ -3071,8 +3270,20 @@ export const data = [ num_items: 3, content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], contents: [ - { quantity: 1, item_price: '19' }, - { quantity: 2, item_price: '3' }, + { + id: '507f1f77bcf86cd799439011', + item_category: 'Games', + item_name: 'Monopoly: 3rd Edition', + quantity: 1, + item_price: '19', + }, + { + id: '505bd76785ebb509fc183733', + item_category: 'Games', + item_name: 'Uno Card Game', + quantity: 2, + item_price: '3', + }, ], }, }, @@ -3129,6 +3340,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -3147,6 +3359,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -3158,13 +3371,17 @@ export const data = [ status: 200, body: [ { - error: 'Ad Account ID not found. Aborting', + error: + 'Ad Account ID not found. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Ad Account ID not found. Aborting', + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, statTags: { destType: 'PINTEREST_TAG', errorCategory: 'dataValidation', errorType: 'configuration', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -3213,6 +3430,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -3231,6 +3449,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -3242,13 +3461,17 @@ export const data = [ status: 200, body: [ { - error: 'Conversion Token not found. Aborting', + error: + 'Conversion Token not found. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Conversion Token not found. Aborting', + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, statTags: { destType: 'PINTEREST_TAG', errorCategory: 'dataValidation', errorType: 'configuration', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -3310,6 +3533,7 @@ export const data = [ destination: { ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', Name: 'PINTEREST_TAG', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { sendAsTestEvent: false, tagId: '123456789', @@ -3328,6 +3552,7 @@ export const data = [ Enabled: true, Transformations: [], }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, }, ], method: 'POST', @@ -3339,6 +3564,9 @@ export const data = [ status: 200, body: [ { + metadata: { + destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + }, output: { version: '1', type: 'REST', From dc6d78fc5870ba31e6f3fa557ab31a3f073b72ca Mon Sep 17 00:00:00 2001 From: Sankeerth Date: Fri, 18 Oct 2024 15:03:39 +0530 Subject: [PATCH 05/21] chore: cleanup pinterest tag old tests (#3815) Co-authored-by: Sai Sankeerth --- test/__tests__/data/pinterest_tag_input.json | 2491 ----------------- test/__tests__/data/pinterest_tag_output.json | 1027 ------- .../pinterest_tag_router_batch_output.json | 943 ------- .../pinterest_tag_router_error_input.json | 124 - .../pinterest_tag_router_error_output.json | 59 - .../data/pinterest_tag_router_input.json | 1212 -------- .../data/pinterest_tag_router_output.json | 735 ----- .../data/pinterest_tag_step_input.json | 2476 ---------------- .../data/pinterest_tag_step_output.json | 911 ------ .../__tests__/pinterestConversion-cdk.test.ts | 135 - 10 files changed, 10113 deletions(-) delete mode 100644 test/__tests__/data/pinterest_tag_input.json delete mode 100644 test/__tests__/data/pinterest_tag_output.json delete mode 100644 test/__tests__/data/pinterest_tag_router_batch_output.json delete mode 100644 test/__tests__/data/pinterest_tag_router_error_input.json delete mode 100644 test/__tests__/data/pinterest_tag_router_error_output.json delete mode 100644 test/__tests__/data/pinterest_tag_router_input.json delete mode 100644 test/__tests__/data/pinterest_tag_router_output.json delete mode 100644 test/__tests__/data/pinterest_tag_step_input.json delete mode 100644 test/__tests__/data/pinterest_tag_step_output.json delete mode 100644 test/__tests__/pinterestConversion-cdk.test.ts diff --git a/test/__tests__/data/pinterest_tag_input.json b/test/__tests__/data/pinterest_tag_input.json deleted file mode 100644 index 15e378caf6..0000000000 --- a/test/__tests__/data/pinterest_tag_input.json +++ /dev/null @@ -1,2491 +0,0 @@ -[ - { - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "gender": "non-binary", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsTestEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Order completed", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "product added", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "product_id": "123", - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Product List Filtered", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Product List Filtered", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "group", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "enhancedMatch": true, - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "ABC Searched", - "channel": "abc", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "custom event", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123", - "adTrackingEnabled": true - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "ip": "127.0.0.0", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "adTrackingEnabled": false - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "requestIP": "127.0.0.0", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "phone": "Hashed phone", - "gender": "Hashed Gender", - "dob": "Hashed DB", - "lastname": "Hashed Lastname", - "firstName": "Hashed FirstName", - "address": { - "city": "Hashed City", - "state": "Hashed State", - "zip": "Hashed Zip", - "country": "Hashed country" - } - }, - "device": { - "adTrackingEnabled": false, - "advertisingId": "Hashed maids" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": false, - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "requestIP": "127.0.0.0", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "phone": ["Hashed phone", "Hashed phone1"], - "gender": ["Hashed Gender", "Hashed Gender1"], - "dob": ["Hashed DB", "Hashed DB1"], - "lastname": ["Hashed Lastname", "Hashed Lastname1"], - "firstName": ["Hashed FirstName", "Hashed FirstName1"], - "address": { - "city": ["Hashed City", "Hashed City1"], - "state": ["Hashed State", "Hashed State1"], - "zip": ["Hashed Zip", "Hashed Zip1"], - "country": ["Hashed country", "Hashed country1"] - } - }, - "device": { - "adTrackingEnabled": false, - "advertisingId": "Hashed maids" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": false, - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "name": "Test Tool", - "type": "page", - "sentAt": "2023-02-01T00:00:00.379Z", - "userId": "", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "version": "2.22.3", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "https://www.abc.com/s598907", - "path": "/test-path/s598907", - "title": "Test Tool + Reviews | Rudderstack", - "search": "", - "tab_url": "https://www.abc.com/s598907", - "referrer": "$direct", - "initial_referrer": "$direct", - "referring_domain": "", - "initial_referring_domain": "" - }, - "locale": "en-US", - "screen": { - "width": 1024, - "height": 1024, - "density": 1, - "innerWidth": 1024, - "innerHeight": 1024 - }, - "traits": {}, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "2.22.3" - }, - "campaign": {}, - "doNotSell": false, - "sessionId": 1675209600203, - "userAgent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/109.0.5414.101 Safari/537.36", - "gaClientId": { - "integrations": { - "Google Ads": { - "gclid": "" - }, - "Google Analytics": { - "clientId": "1518934611.1234569600" - } - } - }, - "sessionStart": true - }, - "rudderId": "7291a10f-e7dd-49f9-94ce-0154f53897y6", - "messageId": "1c77a616-13a7-4a2e-a8e7-e1a0971897y6", - "timestamp": "2023-02-01T12:47:30.030Z", - "properties": { - "sku": "45790-32", - "url": "https://www.abc.com/23rty", - "name": "Test Tool", - "path": "/test-path/tool", - "email": "", - "title": "Test Tool + Reviews | Rudderstack", - "review": { - "reviewCount": 2, - "averageReview": 5, - "reviewContentID": ["238300132"] - }, - "search": "", - "tab_url": "https://www.abc/com", - "pageInfo": { - "pageId": "s592897", - "category": { - "pageType": "product", - "subCategory": "Dining & Kitchen Furniture", - "pageTemplate": "product detail grouper", - "primaryCategory": "Furniture" - }, - "brandType": "new brand" - }, - "referrer": "", - "subCategory": "Dining & Kitchen Furniture", - "primaryCategory": "Furniture", - "initial_referrer": "$direct", - "referring_domain": "", - "initial_referring_domain": "" - }, - "receivedAt": "2023-02-01T12:47:30.038Z", - "request_ip": "66.249.72.218", - "anonymousId": "a61c77a6-1613-474a-aee8-e7e1a0971047", - "integrations": { - "All": true - }, - "originalTimestamp": "2023-02-01T00:00:00.371Z" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123478671210", - "sendingUnHashedData": false, - "enableDeduplication": false, - "eventsMapping": [ - { - "from": "Product Added", - "to": "AddToCart" - }, - { - "from": "Order Completed", - "to": "Checkout" - }, - { - "from": "Product Viewed", - "to": "PageVisit" - }, - { - "from": "Lead", - "to": "Lead" - }, - { - "from": "Signup", - "to": "Signup" - } - ], - "enhancedMatch": true - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "test", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "sku": "1234", - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "custom event", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "sku": "1234", - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - } - ] - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "custom event", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Track call with v5 Api version and send external_id toggle enabled", - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendExternalId": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Custom event with v5 Api version", - "message": { - "type": "track", - "event": "random", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Custom event with v5 Api version, with unhashed User Data and the values are an array of strings", - "message": { - "type": "track", - "event": "random", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": ["abc@gmail.com", "def@gmail.com"], - "phone": ["+1234589947", "+1234589948"], - "ge": ["male", "male"], - "db": ["19950715", "19970615"], - "lastname": ["Rudderlabs", "Xu"], - "firstName": ["Test", "Alex"], - "address": { - "city": ["Kolkata", "Mumbai"], - "state": ["WB", "MH"], - "zip": ["700114", "700115"], - "country": ["IN", "IN"] - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Ad Account Id check in V5", - "message": { - "type": "track", - "event": "random", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Conversion Token check in V5", - "message": { - "type": "track", - "event": "random", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "custom event", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": false, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } -] diff --git a/test/__tests__/data/pinterest_tag_output.json b/test/__tests__/data/pinterest_tag_output.json deleted file mode 100644 index dccdb248c9..0000000000 --- a/test/__tests__/data/pinterest_tag_output.json +++ /dev/null @@ -1,1027 +0,0 @@ -[ - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": { - "test": true - }, - "body": { - "JSON": { - "action_source": "web", - "event_name": "watch_video", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome", - "ge": ["1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9"] - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "opt_out_type": "LDP", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "checkout", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "add_to_cart", - "action_source": "web", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 2, - "content_ids": ["123"], - "contents": [ - { - "quantity": 2, - "item_price": "25" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - { - "statusCode": 400, - "error": "Advertiser Id not found. Aborting" - }, - { - "statusCode": 400, - "error": "It is required at least one of em, hashed_maids or pair of client_ip_address and client_user_agent" - }, - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "watch_video", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "num_items": 2, - "order_id": "50314b8e9bcf000000000000", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - { - "statusCode": 400, - "error": "Advertiser Id not found. Aborting" - }, - { - "statusCode": 400, - "error": "message type group is not supported" - }, - { - "statusCode": 400, - "error": "Action source must be one of app_android, app_ios, web, offline" - }, - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "custom", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "action_source": "web", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "num_items": 2, - "order_id": "50314b8e9bcf000000000000", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "action_source": "web", - "event_name": "page_visit", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "action_source": "web", - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "opt_out": false, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "action_source": "web", - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "opt_out": true, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "action_source": "web", - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "client_ip_address": "127.0.0.0", - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "action_source": "web", - "opt_out": true, - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "user_data": { - "ph": ["Hashed phone"], - "db": ["Hashed DB"], - "ln": ["Hashed Lastname"], - "fn": ["Hashed FirstName"], - "ct": ["Hashed City"], - "st": ["Hashed State"], - "zp": ["Hashed Zip"], - "country": ["Hashed country"], - "hashed_maids": ["Hashed maids"], - "ge": ["Hashed Gender"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "action_source": "web", - "opt_out": true, - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "user_data": { - "ph": ["Hashed phone", "Hashed phone1"], - "db": ["Hashed DB", "Hashed DB1"], - "ln": ["Hashed Lastname", "Hashed Lastname1"], - "fn": ["Hashed FirstName", "Hashed FirstName1"], - "ct": ["Hashed City", "Hashed City1"], - "st": ["Hashed State", "Hashed State1"], - "zp": ["Hashed Zip", "Hashed Zip1"], - "country": ["Hashed country", "Hashed country1"], - "hashed_maids": ["Hashed maids"], - "ge": ["Hashed Gender", "Hashed Gender1"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "body": { - "JSON": { - "event_time": 1675255650, - "event_source_url": "https://www.abc.com/s598907", - "action_source": "web", - "app_name": "RudderLabs JavaScript SDK", - "app_version": "2.22.3", - "language": "en-US", - "event_id": "1c77a616-13a7-4a2e-a8e7-e1a0971897y6", - "advertiser_id": "123478671210", - "user_data": { - "client_ip_address": "66.249.72.218", - "client_user_agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/109.0.5414.101 Safari/537.36" - }, - "event_name": "page_visit" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "custom", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 0, - "content_ids": ["1234"], - "contents": [ - { - "quantity": 1, - "item_price": "undefined" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "custom", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 1, - "content_ids": ["507f1f77bcf86cd799439011"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "body": { - "FORM": {}, - "JSON": { - "action_source": "web", - "advertiser_id": "123456", - "app_id": "429047995", - "custom_data": { - "contents": [ - { - "item_price": "undefined", - "quantity": 1 - } - ], - "currency": "USD", - "num_items": 0, - "order_id": "50314b8e9bcf000000000000", - "value": "27.5" - }, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "event_name": "custom event", - "event_time": 1597383030, - "user_data": { - "client_user_agent": "chrome", - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"] - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://ct.pinterest.com/events/v3", - "files": {}, - "headers": { - "Content-Type": "application/json" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer conversionToken123" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "watch_video", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome", - "external_id": ["3217d71a74c219d6e31e28267b313a7ceb6a2c032db1a091c9416b25b2ae2bc8"] - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "opt_out_type": "LDP", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer conversionToken123" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "custom", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "opt_out_type": "LDP", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer conversionToken123" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "custom", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": [ - "48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08", - "c392e50ebeca7bea4405e9c545023451ac56620031f81263f681269bde14218b" - ], - "ph": [ - "d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b", - "22bdde2594851294f2a6f4c34af704e68b398b03129ea9ceb58f0ffe33f6db52" - ], - "ln": [ - "dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251", - "9c2f138690fca4890c3c4a6691610fbbbdf32091cc001f7355cfdf574baa52b9" - ], - "fn": [ - "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", - "4135aa9dc1b842a653dea846903ddb95bfb8c5a10c504a7fa16e10bc31d1fdf0" - ], - "ct": [ - "6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85", - "d209bcc17778fd19fd2bc0c99a3868bf011da5162d3a75037a605768ebc276e2" - ], - "st": [ - "3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd", - "1b0316ed1cfed044035c55363e02ccafab26d66b1c2746b94d17285f043324aa" - ], - "zp": [ - "1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c", - "4d6755aa1e85517191f06cc91448696c173e1195ae51f94a1670116ac7b5c47b" - ], - "country": [ - "582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf", - "582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf" - ], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "opt_out_type": "LDP", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - { - "statusCode": 400, - "error": "Ad Account ID not found. Aborting" - }, - { - "statusCode": 400, - "error": "Conversion Token not found. Aborting" - }, - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer conversionToken123" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "custom event", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 0, - "contents": [ - { - "quantity": 1, - "item_price": "undefined" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ] -] diff --git a/test/__tests__/data/pinterest_tag_router_batch_output.json b/test/__tests__/data/pinterest_tag_router_batch_output.json deleted file mode 100644 index 0eb8f0532a..0000000000 --- a/test/__tests__/data/pinterest_tag_router_batch_output.json +++ /dev/null @@ -1,943 +0,0 @@ -[ - [ - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "data": [ - { - "event_name": "watch_video", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "opt_out_type": "LDP", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "signup", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "opt_out_type": "LDP", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "checkout", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - } - ] - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 1, - "userId": "u1" - }, - { - "jobId": 2, - "userId": "u1" - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "data": [ - { - "event_name": "add_to_cart", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 2, - "content_ids": ["123"], - "contents": [ - { - "quantity": 2, - "item_price": "25" - } - ] - } - }, - { - "event_name": "search", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "signup", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - } - ] - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 3, - "userId": "u1" - }, - { - "jobId": 4, - "userId": "u1" - }, - { - "jobId": 6, - "userId": "u1" - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "data": [ - { - "action_source": "web", - "event_name": "WatchVideo", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["bdfdee6414a89d72bfbf5ee90b1f85924467bae1e3980d83c2cd348dc31d5819"], - "fn": ["ee5db3fe0253b651aca3676692e0c59b25909304f5c51d223a02a215d104144b"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - } - ] - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 7, - "userId": "u1" - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "metadata": [ - { - "jobId": 5, - "userId": "u1" - } - ], - "batched": false, - "statusCode": 400, - "error": "message type identify is not supported", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } - ], - [ - { - "batched": true, - "batchedRequest": { - "body": { - "FORM": {}, - "JSON": { - "data": [ - { - "action_source": "web", - "app_id": "429047995", - "custom_data": { - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ], - "currency": "USD", - "num_items": 3, - "opt_out_type": "LDP", - "order_id": "50314b8e9bcf000000000000", - "value": "27.5" - }, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "event_name": "watch_video", - "event_time": 1597383030, - "user_data": { - "client_user_agent": "chrome", - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"] - } - }, - { - "action_source": "web", - "app_id": "429047995", - "custom_data": { - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ], - "currency": "USD", - "num_items": 3, - "opt_out_type": "LDP", - "order_id": "50314b8e9bcf000000000000", - "value": "27.5" - }, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "event_name": "signup", - "event_time": 1597383030, - "user_data": { - "client_user_agent": "chrome", - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"] - } - }, - { - "action_source": "web", - "app_id": "429047995", - "custom_data": { - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "item_brand": "testBrand", - "id": "505bd76785ebb509fc183733", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ], - "currency": "USD", - "num_items": 3, - "order_id": "50314b8e9bcf000000000000", - "value": "27.5" - }, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "event_name": "checkout", - "event_time": 1597383030, - "user_data": { - "client_user_agent": "chrome", - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"] - } - } - ] - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "files": {}, - "headers": { - "Authorization": "Bearer conversionToken123", - "Content-Type": "application/json" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - }, - "destination": { - "Config": { - "sendAsTestEvent": false, - "adAccountId": "accountId123", - "apiVersion": "newApi", - "appId": "429047995", - "conversionToken": "conversionToken123", - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "deduplicationKey": "messageId", - "enableDeduplication": true, - "enhancedMatch": true, - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ], - "sendingUnHashedData": true, - "tagId": "123456789" - }, - "Enabled": true, - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Transformations": [] - }, - "metadata": [ - { - "jobId": 8, - "userId": "u1" - }, - { - "jobId": 9, - "userId": "u1" - } - ], - "statusCode": 200 - }, - { - "batched": true, - "batchedRequest": { - "body": { - "FORM": {}, - "JSON": { - "data": [ - { - "action_source": "web", - "app_id": "429047995", - "custom_data": { - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ], - "currency": "USD", - "num_items": 3, - "order_id": "50314b8e9bcf000000000000", - "value": "27.5" - }, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "event_name": "custom", - "event_time": 1597383030, - "user_data": { - "client_user_agent": "chrome", - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"] - } - } - ] - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "files": {}, - "headers": { - "Authorization": "Bearer conversionToken123", - "Content-Type": "application/json" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - }, - "destination": { - "Config": { - "sendAsTestEvent": false, - "adAccountId": "accountId123", - "apiVersion": "newApi", - "appId": "429047995", - "conversionToken": "conversionToken123", - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "deduplicationKey": "messageId", - "enableDeduplication": true, - "enhancedMatch": true, - "sendAsCustomEvent": true, - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ], - "sendingUnHashedData": true, - "tagId": "123456789" - }, - "Enabled": true, - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Transformations": [] - }, - "metadata": [ - { - "jobId": 10, - "userId": "u1" - } - ], - "statusCode": 200 - } - ] -] diff --git a/test/__tests__/data/pinterest_tag_router_error_input.json b/test/__tests__/data/pinterest_tag_router_error_input.json deleted file mode 100644 index ce188c7335..0000000000 --- a/test/__tests__/data/pinterest_tag_router_error_input.json +++ /dev/null @@ -1,124 +0,0 @@ -[ - { - "message": { - "type": "Identify", - "event": "User Signup", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 5, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "Watch Video" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } -] diff --git a/test/__tests__/data/pinterest_tag_router_error_output.json b/test/__tests__/data/pinterest_tag_router_error_output.json deleted file mode 100644 index 4cd4e6966c..0000000000 --- a/test/__tests__/data/pinterest_tag_router_error_output.json +++ /dev/null @@ -1,59 +0,0 @@ -[ - { - "metadata": [ - { - "jobId": 5, - "userId": "u1" - } - ], - "batched": false, - "statusCode": 400, - "error": "message type identify is not supported", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "Watch Video" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } -] diff --git a/test/__tests__/data/pinterest_tag_router_input.json b/test/__tests__/data/pinterest_tag_router_input.json deleted file mode 100644 index c1639382d7..0000000000 --- a/test/__tests__/data/pinterest_tag_router_input.json +++ /dev/null @@ -1,1212 +0,0 @@ -[ - [ - { - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 1, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Order completed", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 2, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "product added", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "product_id": "123", - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 3, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Product List Filtered", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 4, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "Identify", - "event": "User Signup", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 5, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "User Created", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 6, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "version": "1", - "statusCode": 200, - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "WatchVideo", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["bdfdee6414a89d72bfbf5ee90b1f85924467bae1e3980d83c2cd348dc31d5819"], - "fn": ["ee5db3fe0253b651aca3676692e0c59b25909304f5c51d223a02a215d104144b"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": { - "jobId": 7, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } - ], - [ - { - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 8, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Order completed", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 9, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Test", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "brand": "testBrand", - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "brand": "testBrand", - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "metadata": { - "jobId": 10, - "userId": "u1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } - ] -] diff --git a/test/__tests__/data/pinterest_tag_router_output.json b/test/__tests__/data/pinterest_tag_router_output.json deleted file mode 100644 index a54d328978..0000000000 --- a/test/__tests__/data/pinterest_tag_router_output.json +++ /dev/null @@ -1,735 +0,0 @@ -[ - [ - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "data": [ - { - "event_name": "watch_video", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "opt_out_type": "LDP", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "signup", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "opt_out_type": "LDP", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "checkout", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "add_to_cart", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 2, - "content_ids": ["123"], - "contents": [ - { - "quantity": 2, - "item_price": "25" - } - ] - } - }, - { - "event_name": "search", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "signup", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "action_source": "web", - "event_name": "WatchVideo", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["bdfdee6414a89d72bfbf5ee90b1f85924467bae1e3980d83c2cd348dc31d5819"], - "fn": ["ee5db3fe0253b651aca3676692e0c59b25909304f5c51d223a02a215d104144b"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - } - ] - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 1, - "userId": "u1" - }, - { - "jobId": 2, - "userId": "u1" - }, - { - "jobId": 3, - "userId": "u1" - }, - { - "jobId": 4, - "userId": "u1" - }, - { - "jobId": 6, - "userId": "u1" - }, - { - "jobId": 7, - "userId": "u1" - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "metadata": [ - { - "jobId": 5, - "userId": "u1" - } - ], - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "batched": false, - "statusCode": 400, - "error": "message type identify is not supported", - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } - ], - [ - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer conversionToken123" - }, - "params": {}, - "body": { - "JSON": { - "data": [ - { - "event_name": "watch_video", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "opt_out_type": "LDP", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "signup", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "opt_out_type": "LDP", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "checkout", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - }, - { - "event_name": "custom", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": [ - "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090" - ], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "id": "507f1f77bcf86cd799439011", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Monopoly: 3rd Edition", - "quantity": 1, - "item_price": "19" - }, - { - "id": "505bd76785ebb509fc183733", - "item_brand": "testBrand", - "item_category": "Games", - "item_name": "Uno Card Game", - "quantity": 2, - "item_price": "3" - } - ] - } - } - ] - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 8, - "userId": "u1" - }, - { - "jobId": 9, - "userId": "u1" - }, - { - "jobId": 10, - "userId": "u1" - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - }, - { - "from": "ABC Searched", - "to": "Signup" - }, - { - "from": "User Signup", - "to": "Signup" - }, - { - "from": "User Created", - "to": "Signup" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } - ] -] diff --git a/test/__tests__/data/pinterest_tag_step_input.json b/test/__tests__/data/pinterest_tag_step_input.json deleted file mode 100644 index 7b4e507120..0000000000 --- a/test/__tests__/data/pinterest_tag_step_input.json +++ /dev/null @@ -1,2476 +0,0 @@ -[ - { - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "gender": "non-binary", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Order completed", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "product added", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "product_id": "123", - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Product List Filtered", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "Product List Filtered", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "429047995", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "group", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "enhancedMatch": true, - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "ABC Searched", - "channel": "abc", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "custom event", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "numOfItems": 2, - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123", - "adTrackingEnabled": true - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "ip": "127.0.0.0", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "adTrackingEnabled": false - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "requestIP": "127.0.0.0", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "phone": "Hashed phone", - "gender": "Hashed Gender", - "dob": "Hashed DB", - "lastname": "Hashed Lastname", - "firstName": "Hashed FirstName", - "address": { - "city": "Hashed City", - "state": "Hashed State", - "zip": "Hashed Zip", - "country": "Hashed country" - } - }, - "device": { - "adTrackingEnabled": false, - "advertisingId": "Hashed maids" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": false, - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "page", - "name": "ApplicationLoaded", - "category": "test category", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "requestIP": "127.0.0.0", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "phone": ["Hashed phone", "Hashed phone1"], - "gender": ["Hashed Gender", "Hashed Gender1"], - "dob": ["Hashed DB", "Hashed DB1"], - "lastname": ["Hashed Lastname", "Hashed Lastname1"], - "firstName": ["Hashed FirstName", "Hashed FirstName1"], - "address": { - "city": ["Hashed City", "Hashed City1"], - "state": ["Hashed State", "Hashed State1"], - "zip": ["Hashed Zip", "Hashed Zip1"], - "country": ["Hashed country", "Hashed country1"] - } - }, - "device": { - "adTrackingEnabled": false, - "advertisingId": "Hashed maids" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "path": "", - "referrer": "", - "search": "", - "title": "", - "url": "" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": false, - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "name": "Test Tool", - "type": "page", - "sentAt": "2023-02-01T00:00:00.379Z", - "userId": "", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "version": "2.22.3", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "https://www.abc.com/s598907", - "path": "/test-path/s598907", - "title": "Test Tool + Reviews | Rudderstack", - "search": "", - "tab_url": "https://www.abc.com/s598907", - "referrer": "$direct", - "initial_referrer": "$direct", - "referring_domain": "", - "initial_referring_domain": "" - }, - "locale": "en-US", - "screen": { - "width": 1024, - "height": 1024, - "density": 1, - "innerWidth": 1024, - "innerHeight": 1024 - }, - "traits": {}, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "2.22.3" - }, - "campaign": {}, - "doNotSell": false, - "sessionId": 1675209600203, - "userAgent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/109.0.5414.101 Safari/537.36", - "gaClientId": { - "integrations": { - "Google Ads": { - "gclid": "" - }, - "Google Analytics": { - "clientId": "1518934611.1234569600" - } - } - }, - "sessionStart": true - }, - "rudderId": "7291a10f-e7dd-49f9-94ce-0154f53897y6", - "messageId": "1c77a616-13a7-4a2e-a8e7-e1a0971897y6", - "timestamp": "2023-02-01T12:47:30.030Z", - "properties": { - "sku": "45790-32", - "url": "https://www.abc.com/23rty", - "name": "Test Tool", - "path": "/test-path/tool", - "email": "", - "title": "Test Tool + Reviews | Rudderstack", - "review": { - "reviewCount": 2, - "averageReview": 5, - "reviewContentID": ["238300132"] - }, - "search": "", - "tab_url": "https://www.abc/com", - "pageInfo": { - "pageId": "s592897", - "category": { - "pageType": "product", - "subCategory": "Dining & Kitchen Furniture", - "pageTemplate": "product detail grouper", - "primaryCategory": "Furniture" - }, - "brandType": "new brand" - }, - "referrer": "", - "subCategory": "Dining & Kitchen Furniture", - "primaryCategory": "Furniture", - "initial_referrer": "$direct", - "referring_domain": "", - "initial_referring_domain": "" - }, - "receivedAt": "2023-02-01T12:47:30.038Z", - "request_ip": "66.249.72.218", - "anonymousId": "a61c77a6-1613-474a-aee8-e7e1a0971047", - "integrations": { - "All": true - }, - "originalTimestamp": "2023-02-01T00:00:00.371Z" - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123478671210", - "sendingUnHashedData": false, - "enableDeduplication": false, - "eventsMapping": [ - { - "from": "Product Added", - "to": "AddToCart" - }, - { - "from": "Order Completed", - "to": "Checkout" - }, - { - "from": "Product Viewed", - "to": "PageVisit" - }, - { - "from": "Lead", - "to": "Lead" - }, - { - "from": "Signup", - "to": "Signup" - } - ], - "enhancedMatch": true - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "test", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "sku": "1234", - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "custom event", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "sku": "1234", - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - } - ] - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "custom event", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "advertiserId": "123456", - "appId": "429047995", - "sendingUnHashedData": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "enhancedMatch": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Track call with v5 Api version and send external_id toggle enabled", - "message": { - "type": "track", - "event": "ABC Searched", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendExternalId": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Custom event with v5 Api version", - "message": { - "type": "track", - "event": "random", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Custom event with v5 Api version, with unhashed User Data and the values are an array of strings", - "message": { - "type": "track", - "event": "random", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": ["abc@gmail.com", "def@gmail.com"], - "phone": ["+1234589947", "+1234589948"], - "ge": ["male", "male"], - "db": ["19950715", "19970615"], - "lastname": ["Rudderlabs", "Xu"], - "firstName": ["Test", "Alex"], - "address": { - "city": ["Kolkata", "Mumbai"], - "state": ["WB", "MH"], - "zip": ["700114", "700115"], - "country": ["IN", "IN"] - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "price": 25, - "quantity": 2, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "optOutType": "LDP", - "products": [ - { - "sku": "45790-32", - "url": "https://www.example.com/product/path", - "name": "Monopoly: 3rd Edition", - "price": 19, - "category": "Games", - "quantity": 1, - "image_url": "https:///www.example.com/product/path.jpg", - "product_id": "507f1f77bcf86cd799439011" - }, - { - "sku": "46493-32", - "name": "Uno Card Game", - "price": 3, - "category": "Games", - "quantity": 2, - "product_id": "505bd76785ebb509fc183733" - } - ], - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Ad Account Id check in V5", - "message": { - "type": "track", - "event": "random", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "description": "Conversion Token check in V5", - "message": { - "type": "track", - "event": "random", - "sentAt": "2020-08-14T05:30:30.118Z", - "channel": "web", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": true, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "message": { - "type": "track", - "event": "custom event", - "channel": "web", - "sentAt": "2020-08-14T05:30:30.118Z", - "context": { - "source": "test", - "userAgent": "chrome", - "traits": { - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "email": "abc@gmail.com", - "phone": "+1234589947", - "ge": "male", - "db": "19950715", - "lastname": "Rudderlabs", - "firstName": "Test", - "address": { - "city": "Kolkata", - "state": "WB", - "zip": "700114", - "country": "IN" - } - }, - "device": { - "advertisingId": "abc123" - }, - "library": { - "name": "rudder-sdk-ruby-sync", - "version": "1.0.6" - } - }, - "messageId": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "timestamp": "2020-08-14T05:30:30.118Z", - "properties": { - "tax": 2, - "total": 27.5, - "coupon": "hasbros", - "revenue": 48, - "currency": "USD", - "discount": 2.5, - "order_id": "50314b8e9bcf000000000000", - "requestIP": "123.0.0.0", - "shipping": 3, - "subtotal": 22.5, - "affiliation": "Google Store", - "checkout_id": "fksdjfsdjfisjf9sdfjsd9f" - }, - "anonymousId": "50be5c78-6c3f-4b60-be84-97805a316fb1", - "integrations": { - "All": true - } - }, - "destination": { - "ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq", - "Name": "PINTEREST_TAG", - "Config": { - "sendAsTestEvent": false, - "tagId": "123456789", - "apiVersion": "newApi", - "adAccountId": "accountId123", - "conversionToken": "conversionToken123", - "appId": "429047995", - "enhancedMatch": true, - "enableDeduplication": true, - "deduplicationKey": "messageId", - "sendingUnHashedData": true, - "sendAsCustomEvent": false, - "customProperties": [ - { - "properties": "presentclass" - }, - { - "properties": "presentgrade" - } - ], - "eventsMapping": [ - { - "from": "ABC Searched", - "to": "WatchVideo" - } - ] - }, - "Enabled": true, - "Transformations": [] - } - } -] diff --git a/test/__tests__/data/pinterest_tag_step_output.json b/test/__tests__/data/pinterest_tag_step_output.json deleted file mode 100644 index d364bf82dc..0000000000 --- a/test/__tests__/data/pinterest_tag_step_output.json +++ /dev/null @@ -1,911 +0,0 @@ -[ - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "watch_video", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome", - "ge": ["1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9"] - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "opt_out_type": "LDP", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "checkout", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "add_to_cart", - "action_source": "web", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 2, - "content_ids": ["123"], - "contents": [ - { - "quantity": 2, - "item_price": "25" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - { - "statusCode": 400, - "error": "Advertiser Id not found. Aborting" - }, - { - "statusCode": 400, - "error": "It is required at least one of em, hashed_maids or pair of client_ip_address and client_user_agent" - }, - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "watch_video", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "num_items": 2, - "order_id": "50314b8e9bcf000000000000", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - { - "statusCode": 400, - "error": "Advertiser Id not found. Aborting" - }, - { - "statusCode": 400, - "error": "message type group is not supported" - }, - { - "statusCode": 400, - "error": "Action source must be one of app_android, app_ios, web, offline" - }, - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "custom", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "action_source": "web", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "num_items": 2, - "order_id": "50314b8e9bcf000000000000", - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "action_source": "web", - "event_name": "page_visit", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "action_source": "web", - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "opt_out": false, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "action_source": "web", - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "opt_out": true, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "action_source": "web", - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "client_ip_address": "127.0.0.0", - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "action_source": "web", - "opt_out": true, - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "user_data": { - "ph": ["Hashed phone"], - "db": ["Hashed DB"], - "ln": ["Hashed Lastname"], - "fn": ["Hashed FirstName"], - "ct": ["Hashed City"], - "st": ["Hashed State"], - "zp": ["Hashed Zip"], - "country": ["Hashed country"], - "hashed_maids": ["Hashed maids"], - "ge": ["Hashed Gender"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_time": 1597383030, - "action_source": "web", - "opt_out": true, - "event_name": "view_category", - "app_id": "429047995", - "advertiser_id": "123456", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "user_data": { - "ph": ["Hashed phone", "Hashed phone1"], - "db": ["Hashed DB", "Hashed DB1"], - "ln": ["Hashed Lastname", "Hashed Lastname1"], - "fn": ["Hashed FirstName", "Hashed FirstName1"], - "ct": ["Hashed City", "Hashed City1"], - "st": ["Hashed State", "Hashed State1"], - "zp": ["Hashed Zip", "Hashed Zip1"], - "country": ["Hashed country", "Hashed country1"], - "hashed_maids": ["Hashed maids"], - "ge": ["Hashed Gender", "Hashed Gender1"], - "client_user_agent": "chrome" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "body": { - "JSON": { - "event_time": 1675255650, - "event_source_url": "https://www.abc.com/s598907", - "action_source": "web", - "app_name": "RudderLabs JavaScript SDK", - "app_version": "2.22.3", - "language": "en-US", - "event_id": "1c77a616-13a7-4a2e-a8e7-e1a0971897y6", - "advertiser_id": "123478671210", - "user_data": { - "client_ip_address": "66.249.72.218", - "client_user_agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/109.0.5414.101 Safari/537.36" - }, - "event_name": "page_visit" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "custom", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 0, - "content_ids": ["1234"], - "contents": [ - { - "quantity": 1, - "item_price": "undefined" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://ct.pinterest.com/events/v3", - "headers": { - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "event_name": "custom", - "event_time": 1597383030, - "action_source": "web", - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "advertiser_id": "123456", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "num_items": 1, - "content_ids": ["507f1f77bcf86cd799439011"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "body": { - "FORM": {}, - "JSON": { - "action_source": "web", - "advertiser_id": "123456", - "app_id": "429047995", - "custom_data": { - "contents": [{ "item_price": "undefined", "quantity": 1 }], - "currency": "USD", - "num_items": 0, - "order_id": "50314b8e9bcf000000000000", - "value": "27.5" - }, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "event_name": "custom event", - "event_time": 1597383030, - "user_data": { - "client_user_agent": "chrome", - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"] - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://ct.pinterest.com/events/v3", - "files": {}, - "headers": { "Content-Type": "application/json" }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer conversionToken123" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "watch_video", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome", - "external_id": ["3217d71a74c219d6e31e28267b313a7ceb6a2c032db1a091c9416b25b2ae2bc8"] - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "opt_out_type": "LDP", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer conversionToken123" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "custom", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": ["48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08"], - "ph": ["d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b"], - "ln": ["dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251"], - "fn": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"], - "ct": ["6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85"], - "st": ["3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd"], - "zp": ["1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c"], - "country": ["582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf"], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "opt_out_type": "LDP", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.pinterest.com/v5/ad_accounts/accountId123/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer conversionToken123" - }, - "params": {}, - "body": { - "JSON": { - "action_source": "web", - "event_name": "custom", - "event_time": 1597383030, - "event_id": "7208bbb6-2c4e-45bb-bf5b-ad426f3593e9", - "app_id": "429047995", - "user_data": { - "em": [ - "48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08", - "c392e50ebeca7bea4405e9c545023451ac56620031f81263f681269bde14218b" - ], - "ph": [ - "d164bbe036663cb5c96835e9ccc6501e9a521127ea62f6359744928ba932413b", - "22bdde2594851294f2a6f4c34af704e68b398b03129ea9ceb58f0ffe33f6db52" - ], - "ln": [ - "dcf000c2386fb76d22cefc0d118a8511bb75999019cd373df52044bccd1bd251", - "9c2f138690fca4890c3c4a6691610fbbbdf32091cc001f7355cfdf574baa52b9" - ], - "fn": [ - "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", - "4135aa9dc1b842a653dea846903ddb95bfb8c5a10c504a7fa16e10bc31d1fdf0" - ], - "ct": [ - "6689106ca7922c30b2fd2c175c85bc7fc2d52cc4941bdd7bb622c6cdc6284a85", - "d209bcc17778fd19fd2bc0c99a3868bf011da5162d3a75037a605768ebc276e2" - ], - "st": [ - "3b45022ab36728cdae12e709e945bba267c50ee8a91e6e4388539a8e03a3fdcd", - "1b0316ed1cfed044035c55363e02ccafab26d66b1c2746b94d17285f043324aa" - ], - "zp": [ - "1a4292e00780e18d00e76fde9850aee5344e939ba593333cd5e4b4aa2cd33b0c", - "4d6755aa1e85517191f06cc91448696c173e1195ae51f94a1670116ac7b5c47b" - ], - "country": [ - "582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf", - "582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf" - ], - "hashed_maids": ["6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090"], - "client_user_agent": "chrome" - }, - "custom_data": { - "currency": "USD", - "value": "27.5", - "order_id": "50314b8e9bcf000000000000", - "opt_out_type": "LDP", - "num_items": 3, - "content_ids": ["507f1f77bcf86cd799439011", "505bd76785ebb509fc183733"], - "contents": [ - { - "quantity": 1, - "item_price": "19" - }, - { - "quantity": 2, - "item_price": "3" - } - ] - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - { - "statusCode": 400, - "error": "Ad Account ID not found. Aborting" - }, - { - "statusCode": 400, - "error": "Conversion Token not found. Aborting" - }, - { - "statusCode": 400, - "error": "custom event is not mapped in UI. Make sure to map the event in UI or enable the 'send as custom event' setting" - } -] diff --git a/test/__tests__/pinterestConversion-cdk.test.ts b/test/__tests__/pinterestConversion-cdk.test.ts deleted file mode 100644 index 2afde331d5..0000000000 --- a/test/__tests__/pinterestConversion-cdk.test.ts +++ /dev/null @@ -1,135 +0,0 @@ -import fs from 'fs'; -import path from 'path'; -import { executeWorkflow, getWorkflowEngine, processCdkV2Workflow } from '../../src/cdk/v2/handler'; -import tags from '../../src/v0/util/tags'; -import logger from '../../src/logger'; - -const integration = 'pinterest_tag'; -const name = 'Pinterest Conversion API'; - -describe(`${name} Tests`, () => { - describe('Processor Tests', () => { - const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`), - { encoding: 'utf8' }, - ); - const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`), - { encoding: 'utf8' }, - ); - const inputData = JSON.parse(inputDataFile); - const expectedData = JSON.parse(outputDataFile); - inputData.forEach((input, index) => { - it(`${name} - payload: ${index}`, async () => { - const expected = expectedData[index]; - try { - const output = await processCdkV2Workflow( - integration, - input, - tags.FEATURES.PROCESSOR, - logger, - ); - expect(output).toEqual(expected); - } catch (error: any) { - expect(error.message).toEqual(expected.error); - } - }); - }); - }); - - describe('Processor Step Tests', () => { - const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`), - { encoding: 'utf8' }, - ); - const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`), - { encoding: 'utf8' }, - ); - const inputData = JSON.parse(inputDataFile); - const expectedData = JSON.parse(outputDataFile); - inputData.forEach((input, index) => { - it(`${name} - payload: ${index}`, async () => { - const expected = expectedData[index]; - try { - const output = await processCdkV2Workflow( - integration, - input, - tags.FEATURES.PROCESSOR, - logger, - ); - expect(output).toEqual(expected); - } catch (error: any) { - expect(error.message).toEqual(expected.error); - } - }); - }); - }); - - describe('Router Tests', () => { - // Router Test Data - const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`), - { encoding: 'utf8' }, - ); - - const inputRouterErrorDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_error_input.json`), - { encoding: 'utf8' }, - ); - - const outputRouterBatchDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_batch_output.json`), - { encoding: 'utf8' }, - ); - const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`), - { encoding: 'utf8' }, - ); - const outputRouterErrorDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_error_output.json`), - { encoding: 'utf8' }, - ); - const inputRouterData = JSON.parse(inputRouterDataFile); - const inputRouterErrorData = JSON.parse(inputRouterErrorDataFile); - - const expectedRouterBatchData = JSON.parse(outputRouterBatchDataFile); - const expectedRouterData = JSON.parse(outputRouterDataFile); - const expectedRouterErrorData = JSON.parse(outputRouterErrorDataFile); - - it('Payload with error input', async () => { - const output = await processCdkV2Workflow( - integration, - inputRouterErrorData, - tags.FEATURES.ROUTER, - logger, - ); - expect(output).toEqual(expectedRouterErrorData); - }); - - describe('Default Batch size', () => { - inputRouterData.forEach((input, index) => { - it(`Payload: ${index}`, async () => { - const output = await processCdkV2Workflow( - integration, - input, - tags.FEATURES.ROUTER, - logger, - ); - expect(output).toEqual(expectedRouterData[index]); - }); - }); - }); - describe('Batch size 3', () => { - inputRouterData.forEach((input, index) => { - it(`Payload: ${index}`, async () => { - const workflowEngine = await getWorkflowEngine(integration, tags.FEATURES.ROUTER, { - MAX_BATCH_SIZE: 3, - }); - const output = await executeWorkflow(workflowEngine, input); - expect(output).toEqual(expectedRouterBatchData[index]); - }); - }); - }); - }); -}); From c37207764109c93022f346af12e6fb1e976f62fd Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 18 Oct 2024 09:36:18 +0000 Subject: [PATCH 06/21] chore(release): 1.82.2 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a81c5b5fee..e4d972f67c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.82.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.82.1...v1.82.2) (2024-10-18) + + +### Bug Fixes + +* add missing fields to pinterest_tag mapping ([#3814](https://github.com/rudderlabs/rudder-transformer/issues/3814)) ([88c6175](https://github.com/rudderlabs/rudder-transformer/commit/88c6175391cf4575a57936aced898465ad78b55e)) + ### [1.82.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.82.0...v1.82.1) (2024-10-16) diff --git a/package-lock.json b/package-lock.json index a4295bd74c..00b17114dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.82.1", + "version": "1.82.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.82.1", + "version": "1.82.2", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "0.7.24", diff --git a/package.json b/package.json index 6b41457633..e6a5259bb3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.82.1", + "version": "1.82.2", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": { From fcd8d997fe815d61d21ffff235b0799e69b7ded9 Mon Sep 17 00:00:00 2001 From: shrouti1507 <60211312+shrouti1507@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:29:52 +0530 Subject: [PATCH 07/21] fix: not allowing empty string or null values for mandatory fields in zoho (#3800) --- src/cdk/v2/destinations/zoho/utils.js | 6 +++++- src/cdk/v2/destinations/zoho/utils.test.js | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/cdk/v2/destinations/zoho/utils.js b/src/cdk/v2/destinations/zoho/utils.js index 8b170d2b82..4f5c4e8620 100644 --- a/src/cdk/v2/destinations/zoho/utils.js +++ b/src/cdk/v2/destinations/zoho/utils.js @@ -3,6 +3,7 @@ const { getHashFromArray, isDefinedAndNotNull, ConfigurationError, + isDefinedAndNotNullAndNotEmpty, } = require('@rudderstack/integrations-lib'); const get = require('get-value'); const { getDestinationExternalIDInfoForRetl, isHttpStatusSuccess } = require('../../../../v0/util'); @@ -31,7 +32,10 @@ const deduceModuleInfo = (inputs, Config) => { function validatePresenceOfMandatoryProperties(objectName, object) { if (zohoConfig.MODULE_MANDATORY_FIELD_CONFIG.hasOwnProperty(objectName)) { const requiredFields = zohoConfig.MODULE_MANDATORY_FIELD_CONFIG[objectName]; - const missingFields = requiredFields.filter((field) => !object.hasOwnProperty(field)) || []; + const missingFields = + requiredFields.filter( + (field) => !object.hasOwnProperty(field) || !isDefinedAndNotNullAndNotEmpty(object[field]), + ) || []; return { status: missingFields.length > 0, missingField: missingFields }; } // No mandatory check performed for custom objects diff --git a/src/cdk/v2/destinations/zoho/utils.test.js b/src/cdk/v2/destinations/zoho/utils.test.js index 332a408695..5a11794ef5 100644 --- a/src/cdk/v2/destinations/zoho/utils.test.js +++ b/src/cdk/v2/destinations/zoho/utils.test.js @@ -130,6 +130,24 @@ describe('validatePresenceOfMandatoryProperties', () => { expect(() => validatePresenceOfMandatoryProperties(objectName, object)).not.toThrow(); }); + it('should return missing field if mandatory field contains empty string', () => { + const objectName = 'Leads'; + const object = { Last_Name: '' }; + + const result = validatePresenceOfMandatoryProperties(objectName, object); + + expect(result).toEqual({ missingField: ['Last_Name'], status: true }); + }); + + it('should return missing field if mandatory field contains empty null', () => { + const objectName = 'Leads'; + const object = { Last_Name: null }; + + const result = validatePresenceOfMandatoryProperties(objectName, object); + + expect(result).toEqual({ missingField: ['Last_Name'], status: true }); + }); + it('should not throw an error if the objectName is not in MODULE_MANDATORY_FIELD_CONFIG', () => { const objectName = 'CustomObject'; const object = { Some_Field: 'Some Value' }; From 427be71a91df8495f81b42d2b58aa490db439b23 Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:55:04 +0530 Subject: [PATCH 08/21] fix: update order_id in checkout events, messageId in pixel events (#3794) * fix: update order_id in checkout events, messageId in pixel events * chore: add shopifyDetails support * chore: add shopifyDetails for shopify server side events from pixel * chore: set id property in the webhook event as messageId for pixel serverside event * chore: update tests --- src/v1/sources/shopify/pixelTransform.js | 8 +- src/v1/sources/shopify/pixelUtils.js | 2 +- src/v1/sources/shopify/pixelUtils.test.js | 3 + .../pixelTestScenarios/CheckoutEventsTests.ts | 291 ++++++- .../pixelTestScenarios/CheckoutStepsTests.ts | 708 +++++++++++++++++- .../pixelTestScenarios/ProductEventsTests.ts | 301 +++++++- 6 files changed, 1298 insertions(+), 15 deletions(-) diff --git a/src/v1/sources/shopify/pixelTransform.js b/src/v1/sources/shopify/pixelTransform.js index 0ca64b4123..a19d431757 100644 --- a/src/v1/sources/shopify/pixelTransform.js +++ b/src/v1/sources/shopify/pixelTransform.js @@ -23,7 +23,11 @@ const NO_OPERATION_SUCCESS = { function processPixelEvent(inputEvent) { // eslint-disable-next-line @typescript-eslint/naming-convention - const { name, query_parameters, clientId, data } = inputEvent; + const { name, query_parameters, clientId, data, id } = inputEvent; + const shopifyDetails = { ...inputEvent }; + delete shopifyDetails.context; + delete shopifyDetails.query_parameters; + delete shopifyDetails.pixelEventLabel; const { checkout } = data ?? {}; const { order } = checkout ?? {}; const { customer } = order ?? {}; @@ -77,6 +81,8 @@ function processPixelEvent(inputEvent) { version: '2.0.0', }); message.setProperty('context.topic', name); + message.setProperty('context.shopifyDetails', shopifyDetails); + message.messageId = id; message = removeUndefinedAndNullValues(message); return message; } diff --git a/src/v1/sources/shopify/pixelUtils.js b/src/v1/sources/shopify/pixelUtils.js index 92197a558b..4c39e80549 100644 --- a/src/v1/sources/shopify/pixelUtils.js +++ b/src/v1/sources/shopify/pixelUtils.js @@ -138,7 +138,7 @@ const checkoutEventBuilder = (inputEvent) => { const properties = { products, - order_id: inputEvent.id, + order_id: inputEvent.data?.checkout?.order?.id, checkout_id: inputEvent?.data?.checkout?.token, total: inputEvent?.data?.checkout?.totalPrice?.amount, currency: inputEvent?.data?.checkout?.currencyCode, diff --git a/src/v1/sources/shopify/pixelUtils.test.js b/src/v1/sources/shopify/pixelUtils.test.js index cd544568cd..ed64862228 100644 --- a/src/v1/sources/shopify/pixelUtils.test.js +++ b/src/v1/sources/shopify/pixelUtils.test.js @@ -171,6 +171,9 @@ describe('utilV2.js', () => { { id: 'product123', name: 'Product 123' }, { id: 'product456', name: 'Product 456' }, ], + order: { + id: 'order123', + }, token: 'checkout123', totalPrice: { amount: 200 }, currencyCode: 'USD', diff --git a/test/integrations/sources/shopify/pixelTestScenarios/CheckoutEventsTests.ts b/test/integrations/sources/shopify/pixelTestScenarios/CheckoutEventsTests.ts index 1009fa2d04..3381223317 100644 --- a/test/integrations/sources/shopify/pixelTestScenarios/CheckoutEventsTests.ts +++ b/test/integrations/sources/shopify/pixelTestScenarios/CheckoutEventsTests.ts @@ -207,6 +207,132 @@ export const pixelCheckoutEventsTestScenarios = [ version: '2.0.0', }, topic: 'checkout_started', + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + checkout: { + attributes: [], + billingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + currencyCode: 'USD', + delivery: { + selectedDeliveryOptions: [], + }, + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: '', + lineItems: [ + { + discountAllocations: [], + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + id: '41327143321713', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + vendor: 'Hydrogen Vendor', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + }, + ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + handle: 'us', + id: 'gid://shopify/Market/23505895537', + }, + }, + order: { + customer: { + id: null, + isFirstOrder: null, + }, + id: null, + }, + phone: '', + shippingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + token: '5f7028e0bd5225c17b24bdaa0c09f914', + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + transactions: [], + }, + }, + id: 'sh-f77a78f1-C1D8-4ED4-9C9B-0D352CF6F3BF', + name: 'checkout_started', + timestamp: '2024-09-15T20:57:59.674Z', + type: 'standard', + }, }, integrations: { SHOPIFY: true, @@ -238,7 +364,7 @@ export const pixelCheckoutEventsTestScenarios = [ brand: 'Hydrogen Vendor', }, ], - order_id: 'sh-f77a78f1-C1D8-4ED4-9C9B-0D352CF6F3BF', + order_id: null, checkout_id: '5f7028e0bd5225c17b24bdaa0c09f914', total: 2759.8, currency: 'USD', @@ -249,6 +375,7 @@ export const pixelCheckoutEventsTestScenarios = [ tax: 0, }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f77a78f1-C1D8-4ED4-9C9B-0D352CF6F3BF', }, ], }, @@ -495,6 +622,165 @@ export const pixelCheckoutEventsTestScenarios = [ version: '2.0.0', }, topic: 'checkout_completed', + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + checkout: { + attributes: [], + billingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + currencyCode: 'USD', + delivery: { + selectedDeliveryOptions: [], + }, + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: '', + lineItems: [ + { + discountAllocations: [], + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + id: '41327143321713', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + vendor: 'Hydrogen Vendor', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + }, + { + discountAllocations: [], + finalLinePrice: { + amount: 1259.9, + currencyCode: 'USD', + }, + id: '41327143157873', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Multi-managed Snowboard', + variant: { + id: '41327143157873', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + vendor: 'Multi-managed Vendor', + }, + sku: 'sku-managed-1', + title: null, + untranslatedTitle: null, + }, + }, + ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + handle: 'us', + id: 'gid://shopify/Market/23505895537', + }, + }, + order: { + customer: { + id: null, + isFirstOrder: null, + }, + id: null, + }, + phone: '', + shippingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + token: '5f7028e0bd5225c17b24bdaa0c09f914', + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + transactions: [], + }, + }, + id: 'sh-f77a78f1-C1D8-4ED4-9C9B-0D352CF6F3BF', + name: 'checkout_completed', + timestamp: '2024-09-15T20:57:59.674Z', + type: 'standard', + }, }, integrations: { SHOPIFY: true, @@ -548,7 +834,7 @@ export const pixelCheckoutEventsTestScenarios = [ brand: 'Multi-managed Vendor', }, ], - order_id: 'sh-f77a78f1-C1D8-4ED4-9C9B-0D352CF6F3BF', + order_id: null, checkout_id: '5f7028e0bd5225c17b24bdaa0c09f914', total: 2759.8, currency: 'USD', @@ -559,6 +845,7 @@ export const pixelCheckoutEventsTestScenarios = [ tax: 0, }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f77a78f1-C1D8-4ED4-9C9B-0D352CF6F3BF', }, ], }, diff --git a/test/integrations/sources/shopify/pixelTestScenarios/CheckoutStepsTests.ts b/test/integrations/sources/shopify/pixelTestScenarios/CheckoutStepsTests.ts index 9d845c1dde..38f682ac6d 100644 --- a/test/integrations/sources/shopify/pixelTestScenarios/CheckoutStepsTests.ts +++ b/test/integrations/sources/shopify/pixelTestScenarios/CheckoutStepsTests.ts @@ -206,7 +206,185 @@ export const pixelCheckoutStepsScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'checkout_address_info_submitted' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + checkout: { + attributes: [], + billingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + currencyCode: 'USD', + delivery: { + selectedDeliveryOptions: [ + { + cost: { + amount: 0, + currencyCode: 'USD', + }, + costAfterDiscounts: { + amount: 0, + currencyCode: 'USD', + }, + description: null, + handle: + '5f7028e0bd5225c17b24bdaa0c09f914-8388085074acab7e91de633521be86f0', + title: 'Economy', + type: 'shipping', + }, + ], + }, + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: 'test-user@sampleemail.com', + lineItems: [ + { + discountAllocations: [], + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + id: '41327143321713', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + vendor: 'Hydrogen Vendor', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + }, + { + discountAllocations: [], + finalLinePrice: { + amount: 1259.9, + currencyCode: 'USD', + }, + id: '41327143157873', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Multi-managed Snowboard', + variant: { + id: '41327143157873', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + vendor: 'Multi-managed Vendor', + }, + sku: 'sku-managed-1', + title: null, + untranslatedTitle: null, + }, + }, + ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + handle: 'us', + id: 'gid://shopify/Market/23505895537', + }, + }, + order: { + customer: { + id: null, + isFirstOrder: null, + }, + id: null, + }, + phone: '', + shippingAddress: { + address1: 'Queens Center', + address2: null, + city: 'Elmhurst', + country: 'US', + countryCode: 'US', + firstName: 'test', + lastName: 'user', + phone: null, + province: 'NY', + provinceCode: 'NY', + zip: '11373', + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + token: '5f7028e0bd5225c17b24bdaa0c09f914', + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + transactions: [], + }, + }, + id: 'sh-f7d2154d-7525-47A4-87FA-E54D2322E129', + name: 'checkout_address_info_submitted', + timestamp: '2024-09-15T21:45:50.523Z', + type: 'standard', + }, + topic: 'checkout_address_info_submitted', + }, integrations: { SHOPIFY: true, }, @@ -379,6 +557,7 @@ export const pixelCheckoutStepsScenarios = [ transactions: [], }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f7d2154d-7525-47A4-87FA-E54D2322E129', }, ], }, @@ -577,7 +756,169 @@ export const pixelCheckoutStepsScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'checkout_contact_info_submitted' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + checkout: { + attributes: [], + billingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + currencyCode: 'USD', + delivery: { + selectedDeliveryOptions: [], + }, + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: 'test-user@sampleemail.com', + lineItems: [ + { + discountAllocations: [], + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + id: '41327143321713', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + vendor: 'Hydrogen Vendor', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + }, + { + discountAllocations: [], + finalLinePrice: { + amount: 1259.9, + currencyCode: 'USD', + }, + id: '41327143157873', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Multi-managed Snowboard', + variant: { + id: '41327143157873', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + vendor: 'Multi-managed Vendor', + }, + sku: 'sku-managed-1', + title: null, + untranslatedTitle: null, + }, + }, + ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + handle: 'us', + id: 'gid://shopify/Market/23505895537', + }, + }, + order: { + customer: { + id: null, + isFirstOrder: null, + }, + id: null, + }, + phone: '', + shippingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + token: '5f7028e0bd5225c17b24bdaa0c09f914', + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + transactions: [], + }, + }, + id: 'sh-f7c8416f-1D35-4304-EF29-78666678C4E9', + name: 'checkout_contact_info_submitted', + timestamp: '2024-09-15T21:40:28.498Z', + type: 'standard', + }, + topic: 'checkout_contact_info_submitted', + }, integrations: { SHOPIFY: true, }, @@ -734,6 +1075,7 @@ export const pixelCheckoutStepsScenarios = [ transactions: [], }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f7c8416f-1D35-4304-EF29-78666678C4E9', }, ], }, @@ -947,7 +1289,185 @@ export const pixelCheckoutStepsScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'checkout_shipping_info_submitted' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + checkout: { + attributes: [], + billingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + currencyCode: 'USD', + delivery: { + selectedDeliveryOptions: [ + { + cost: { + amount: 0, + currencyCode: 'USD', + }, + costAfterDiscounts: { + amount: 0, + currencyCode: 'USD', + }, + description: null, + handle: + '5f7028e0bd5225c17b24bdaa0c09f914-8388085074acab7e91de633521be86f0', + title: 'Economy', + type: 'shipping', + }, + ], + }, + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: 'test-user@sampleemail.com', + lineItems: [ + { + discountAllocations: [], + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + id: '41327143321713', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + vendor: 'Hydrogen Vendor', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + }, + { + discountAllocations: [], + finalLinePrice: { + amount: 1259.9, + currencyCode: 'USD', + }, + id: '41327143157873', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Multi-managed Snowboard', + variant: { + id: '41327143157873', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + vendor: 'Multi-managed Vendor', + }, + sku: 'sku-managed-1', + title: null, + untranslatedTitle: null, + }, + }, + ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + handle: 'us', + id: 'gid://shopify/Market/23505895537', + }, + }, + order: { + customer: { + id: null, + isFirstOrder: null, + }, + id: null, + }, + phone: '', + shippingAddress: { + address1: 'Queens Center', + address2: null, + city: 'Elmhurst', + country: 'US', + countryCode: 'US', + firstName: 'test', + lastName: 'user', + phone: null, + province: 'NY', + provinceCode: 'NY', + zip: '11373', + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + token: '5f7028e0bd5225c17b24bdaa0c09f914', + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + transactions: [], + }, + }, + id: 'sh-f7d5618e-404A-4E6D-4662-599A4BCC9E7C', + name: 'checkout_shipping_info_submitted', + timestamp: '2024-09-15T21:47:38.576Z', + type: 'standard', + }, + topic: 'checkout_shipping_info_submitted', + }, integrations: { SHOPIFY: true, }, @@ -1120,6 +1640,7 @@ export const pixelCheckoutStepsScenarios = [ transactions: [], }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f7d5618e-404A-4E6D-4662-599A4BCC9E7C', }, ], }, @@ -1333,7 +1854,185 @@ export const pixelCheckoutStepsScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'payment_info_submitted' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + checkout: { + attributes: [], + billingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + currencyCode: 'USD', + delivery: { + selectedDeliveryOptions: [ + { + cost: { + amount: 0, + currencyCode: 'USD', + }, + costAfterDiscounts: { + amount: 0, + currencyCode: 'USD', + }, + description: null, + handle: + '5f7028e0bd5225c17b24bdaa0c09f914-8388085074acab7e91de633521be86f0', + title: 'Economy', + type: 'shipping', + }, + ], + }, + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: 'test-user@sampleemail.com', + lineItems: [ + { + discountAllocations: [], + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + id: '41327143321713', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + vendor: 'Hydrogen Vendor', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + }, + { + discountAllocations: [], + finalLinePrice: { + amount: 1259.9, + currencyCode: 'USD', + }, + id: '41327143157873', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Multi-managed Snowboard', + variant: { + id: '41327143157873', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + vendor: 'Multi-managed Vendor', + }, + sku: 'sku-managed-1', + title: null, + untranslatedTitle: null, + }, + }, + ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + handle: 'us', + id: 'gid://shopify/Market/23505895537', + }, + }, + order: { + customer: { + id: null, + isFirstOrder: null, + }, + id: null, + }, + phone: '', + shippingAddress: { + address1: 'Queens Center', + address2: null, + city: 'Elmhurst', + country: 'US', + countryCode: 'US', + firstName: 'test', + lastName: 'user', + phone: null, + province: 'NY', + provinceCode: 'NY', + zip: '11373', + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + token: '5f7028e0bd5225c17b24bdaa0c09f914', + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + transactions: [], + }, + }, + id: 'sh-f7d843ea-ED11-4A12-F32F-C5A45BED0413', + name: 'payment_info_submitted', + timestamp: '2024-09-15T21:49:13.092Z', + type: 'standard', + }, + topic: 'payment_info_submitted', + }, integrations: { SHOPIFY: true, }, @@ -1506,6 +2205,7 @@ export const pixelCheckoutStepsScenarios = [ transactions: [], }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f7d843ea-ED11-4A12-F32F-C5A45BED0413', }, ], }, diff --git a/test/integrations/sources/shopify/pixelTestScenarios/ProductEventsTests.ts b/test/integrations/sources/shopify/pixelTestScenarios/ProductEventsTests.ts index 0b8f8c3c1a..b293bd46f9 100644 --- a/test/integrations/sources/shopify/pixelTestScenarios/ProductEventsTests.ts +++ b/test/integrations/sources/shopify/pixelTestScenarios/ProductEventsTests.ts @@ -41,7 +41,18 @@ export const pixelEventsTestScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'page_viewed' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: {}, + id: 'sh-f6b6f548-5FEF-4DAE-9CAB-39EE6F94E09B', + name: 'page_viewed', + timestamp: '2024-09-15T17:24:30.373Z', + type: 'standard', + }, + topic: 'page_viewed', + }, integrations: { SHOPIFY: true, }, @@ -49,6 +60,7 @@ export const pixelEventsTestScenarios = [ type: 'page', properties: {}, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f6b6f548-5FEF-4DAE-9CAB-39EE6F94E09B', }, ], }, @@ -118,7 +130,40 @@ export const pixelEventsTestScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'product_viewed' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + productVariant: { + id: '41327143321713', + image: { + src: '//store.myshopify.com/cdn/shop/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + vendor: 'Hydrogen Vendor', + }, + sku: '', + title: 'Default Title', + untranslatedTitle: 'Default Title', + }, + }, + id: 'sh-f6c07b5a-D20A-4E5F-812E-337299B56C34', + name: 'product_viewed', + timestamp: '2024-09-15T17:34:54.889Z', + type: 'standard', + }, + topic: 'product_viewed', + }, integrations: { SHOPIFY: true, }, @@ -156,6 +201,7 @@ export const pixelEventsTestScenarios = [ name: 'The Collection Snowboard: Liquid', }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f6c07b5a-D20A-4E5F-812E-337299B56C34', }, ], }, @@ -247,7 +293,62 @@ export const pixelEventsTestScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'cart_viewed' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + cart: { + attributes: [], + cost: { + totalAmount: { + amount: 1259.9, + currencyCode: 'USD', + }, + }, + id: 'Z2NwLXVzLWVhc3QxOjAxSjY5OVpIRURQNERFMDBKUTVaRkI4UzdU', + lines: [ + { + cost: { + totalAmount: { + amount: 1259.9, + currencyCode: 'USD', + }, + }, + merchandise: { + id: '41327143157873', + image: { + src: '//store.myshopify.com/cdn/shop/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + vendor: 'Multi-managed Vendor', + }, + sku: 'sku-managed-1', + title: 'Default Title', + untranslatedTitle: 'Default Title', + }, + quantity: 2, + }, + ], + totalQuantity: 2, + }, + }, + id: 'shu-f6eecef1-4132-459F-CDB5-681DA3DD61CD', + name: 'cart_viewed', + timestamp: '2024-09-15T18:25:30.125Z', + type: 'standard', + }, + topic: 'cart_viewed', + }, integrations: { SHOPIFY: true, }, @@ -300,6 +401,7 @@ export const pixelEventsTestScenarios = [ total: 1259.9, }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'shu-f6eecef1-4132-459F-CDB5-681DA3DD61CD', }, ], }, @@ -417,7 +519,88 @@ export const pixelEventsTestScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'collection_viewed' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + collection: { + id: '', + productVariants: [ + { + id: '41327142895729', + image: { + src: '//store.myshopify.com/cdn/shop/files/gift_card.png?v=1724736596', + }, + price: { + amount: 10, + currencyCode: 'USD', + }, + product: { + id: '7234590605425', + title: 'Gift Card', + type: 'giftcard', + untranslatedTitle: 'Gift Card', + url: '/products/gift-card', + vendor: 'Snowboard Vendor', + }, + sku: '', + title: '$10', + untranslatedTitle: '$10', + }, + { + id: '41327143223409', + image: { + src: '//store.myshopify.com/cdn/shop/files/snowboard_wax.png?v=1724736599', + }, + price: { + amount: 24.95, + currencyCode: 'USD', + }, + product: { + id: '7234590802033', + title: 'Selling Plans Ski Wax', + type: 'accessories', + untranslatedTitle: 'Selling Plans Ski Wax', + url: '/products/selling-plans-ski-wax', + vendor: 'pixel-testing-rs', + }, + sku: '', + title: 'Selling Plans Ski Wax', + untranslatedTitle: 'Selling Plans Ski Wax', + }, + { + id: '41327143125105', + image: { + src: '//store.myshopify.com/cdn/shop/files/Main_b9e0da7f-db89-4d41-83f0-7f417b02831d.jpg?v=1724736597', + }, + price: { + amount: 2629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590703729', + title: 'The 3p Fulfilled Snowboard', + type: 'snowboard', + untranslatedTitle: 'The 3p Fulfilled Snowboard', + url: '/products/the-3p-fulfilled-snowboard', + vendor: 'pixel-testing-rs', + }, + sku: 'sku-hosted-1', + title: 'Default Title', + untranslatedTitle: 'Default Title', + }, + ], + title: 'Products', + }, + }, + id: 'sh-f6f0c6be-43F8-47D2-5F94-C22AD5ED3E79', + name: 'collection_viewed', + timestamp: '2024-09-15T18:27:39.197Z', + type: 'standard', + }, + topic: 'collection_viewed', + }, integrations: { SHOPIFY: true, }, @@ -508,6 +691,7 @@ export const pixelEventsTestScenarios = [ ], }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f6f0c6be-43F8-47D2-5F94-C22AD5ED3E79', }, ], }, @@ -586,7 +770,49 @@ export const pixelEventsTestScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'product_added_to_cart' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + cartLine: { + cost: { + totalAmount: { + amount: 749.95, + currencyCode: 'USD', + }, + }, + merchandise: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid?variant=41327143321713', + vendor: 'Hydrogen Vendor', + }, + sku: '', + title: null, + untranslatedTitle: null, + }, + quantity: 1, + }, + }, + id: 'sh-f6f828db-F77B-43E8-96C4-1D51DACD52A3', + name: 'product_added_to_cart', + timestamp: '2024-09-15T18:34:42.625Z', + type: 'standard', + }, + topic: 'product_added_to_cart', + }, integrations: { SHOPIFY: true, }, @@ -636,6 +862,7 @@ export const pixelEventsTestScenarios = [ quantity: 1, }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f6f828db-F77B-43E8-96C4-1D51DACD52A3', }, ], }, @@ -714,7 +941,49 @@ export const pixelEventsTestScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'product_removed_from_cart' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + cartLine: { + cost: { + totalAmount: { + amount: 749.95, + currencyCode: 'USD', + }, + }, + merchandise: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid?variant=41327143321713', + vendor: 'Hydrogen Vendor', + }, + sku: '', + title: null, + untranslatedTitle: null, + }, + quantity: 1, + }, + }, + id: 'shu-f778d1eb-9B83-4832-9DC0-5C3B33A809F0', + name: 'product_removed_from_cart', + timestamp: '2024-09-15T20:56:00.125Z', + type: 'standard', + }, + topic: 'product_removed_from_cart', + }, integrations: { SHOPIFY: true, }, @@ -764,6 +1033,7 @@ export const pixelEventsTestScenarios = [ quantity: 1, }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'shu-f778d1eb-9B83-4832-9DC0-5C3B33A809F0', }, ], }, @@ -816,7 +1086,23 @@ export const pixelEventsTestScenarios = [ output: { batch: [ { - context: { ...responseDummyContext, topic: 'search_submitted' }, + context: { + ...responseDummyContext, + shopifyDetails: { + clientId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + data: { + searchResult: { + productVariants: [], + query: 'skate', + }, + }, + id: 'sh-f7d599b4-D80F-4D05-C4CE-B980D5444596', + name: 'search_submitted', + timestamp: '2024-09-15T22:37:35.869Z', + type: 'standard', + }, + topic: 'search_submitted', + }, integrations: { SHOPIFY: true, }, @@ -826,6 +1112,7 @@ export const pixelEventsTestScenarios = [ query: 'skate', }, anonymousId: 'c7b3f99b-4d34-463b-835f-c879482a7750', + messageId: 'sh-f7d599b4-D80F-4D05-C4CE-B980D5444596', }, ], }, From 91f8ca76ad989af2606f915289cfcc0ada3fbaf0 Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:32:36 +0530 Subject: [PATCH 09/21] chore: add network handler file for ga4 v2 in v0 implementation flow (#3822) * chore: add network handler file for ga4 v2 in v0 implementation flow * chore: add tests --- src/v0/destinations/ga4_v2/networkHandler.js | 1 + src/v1/destinations/ga4_v2/networkHandler.ts | 3 --- test/integrations/destinations/ga4_v2/dataDelivery/business.ts | 1 + test/integrations/destinations/ga4_v2/dataDelivery/data.ts | 1 + 4 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 src/v0/destinations/ga4_v2/networkHandler.js delete mode 100644 src/v1/destinations/ga4_v2/networkHandler.ts create mode 100644 test/integrations/destinations/ga4_v2/dataDelivery/business.ts create mode 100644 test/integrations/destinations/ga4_v2/dataDelivery/data.ts diff --git a/src/v0/destinations/ga4_v2/networkHandler.js b/src/v0/destinations/ga4_v2/networkHandler.js new file mode 100644 index 0000000000..3e25b43b38 --- /dev/null +++ b/src/v0/destinations/ga4_v2/networkHandler.js @@ -0,0 +1 @@ +export { networkHandler } from '../ga4/networkHandler'; diff --git a/src/v1/destinations/ga4_v2/networkHandler.ts b/src/v1/destinations/ga4_v2/networkHandler.ts deleted file mode 100644 index aece0411c1..0000000000 --- a/src/v1/destinations/ga4_v2/networkHandler.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { networkHandler } from '../../../v0/destinations/ga4/networkHandler'; - -module.exports = { networkHandler }; diff --git a/test/integrations/destinations/ga4_v2/dataDelivery/business.ts b/test/integrations/destinations/ga4_v2/dataDelivery/business.ts new file mode 100644 index 0000000000..4cfa56f498 --- /dev/null +++ b/test/integrations/destinations/ga4_v2/dataDelivery/business.ts @@ -0,0 +1 @@ +export { testScenariosForV0API, testScenariosForV1API } from '../../ga4/dataDelivery/business'; diff --git a/test/integrations/destinations/ga4_v2/dataDelivery/data.ts b/test/integrations/destinations/ga4_v2/dataDelivery/data.ts new file mode 100644 index 0000000000..1790a67cdc --- /dev/null +++ b/test/integrations/destinations/ga4_v2/dataDelivery/data.ts @@ -0,0 +1 @@ +export { data } from '../../ga4/dataDelivery/data'; From 21b1039c26067b4896a15adf8b10a044e69cb495 Mon Sep 17 00:00:00 2001 From: Akash Chetty Date: Tue, 22 Oct 2024 11:19:01 +0530 Subject: [PATCH 10/21] feat: snowpipe streaming (#3740) --- .../snowpipe_streaming/transform.js | 1 + test/__tests__/warehouse.test.js | 239 +++++++++--------- 2 files changed, 125 insertions(+), 115 deletions(-) create mode 100644 src/v0/destinations/snowpipe_streaming/transform.js diff --git a/src/v0/destinations/snowpipe_streaming/transform.js b/src/v0/destinations/snowpipe_streaming/transform.js new file mode 100644 index 0000000000..3b0a6e1a93 --- /dev/null +++ b/src/v0/destinations/snowpipe_streaming/transform.js @@ -0,0 +1 @@ +module.exports = require('../snowflake/transform'); diff --git a/test/__tests__/warehouse.test.js b/test/__tests__/warehouse.test.js index 6bde2e9eb2..7fdecbd7cf 100644 --- a/test/__tests__/warehouse.test.js +++ b/test/__tests__/warehouse.test.js @@ -29,6 +29,7 @@ const integrations = [ "postgres", "clickhouse", "snowflake", + "snowpipe_streaming", "mssql", "azure_synapse", "deltalake", @@ -36,6 +37,14 @@ const integrations = [ "s3_datalake", "gcs_datalake", ]; + +const integration = (index ) => { + const it = integrations[index]; + if (it === "snowflake" || it === "snowpipe_streaming") { + return "snowflake"; + } + return it; +} const transformers = integrations.map(integration => require(`../../src/${version}/destinations/${integration}/transform`) ); @@ -65,7 +74,7 @@ describe("event types", () => { const i = input("track"); transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toMatchObject(output("track", integrations[index])); + expect(received).toMatchObject(output("track", integration(index))); }); }); }); @@ -76,7 +85,7 @@ describe("event types", () => { // also verfies priority order between traits and context.traits transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toMatchObject(output("identify", integrations[index])); + expect(received).toMatchObject(output("identify", integration(index))); }); }); }); @@ -86,7 +95,7 @@ describe("event types", () => { const i = input("page"); transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toMatchObject(output("page", integrations[index])); + expect(received).toMatchObject(output("page", integration(index))); }); }); it("should take name from properties if top-level name is missing", () => { @@ -95,7 +104,7 @@ describe("event types", () => { delete i.message.name; transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toMatchObject(output("page", integrations[index])); + expect(received).toMatchObject(output("page", integration(index))); }); }); }); @@ -105,7 +114,7 @@ describe("event types", () => { const i = input("screen"); transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toMatchObject(output("screen", integrations[index])); + expect(received).toMatchObject(output("screen", integration(index))); }); }); it("should take name from properties if top-level name is missing", () => { @@ -114,7 +123,7 @@ describe("event types", () => { delete i.message.name; transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toMatchObject(output("screen", integrations[index])); + expect(received).toMatchObject(output("screen", integration(index))); }); }); }); @@ -124,7 +133,7 @@ describe("event types", () => { const i = input("alias"); transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toMatchObject(output("alias", integrations[index])); + expect(received).toMatchObject(output("alias", integration(index))); }); }); }); @@ -134,7 +143,7 @@ describe("event types", () => { const i = input("extract"); transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toMatchObject(output("extract", integrations[index])); + expect(received).toMatchObject(output("extract", integration(index))); }); }); }); @@ -153,7 +162,7 @@ describe("column & table names", () => { const received = transformer.process(i); const provider = - integrations[index] === "snowflake" ? "snowflake" : "default"; + (integration(index) === "snowflake" || integration(index) == "snowpipe_streaming") ? "snowflake" : "default"; expect(received[1].metadata.columns).toMatchObject( names.output.columns[provider] @@ -186,7 +195,7 @@ describe("column & table names", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); - if (integrations[index] === "postgres") { + if (integration(index) === "postgres") { expect(received[1].metadata).toHaveProperty( "table", "a_1_a_2_a_3_a_4_a_5_b_1_b_2_b_3_b_4_b_5_c_1_c_2_c_3_c_4_c_5_d_1" @@ -210,7 +219,7 @@ describe("column & table names", () => { //KEY should be trimmed to 63 return; } - if (integrations[index] === "snowflake") { + if (integration(index) === "snowflake") { expect(received[1].metadata).toHaveProperty( "table", "A_1_A_2_A_3_A_4_A_5_B_1_B_2_B_3_B_4_B_5_C_1_C_2_C_3_C_4_C_5_D_1_D_2_D_3_D_4_D_5_E_1_E_2_E_3_E_4_E_5_F_1_F_2_F_3_F_4_F_5_G_1_G_2" @@ -233,7 +242,7 @@ describe("column & table names", () => { ); return; } - if (integrations[index] === "s3_datalake" || integrations[index] === "gcs_datalake" || integrations[index] === "azure_datalake") { + if (integration(index) === "s3_datalake" || integration(index) === "gcs_datalake" || integration(index) === "azure_datalake") { expect(received[1].metadata).toHaveProperty( "table", "a_1_a_2_a_3_a_4_a_5_b_1_b_2_b_3_b_4_b_5_c_1_c_2_c_3_c_4_c_5_d_1_d_2_d_3_d_4_d_5_e_1_e_2_e_3_e_4_e_5_f_1_f_2_f_3_f_4_f_5_g_1_g_2_g_3_g_4_g_5" @@ -316,7 +325,7 @@ describe("conflict between rudder set props and user set props", () => { const propsKey = propsKeyMap[evType]; transformers.forEach((transformer, index) => { let sampleRudderPropKey = "id"; - if (integrations[index] === "snowflake") { + if (integration(index) === "snowflake") { sampleRudderPropKey = "ID"; } @@ -354,7 +363,7 @@ describe("handle reserved words", () => { const propsKey = propsKeyMap[evType]; transformers.forEach((transformer, index) => { const reserverdKeywordsMap = - reservedANSIKeywordsMap[integrations[index].toUpperCase()]; + reservedANSIKeywordsMap[integration(index).toUpperCase()]; i.message[propsKey] = Object.assign( i.message[propsKey] || {}, @@ -377,7 +386,7 @@ describe("handle reserved words", () => { } else { k = snakeCasedKey; } - if (integrations[index] === "snowflake") { + if (integration(index) === "snowflake") { expect(out.metadata.columns).toHaveProperty(k); } else { expect(out.metadata.columns).toHaveProperty(k.toLowerCase()); @@ -461,24 +470,24 @@ describe("context ip", () => { const received = transformer.process(i); expect( received[0].metadata.columns[ - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ] ).toBe("string"); expect( received[0].data[ - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ] ).toEqual("new_ip"); if (received[1]) { expect( received[1].metadata.columns[ - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ] ).toBe("string"); expect( received[1].data[ - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ] ).toEqual("new_ip"); } @@ -496,23 +505,23 @@ describe("context ip", () => { const received = transformer.process(i); expect( received[0].metadata.columns[ - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ] ).toBe("string"); expect( received[0].data[ - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ] ).toEqual("requested_ip"); if (received[1]) { expect( received[1].metadata.columns[ - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ] ).toBe("string"); expect( received[1].data[ - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ] ).toEqual("requested_ip"); } @@ -533,10 +542,10 @@ describe("remove rudder property if rudder property is null", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ); expect(received[0].data).not.toHaveProperty( - integrationCasedString(integrations[index], "context_ip") + integrationCasedString(integration(index), "context_ip") ); }); }); @@ -551,29 +560,29 @@ describe("remove any property if event is object ", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "channel") + integrationCasedString(integration(index), "channel") ); expect(received[0].data).not.toHaveProperty( - integrationCasedString(integrations[index], "channel") + integrationCasedString(integration(index), "channel") ); }); transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "event_text") + integrationCasedString(integration(index), "event_text") ); expect(received[0].data).not.toHaveProperty( - integrationCasedString(integrations[index], "event_text") + integrationCasedString(integration(index), "event_text") ); }); i.message.channel = { channel: "android" }; transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "channel") + integrationCasedString(integration(index), "channel") ); expect(received[0].data).not.toHaveProperty( - integrationCasedString(integrations[index], "channel") + integrationCasedString(integration(index), "channel") ); }); }); @@ -589,13 +598,13 @@ describe("store full rudder event", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); const columnName = integrationCasedString( - integrations[index], + integration(index), "rudder_event" ); expect(received[0].metadata.columns).toHaveProperty(columnName); expect(received[0].metadata.columns[columnName]).toEqual( - fullEventColumnTypeByProvider[integrations[index]] + fullEventColumnTypeByProvider[integration(index)] ); expect(received[0].data[columnName]).toEqual(JSON.stringify(i.message)); @@ -635,7 +644,7 @@ describe("rudder reserved columns", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); checkProps.forEach(k => { - k = integrationCasedString(integrations[index], k); + k = integrationCasedString(integration(index), k); expect(received[0].metadata.columns).not.toHaveProperty(k); expect(received[0].data).not.toHaveProperty(k); if (received[1]) { @@ -657,12 +666,12 @@ describe("id column datatype for users table", () => { const received = transformer.process(i); expect( received[0].metadata.columns[ - integrationCasedString(integrations[index], "user_id") + integrationCasedString(integration(index), "user_id") ] ).toEqual("int"); expect( received[1].metadata.columns[ - integrationCasedString(integrations[index], "id") + integrationCasedString(integration(index), "id") ] ).toEqual("int"); }); @@ -674,12 +683,12 @@ describe("id column datatype for users table", () => { const received = transformer.process(i); expect( received[0].metadata.columns[ - integrationCasedString(integrations[index], "user_id") + integrationCasedString(integration(index), "user_id") ] ).toEqual("float"); expect( received[1].metadata.columns[ - integrationCasedString(integrations[index], "id") + integrationCasedString(integration(index), "id") ] ).toEqual("float"); }); @@ -698,22 +707,22 @@ describe("handle leading underscores in properties", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[1].metadata.columns).toHaveProperty( - integrationCasedString(integrations[index], "_timestamp") + integrationCasedString(integration(index), "_timestamp") ); expect(received[1].metadata.columns).toHaveProperty( - integrationCasedString(integrations[index], "__timestamp") + integrationCasedString(integration(index), "__timestamp") ); expect(received[1].metadata.columns).toHaveProperty( - integrationCasedString(integrations[index], "__timestamp_new") + integrationCasedString(integration(index), "__timestamp_new") ); expect(received[1].data).toHaveProperty( - integrationCasedString(integrations[index], "_timestamp") + integrationCasedString(integration(index), "_timestamp") ); expect(received[1].data).toHaveProperty( - integrationCasedString(integrations[index], "__timestamp") + integrationCasedString(integration(index), "__timestamp") ); expect(received[1].data).toHaveProperty( - integrationCasedString(integrations[index], "__timestamp_new") + integrationCasedString(integration(index), "__timestamp_new") ); }); }); @@ -727,22 +736,22 @@ describe("handle recordId from cloud sources", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect(received[0].data).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect( - received[0].data[integrationCasedString(integrations[index], "id")] + received[0].data[integrationCasedString(integration(index), "id")] ).toEqual(i.message.messageId); expect(received[1].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect(received[1].data).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect( - received[1].data[integrationCasedString(integrations[index], "id")] + received[1].data[integrationCasedString(integration(index), "id")] ).toEqual(i.message.messageId); }); }); @@ -755,22 +764,22 @@ describe("handle recordId from cloud sources", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect(received[0].data).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect( - received[0].data[integrationCasedString(integrations[index], "id")] + received[0].data[integrationCasedString(integration(index), "id")] ).toEqual(i.message.messageId); expect(received[1].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect(received[1].data).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect( - received[1].data[integrationCasedString(integrations[index], "id")] + received[1].data[integrationCasedString(integration(index), "id")] ).toEqual(i.message.messageId); }); }); @@ -783,17 +792,17 @@ describe("handle recordId from cloud sources", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect(received[0].data).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect( - received[0].data[integrationCasedString(integrations[index], "id")] + received[0].data[integrationCasedString(integration(index), "id")] ).toEqual(i.message.messageId); expect( received[0].metadata.columns[ - integrationCasedString(integrations[index], "id") + integrationCasedString(integration(index), "id") ] ).toEqual("string"); }); @@ -809,28 +818,28 @@ describe("handle recordId from cloud sources", () => { const received = transformer.process(i); expect( received[0].metadata.columns[ - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ] ).toEqual("string"); expect( received[0].data[ - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ] ).toBe("42"); expect( received[1].metadata.columns[ - integrationCasedString(integrations[index], "id") + integrationCasedString(integration(index), "id") ] ).toEqual("int"); expect( - received[1].data[integrationCasedString(integrations[index], "id")] + received[1].data[integrationCasedString(integration(index), "id")] ).toBe(42); expect(received[1].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect(received[1].data).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); }); }); @@ -845,28 +854,28 @@ describe("handle recordId from cloud sources", () => { const received = transformer.process(i); expect( received[0].metadata.columns[ - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ] ).toEqual("string"); expect( received[0].data[ - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ] ).toBe("42"); expect( received[1].metadata.columns[ - integrationCasedString(integrations[index], "id") + integrationCasedString(integration(index), "id") ] ).toEqual("int"); expect( - received[1].data[integrationCasedString(integrations[index], "id")] + received[1].data[integrationCasedString(integration(index), "id")] ).toBe(42); expect(received[1].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); expect(received[1].data).not.toHaveProperty( - integrationCasedString(integrations[index], "record_id") + integrationCasedString(integration(index), "record_id") ); }); }); @@ -906,10 +915,10 @@ describe("handle level three nested events from sources", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[1].metadata.columns).not.toHaveProperty( - integrationCasedString(integrations[index], "n_0_n_1_n_2_n_3_prop_3") + integrationCasedString(integration(index), "n_0_n_1_n_2_n_3_prop_3") ); expect(received[1].data).not.toHaveProperty( - integrationCasedString(integrations[index], "n_0_n_1_n_2_n_3_prop_3") + integrationCasedString(integration(index), "n_0_n_1_n_2_n_3_prop_3") ); }); }); @@ -934,10 +943,10 @@ describe("handle level three nested events from sources", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[1].metadata.columns).toHaveProperty( - integrationCasedString(integrations[index], "n_0_n_1_n_2_n_3_prop_3") + integrationCasedString(integration(index), "n_0_n_1_n_2_n_3_prop_3") ); expect(received[1].data).toHaveProperty( - integrationCasedString(integrations[index], "n_0_n_1_n_2_n_3_prop_3") + integrationCasedString(integration(index), "n_0_n_1_n_2_n_3_prop_3") ); }); }); @@ -947,7 +956,7 @@ describe("Handle no of columns in an event", () => { it("should throw an error if no of columns are more than 200", () => { const i = input("track"); transformers - .filter((transformer, index) => integrations[index] !== "s3_datalake" && integrations[index] !== "gcs_datalake" && integrations[index] !== "azure_datalake") + .filter((transformer, index) => integration(index) !== "s3_datalake" && integration(index) !== "gcs_datalake" && integration(index) !== "azure_datalake") .forEach((transformer, index) => { i.message.properties = largeNoOfColumnsevent; expect(() => transformer.process(i)).toThrow( @@ -975,13 +984,13 @@ describe("Add auto generated messageId for events missing it", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).toHaveProperty( - integrationCasedString(integrations[index], "id") + integrationCasedString(integration(index), "id") ); expect(received[0].data).toHaveProperty( - integrationCasedString(integrations[index], "id") + integrationCasedString(integration(index), "id") ); expect( - received[0].data[integrationCasedString(integrations[index], "id")] + received[0].data[integrationCasedString(integration(index), "id")] ).toMatch(/auto-.*/); }); }); @@ -998,10 +1007,10 @@ describe("Add receivedAt for events missing it", () => { transformers.forEach((transformer, index) => { const received = transformer.process(i); expect(received[0].metadata.columns).toHaveProperty( - integrationCasedString(integrations[index], "received_at") + integrationCasedString(integration(index), "received_at") ); expect(received[0].data).toHaveProperty( - integrationCasedString(integrations[index], "received_at") + integrationCasedString(integration(index), "received_at") ); }); }); @@ -1014,12 +1023,12 @@ describe("Integration options", () => { const i = opInput("track"); transformers.forEach((transformer, index) => { const {jsonPaths} = i.destination.Config; - if (integrations[index] === "postgres") { + if (integration(index) === "postgres") { delete i.destination.Config.jsonPaths; } const received = transformer.process(i); i.destination.Config.jsonPaths = jsonPaths; - expect(received).toEqual(opOutput("track", integrations[index])); + expect(received).toEqual(opOutput("track", integration(index))); }); }); }); @@ -1029,7 +1038,7 @@ describe("Integration options", () => { const i = opInput("users"); transformers.forEach((transformer, index) => { const received = transformer.process(i); - expect(received).toEqual(opOutput("users", integrations[index])); + expect(received).toEqual(opOutput("users", integration(index))); }); }); }); @@ -1084,18 +1093,18 @@ describe("Integration options", () => { for (const testCase of testCases) { transformers.forEach((transformer, index) => { - it(`new ${testCase.eventType} for ${integrations[index]}`, () => { + it(`new ${testCase.eventType} for ${integration(index)}`, () => { const config = require("./data/warehouse/integrations/jsonpaths/new/" + testCase.eventType); const input = _.cloneDeep(config.input); const received = transformer.process(input); - expect(received).toEqual(output(testCase.eventType, config, integrations[index])); + expect(received).toEqual(output(testCase.eventType, config, integration(index))); }) - it(`legacy ${testCase.eventType} for ${integrations[index]}`, () => { + it(`legacy ${testCase.eventType} for ${integration(index)}`, () => { const config = require("./data/warehouse/integrations/jsonpaths/legacy/" + testCase.eventType); const input = _.cloneDeep(config.input); const received = transformer.process(input); - expect(received).toEqual(output(testCase.eventType, config, integrations[index])); + expect(received).toEqual(output(testCase.eventType, config, integration(index))); }) }); } @@ -1285,10 +1294,10 @@ describe("Destination config", () => { }; events.forEach(event => { Object.entries(traitsToCheck).forEach(([trait, value]) => { - expect(event.data[integrationCasedString(integrations[index], trait)]).toEqual(value); - expect(event.data[integrationCasedString(integrations[index], `context_traits_${trait}`)]).toEqual(value); - expect(event.metadata.columns).toHaveProperty(integrationCasedString(integrations[index], trait)); - expect(event.metadata.columns).toHaveProperty(integrationCasedString(integrations[index], `context_traits_${trait}`)); + expect(event.data[integrationCasedString(integration(index), trait)]).toEqual(value); + expect(event.data[integrationCasedString(integration(index), `context_traits_${trait}`)]).toEqual(value); + expect(event.metadata.columns).toHaveProperty(integrationCasedString(integration(index), trait)); + expect(event.metadata.columns).toHaveProperty(integrationCasedString(integration(index), `context_traits_${trait}`)); }); }); }); @@ -1316,13 +1325,13 @@ describe("Destination config", () => { } } const output = transformer.process(event); - expect(output[0].data[integrationCasedString(integrations[index], `event`)]).toEqual('button_clicked_v_2'); - expect(output[0].data[integrationCasedString(integrations[index], `context_attribute_v_3`)]).toEqual('some-value'); - expect(output[0].metadata.columns).toHaveProperty(integrationCasedString(integrations[index], `context_attribute_v_3`)); - expect(output[1].data[integrationCasedString(integrations[index], `event`)]).toEqual('button_clicked_v_2'); - expect(output[1].data[integrationCasedString(integrations[index], `context_attribute_v_3`)]).toEqual('some-value'); - expect(output[1].metadata.table).toEqual(integrationCasedString(integrations[index], 'button_clicked_v_2')); - expect(output[1].metadata.columns).toHaveProperty(integrationCasedString(integrations[index], `context_attribute_v_3`)); + expect(output[0].data[integrationCasedString(integration(index), `event`)]).toEqual('button_clicked_v_2'); + expect(output[0].data[integrationCasedString(integration(index), `context_attribute_v_3`)]).toEqual('some-value'); + expect(output[0].metadata.columns).toHaveProperty(integrationCasedString(integration(index), `context_attribute_v_3`)); + expect(output[1].data[integrationCasedString(integration(index), `event`)]).toEqual('button_clicked_v_2'); + expect(output[1].data[integrationCasedString(integration(index), `context_attribute_v_3`)]).toEqual('some-value'); + expect(output[1].metadata.table).toEqual(integrationCasedString(integration(index), 'button_clicked_v_2')); + expect(output[1].metadata.columns).toHaveProperty(integrationCasedString(integration(index), `context_attribute_v_3`)); }); }); }); @@ -1364,10 +1373,10 @@ describe("Destination config", () => { }; events.forEach(event => { Object.entries(traitsToCheck).forEach(([trait, value]) => { - expect(event.data).not.toHaveProperty(integrationCasedString(integrations[index], trait)); - expect(event.data[integrationCasedString(integrations[index], `context_traits_${trait}`)]).toEqual(value); - expect(event.metadata.columns).not.toHaveProperty(integrationCasedString(integrations[index], trait)); - expect(event.metadata.columns).toHaveProperty(integrationCasedString(integrations[index], `context_traits_${trait}`)); + expect(event.data).not.toHaveProperty(integrationCasedString(integration(index), trait)); + expect(event.data[integrationCasedString(integration(index), `context_traits_${trait}`)]).toEqual(value); + expect(event.metadata.columns).not.toHaveProperty(integrationCasedString(integration(index), trait)); + expect(event.metadata.columns).toHaveProperty(integrationCasedString(integration(index), `context_traits_${trait}`)); }); }); }); @@ -1393,13 +1402,13 @@ describe("Destination config", () => { } } const output = transformer.process(event); - expect(output[0].data[integrationCasedString(integrations[index], `event`)]).toEqual('button_clicked_v2'); - expect(output[0].data[integrationCasedString(integrations[index], `context_attribute_v3`)]).toEqual('some-value'); - expect(output[0].metadata.columns).toHaveProperty(integrationCasedString(integrations[index], `context_attribute_v3`)); - expect(output[1].data[integrationCasedString(integrations[index], `event`)]).toEqual('button_clicked_v2'); - expect(output[1].data[integrationCasedString(integrations[index], `context_attribute_v3`)]).toEqual('some-value'); - expect(output[1].metadata.table).toEqual(integrationCasedString(integrations[index], 'button_clicked_v2')); - expect(output[1].metadata.columns).toHaveProperty(integrationCasedString(integrations[index], `context_attribute_v3`)); + expect(output[0].data[integrationCasedString(integration(index), `event`)]).toEqual('button_clicked_v2'); + expect(output[0].data[integrationCasedString(integration(index), `context_attribute_v3`)]).toEqual('some-value'); + expect(output[0].metadata.columns).toHaveProperty(integrationCasedString(integration(index), `context_attribute_v3`)); + expect(output[1].data[integrationCasedString(integration(index), `event`)]).toEqual('button_clicked_v2'); + expect(output[1].data[integrationCasedString(integration(index), `context_attribute_v3`)]).toEqual('some-value'); + expect(output[1].metadata.table).toEqual(integrationCasedString(integration(index), 'button_clicked_v2')); + expect(output[1].metadata.columns).toHaveProperty(integrationCasedString(integration(index), `context_attribute_v3`)); }); }); }); @@ -1606,8 +1615,8 @@ describe("context traits", () => { expect(Object.keys(received[0].data).join()).not.toMatch(/context_traits/g); } for (const column of t.expectedColumns) { - expect(received[0].metadata.columns[integrationCasedString(integrations[index], column)]).toEqual(t.expectedMetadata); - expect(received[0].data[integrationCasedString(integrations[index], column)]).toEqual(t.expectedData); + expect(received[0].metadata.columns[integrationCasedString(integration(index), column)]).toEqual(t.expectedMetadata); + expect(received[0].data[integrationCasedString(integration(index), column)]).toEqual(t.expectedData); } }); } @@ -1699,8 +1708,8 @@ describe("group traits", () => { expect(Object.keys(received[0].data).join()).not.toMatch(/group_traits/g); } for (const column of t.expectedColumns) { - expect(received[0].metadata.columns[integrationCasedString(integrations[index], column)]).toEqual(t.expectedMetadata); - expect(received[0].data[integrationCasedString(integrations[index], column)]).toEqual(t.expectedData); + expect(received[0].metadata.columns[integrationCasedString(integration(index), column)]).toEqual(t.expectedMetadata); + expect(received[0].data[integrationCasedString(integration(index), column)]).toEqual(t.expectedData); } }); }); From 741f0c6d6714cf760ce98cc9354b61f7b5ce4684 Mon Sep 17 00:00:00 2001 From: Aanshi Lahoti <110057617+aanshi07@users.noreply.github.com> Date: Tue, 22 Oct 2024 15:34:43 +0530 Subject: [PATCH 11/21] feat: onboard tune destination (#3795) * feat: onboard tune destination * chore: test cases added * chore: file name updated * chore: import fix * chore: updated mappings * chore: updated transform.js * chore: updated test cases * chore: small fix * chore: router test cases added * chore: minor fix --------- Co-authored-by: Sai Sankeerth --- src/v0/destinations/tune/transform.js | 90 +++++++ .../destinations/tune/processor/data.ts | 3 + .../tune/processor/trackTestData.ts | 228 ++++++++++++++++++ .../destinations/tune/router/data.ts | 190 +++++++++++++++ 4 files changed, 511 insertions(+) create mode 100644 src/v0/destinations/tune/transform.js create mode 100644 test/integrations/destinations/tune/processor/data.ts create mode 100644 test/integrations/destinations/tune/processor/trackTestData.ts create mode 100644 test/integrations/destinations/tune/router/data.ts diff --git a/src/v0/destinations/tune/transform.js b/src/v0/destinations/tune/transform.js new file mode 100644 index 0000000000..97dad0e3d3 --- /dev/null +++ b/src/v0/destinations/tune/transform.js @@ -0,0 +1,90 @@ +const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); +const { + defaultRequestConfig, + simpleProcessRouterDest, + getHashFromArray, + isDefinedAndNotNull, + isNotEmpty, +} = require('../../util'); + +const mapPropertiesWithNestedSupport = (msg, properties, mappings) => { + const mappedObj = {}; // Create a new object for parameters + Object.entries(mappings).forEach(([key, value]) => { + const keyStr = `${key}`; + const args = { object: properties, key: keyStr }; + if (args.key.split('.').length > 1) { + // Handle nested keys + args.object = msg; // This line modifies the object property of args + } + const data = get(args.object, args.key); + if (isDefinedAndNotNull(data) && isNotEmpty(data)) { + mappedObj[value] = data; // Map to the corresponding destination key + } + }); + return mappedObj; // Return the new params object +}; + +const responseBuilder = (message, { Config }) => { + const { tuneEvents } = Config; // Extract tuneEvents from config + const { properties, event: messageEvent } = message; // Destructure properties and event from message + + // Find the relevant tune event based on the message's event name + const tuneEvent = tuneEvents.find((event) => event.eventName === messageEvent); + + if (tuneEvent) { + const standardHashMap = getHashFromArray(tuneEvent.standardMapping, 'from', 'to', false); + const advSubIdHashMap = getHashFromArray(tuneEvent.advSubIdMapping, 'from', 'to', false); + const advUniqueIdHashMap = getHashFromArray(tuneEvent.advUniqueIdMapping, 'from', 'to', false); + + const params = { + ...mapPropertiesWithNestedSupport(message, properties, standardHashMap), + ...mapPropertiesWithNestedSupport(message, properties, advSubIdHashMap), + ...mapPropertiesWithNestedSupport(message, properties, advUniqueIdHashMap), + }; + + // Prepare the response + const response = defaultRequestConfig(); + response.params = params; // Set only the mapped params + response.endpoint = tuneEvent.url; // Use the user-defined URL + + return response; + } + + throw new InstrumentationError('No matching tune event found for the provided event.', 400); +}; + +const processEvent = (message, destination) => { + // Validate message type + if (!isDefinedAndNotNull(message.type) || typeof message.type !== 'string') { + throw new InstrumentationError( + 'Message Type is not present or is not a string. Aborting message.', + 400, + ); + } + const messageType = message.type.toLowerCase(); + + // Initialize response variable + let response; + + // Process 'track' messages using the responseBuilder + if (messageType === 'track') { + response = responseBuilder(message, destination); + } else { + throw new InstrumentationError('Message type not supported. Only "track" is allowed.', 400); + } + + return response; +}; + +const process = (event) => processEvent(event.message, event.destination); + +const processRouterDest = async (inputs, reqMetadata) => { + const respList = await simpleProcessRouterDest(inputs, process, reqMetadata); + return respList; +}; + +module.exports = { + process, + processRouterDest, +}; diff --git a/test/integrations/destinations/tune/processor/data.ts b/test/integrations/destinations/tune/processor/data.ts new file mode 100644 index 0000000000..aa818d9b83 --- /dev/null +++ b/test/integrations/destinations/tune/processor/data.ts @@ -0,0 +1,3 @@ +import { trackTestdata } from './trackTestData'; + +export const data = [...trackTestdata]; diff --git a/test/integrations/destinations/tune/processor/trackTestData.ts b/test/integrations/destinations/tune/processor/trackTestData.ts new file mode 100644 index 0000000000..c19ffdd84c --- /dev/null +++ b/test/integrations/destinations/tune/processor/trackTestData.ts @@ -0,0 +1,228 @@ +import { Destination } from '../../../../../src/types'; +import { ProcessorTestData } from '../../../testTypes'; +import { + generateMetadata, + generateSimplifiedTrackPayload, + overrideDestination, + transformResultBuilder, +} from '../../../testUtils'; + +const destination: Destination = { + ID: '123', + Name: 'tune', + DestinationDefinition: { + ID: '123', + Name: 'tune', + DisplayName: 'tune', + Config: {}, + }, + Config: { + connectionMode: { + web: 'cloud', + }, + consentManagement: {}, + oneTrustCookieCategories: {}, + ketchConsentPurposes: {}, + tuneEvents: [ + { + url: 'https://demo.go2cloud.org/aff_l?offer_id=45&aff_id=1029', + eventName: 'Product added', + standardMapping: [ + { to: 'aff_id', from: 'affId' }, + { to: 'promo_code', from: 'promoCode' }, + { to: 'security_token', from: 'securityToken' }, + { to: 'status', from: 'status' }, + { to: 'transaction_id', from: 'mytransactionId' }, + ], + advSubIdMapping: [{ from: 'context.traits.ip', to: 'adv_sub2' }], + advUniqueIdMapping: [{ from: 'context.traits.customProperty1', to: 'adv_unique1' }], + }, + ], + }, + Enabled: true, + WorkspaceID: '123', + Transformations: [], +}; + +export const trackTestdata: ProcessorTestData[] = [ + { + id: 'Test 0', + name: 'tune', + description: 'Track call with standard properties mapping', + scenario: 'Business', + successCriteria: + 'The response should have a status code of 200 and correctly map the properties to the specified parameters.', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'Product added', + properties: { + securityToken: '1123', + mytransactionId: 'test-123', + }, + context: { + traits: { + customProperty1: 'customValue', + firstName: 'David', + logins: 2, + ip: '0.0.0.0', + }, + }, + anonymousId: 'david_bowie_anonId', + }), + metadata: generateMetadata(1), + destination, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: 'https://demo.go2cloud.org/aff_l?offer_id=45&aff_id=1029', + event: 'Product added', + headers: {}, + params: { + security_token: '1123', + transaction_id: 'test-123', + adv_sub2: '0.0.0.0', + adv_unique1: 'customValue', + }, + userId: '', + JSON: {}, + }), + metadata: generateMetadata(1), + statusCode: 200, + }, + ], + }, + }, + }, + { + id: 'Test 1', + name: 'tune', + description: 'Test case for handling a missing tune event for a given event name', + scenario: 'Business', + successCriteria: + 'The response should return a 400 status code with an appropriate error message indicating no matching tune event was found.', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'Purchase event', + properties: { + securityToken: '1123', + mytransactionId: 'test-123', + }, + context: { + traits: { + customProperty1: 'customValue', + firstName: 'David', + logins: 2, + }, + }, + anonymousId: 'david_bowie_anonId', + }), + metadata: generateMetadata(1), + destination, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'No matching tune event found for the provided event.', + statTags: { + destType: 'TUNE', + destinationId: 'default-destinationId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + workspaceId: 'default-workspaceId', + }, + metadata: generateMetadata(1), + statusCode: 400, + }, + ], + }, + }, + }, + { + id: 'Test 2', + name: 'tune', + description: 'Incorrect message type', + scenario: 'Business', + successCriteria: 'The response should return a 400 status code due to invalid message type.', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'abc', + event: 'Product added', + properties: { + securityToken: '1123', + mytransactionId: 'test-123', + }, + context: { + traits: { + customProperty1: 'customValue', + firstName: 'David', + logins: 2, + }, + }, + anonymousId: 'david_bowie_anonId', + }, + metadata: generateMetadata(1), + destination, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Message type not supported. Only "track" is allowed.', + statTags: { + destType: 'TUNE', + destinationId: 'default-destinationId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + workspaceId: 'default-workspaceId', + }, + metadata: generateMetadata(1), + statusCode: 400, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/tune/router/data.ts b/test/integrations/destinations/tune/router/data.ts new file mode 100644 index 0000000000..65bfee4ade --- /dev/null +++ b/test/integrations/destinations/tune/router/data.ts @@ -0,0 +1,190 @@ +import { Destination } from '../../../../../src/types'; +import { RouterTestData } from '../../../testTypes'; +import { generateMetadata } from '../../../testUtils'; + +const destination: Destination = { + ID: '123', + Name: 'tune', + DestinationDefinition: { + ID: '123', + Name: 'tune', + DisplayName: 'tune', + Config: {}, + }, + Config: { + connectionMode: { + web: 'cloud', + }, + consentManagement: {}, + oneTrustCookieCategories: {}, + ketchConsentPurposes: {}, + tuneEvents: [ + { + url: 'https://demo.go2cloud.org/aff_l?offer_id=45&aff_id=1029', + eventName: 'Product added', + standardMapping: [ + { to: 'aff_id', from: 'affId' }, + { to: 'promo_code', from: 'promoCode' }, + { to: 'security_token', from: 'securityToken' }, + { to: 'status', from: 'status' }, + { to: 'transaction_id', from: 'mytransactionId' }, + ], + advSubIdMapping: [{ from: 'context.ip', to: 'adv_sub2' }], + advUniqueIdMapping: [{ from: 'context.traits.anonymousId', to: 'adv_unique1' }], + }, + ], + }, + Enabled: true, + WorkspaceID: '123', + Transformations: [], +}; + +export const data: RouterTestData[] = [ + { + id: 'tune-router-test-1', + name: 'tune', + description: 'Basic Router Test for track call with standard properties mapping.', + scenario: 'Business', + successCriteria: + 'The response should have a status code of 200, and the output should correctly map the properties.', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + destination, + metadata: generateMetadata(1), + message: { + type: 'track', + event: 'Product added', + anonymousId: 'sampath', + channel: 'web', + context: { + app: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + ip: '0.0.0.0', + traits: { anonymousId: 'sampath', email: 'sampath@gmail.com' }, + }, + integrations: { All: true }, + properties: { + securityToken: '1123', + mytransactionId: 'test-123', + }, + }, + }, + ], + destType: 'tune', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://demo.go2cloud.org/aff_l?offer_id=45&aff_id=1029', + headers: {}, + params: { + security_token: '1123', + transaction_id: 'test-123', + adv_sub2: '0.0.0.0', + adv_unique1: 'sampath', + }, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [generateMetadata(1)], + batched: false, + statusCode: 200, + destination, + }, + ], + }, + }, + }, + }, + { + id: 'tune-router-test-2', + name: 'tune', + description: 'Basic Router Test with incorrect message type ', + scenario: 'Business', + successCriteria: + 'The response should return a 400 status code due to an invalid message type, with an appropriate error message indicating that the message type is not present or is not a string.', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + destination, + metadata: generateMetadata(1), + message: { + type: 123, + event: 'Product added', + anonymousId: 'sampath', + channel: 'web', + context: { + app: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + ip: '0.0.0.0', + traits: { anonymousId: 'sampath', email: 'sampath@gmail.com' }, + }, + integrations: { All: true }, + properties: { + securityToken: '1123', + mytransactionId: 'test-123', + }, + }, + }, + ], + destType: 'tune', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + error: 'Message Type is not present or is not a string. Aborting message.', + statTags: { + destType: 'TUNE', + destinationId: 'default-destinationId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + workspaceId: 'default-workspaceId', + }, + metadata: [generateMetadata(1)], + batched: false, + statusCode: 400, + destination, + }, + ], + }, + }, + }, + }, +]; From f781a84ade98649d68cebf4da13c2ceff8df2df2 Mon Sep 17 00:00:00 2001 From: ItsSudip Date: Wed, 23 Oct 2024 11:12:57 +0530 Subject: [PATCH 12/21] fix: add missing field for pinterest_tag single product events --- .../v2/destinations/pinterest_tag/procWorkflow.yaml | 6 +++++- test/apitests/data_scenarios/cdk_v2/failure.json | 8 ++++++++ test/apitests/data_scenarios/cdk_v2/success.json | 12 ++++++++++++ .../destination/proc/batch_input_multiplex.json | 12 ++++++++++++ .../destination/proc/multiplex_partial_failure.json | 8 ++++++++ .../destination/proc/multiplex_success.json | 8 ++++++++ .../destination/router/failure_test.json | 8 ++++++++ .../destinations/pinterest_tag/processor/data.ts | 13 ++++++++++--- .../destinations/pinterest_tag/router/data.ts | 4 +++- .../destinations/pinterest_tag/step/data.ts | 11 ++++++++--- 10 files changed, 82 insertions(+), 8 deletions(-) diff --git a/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml b/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml index 64d391c888..5d97da5a9e 100644 --- a/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml +++ b/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml @@ -167,7 +167,11 @@ steps: "content_ids": (props.product_id ?? props.sku ?? props.id)[], "contents": { "quantity": Number(props.quantity) || 1, - "item_price": String(props.price) + "item_price": String(props.price), + "item_name": String(props.name), + "id": props.product_id ?? props.sku, + "item_category": props.category, + "item_brand": props.brand }[] }; - name: combineAllEcomFields diff --git a/test/apitests/data_scenarios/cdk_v2/failure.json b/test/apitests/data_scenarios/cdk_v2/failure.json index 1635a3f0db..154d24481d 100644 --- a/test/apitests/data_scenarios/cdk_v2/failure.json +++ b/test/apitests/data_scenarios/cdk_v2/failure.json @@ -556,6 +556,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } @@ -679,6 +683,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } diff --git a/test/apitests/data_scenarios/cdk_v2/success.json b/test/apitests/data_scenarios/cdk_v2/success.json index ced7433a28..88f430dd7c 100644 --- a/test/apitests/data_scenarios/cdk_v2/success.json +++ b/test/apitests/data_scenarios/cdk_v2/success.json @@ -556,6 +556,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } @@ -634,6 +638,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } @@ -712,6 +720,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } diff --git a/test/apitests/data_scenarios/destination/proc/batch_input_multiplex.json b/test/apitests/data_scenarios/destination/proc/batch_input_multiplex.json index 3ce7c15091..3deb7d4b8b 100644 --- a/test/apitests/data_scenarios/destination/proc/batch_input_multiplex.json +++ b/test/apitests/data_scenarios/destination/proc/batch_input_multiplex.json @@ -388,6 +388,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } @@ -466,6 +470,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } @@ -544,6 +552,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } diff --git a/test/apitests/data_scenarios/destination/proc/multiplex_partial_failure.json b/test/apitests/data_scenarios/destination/proc/multiplex_partial_failure.json index 0e467c26d0..a2652855d5 100644 --- a/test/apitests/data_scenarios/destination/proc/multiplex_partial_failure.json +++ b/test/apitests/data_scenarios/destination/proc/multiplex_partial_failure.json @@ -388,6 +388,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } @@ -466,6 +470,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } diff --git a/test/apitests/data_scenarios/destination/proc/multiplex_success.json b/test/apitests/data_scenarios/destination/proc/multiplex_success.json index 66b6c870a9..ba4d5266f3 100644 --- a/test/apitests/data_scenarios/destination/proc/multiplex_success.json +++ b/test/apitests/data_scenarios/destination/proc/multiplex_success.json @@ -207,6 +207,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } @@ -285,6 +289,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } diff --git a/test/apitests/data_scenarios/destination/router/failure_test.json b/test/apitests/data_scenarios/destination/router/failure_test.json index 9e36da50cb..197456f66a 100644 --- a/test/apitests/data_scenarios/destination/router/failure_test.json +++ b/test/apitests/data_scenarios/destination/router/failure_test.json @@ -754,6 +754,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } @@ -781,6 +785,10 @@ "content_ids": ["123"], "contents": [ { + "id": "123", + "item_brand": "Gamepro", + "item_category": "Games", + "item_name": "Game", "quantity": 11, "item_price": "13.49" } diff --git a/test/integrations/destinations/pinterest_tag/processor/data.ts b/test/integrations/destinations/pinterest_tag/processor/data.ts index b856d247d7..1788d13d56 100644 --- a/test/integrations/destinations/pinterest_tag/processor/data.ts +++ b/test/integrations/destinations/pinterest_tag/processor/data.ts @@ -482,7 +482,9 @@ export const data = [ order_id: '50314b8e9bcf000000000000', num_items: 2, content_ids: ['123'], - contents: [{ quantity: 2, item_price: '25' }], + contents: [ + { id: '123', item_name: 'undefined', quantity: 2, item_price: '25' }, + ], }, }, JSON_ARRAY: {}, @@ -2405,7 +2407,9 @@ export const data = [ order_id: '50314b8e9bcf000000000000', num_items: 0, content_ids: ['1234'], - contents: [{ quantity: 1, item_price: 'undefined' }], + contents: [ + { id: '1234', item_name: 'undefined', quantity: 1, item_price: 'undefined' }, + ], }, }, JSON_ARRAY: {}, @@ -2666,7 +2670,7 @@ export const data = [ advertiser_id: '123456', app_id: '429047995', custom_data: { - contents: [{ item_price: 'undefined', quantity: 1 }], + contents: [{ item_price: 'undefined', quantity: 1, item_name: 'undefined' }], currency: 'USD', num_items: 0, order_id: '50314b8e9bcf000000000000', @@ -3497,6 +3501,7 @@ export const data = [ subtotal: 22.5, affiliation: 'Google Store', checkout_id: 'fksdjfsdjfisjf9sdfjsd9f', + category: 'Apparel', }, anonymousId: '50be5c78-6c3f-4b60-be84-97805a316fb1', integrations: { All: true }, @@ -3563,6 +3568,8 @@ export const data = [ { quantity: 1, item_price: 'undefined', + item_name: 'undefined', + item_category: 'Apparel', }, ], currency: 'USD', diff --git a/test/integrations/destinations/pinterest_tag/router/data.ts b/test/integrations/destinations/pinterest_tag/router/data.ts index c9ab29a45a..28c82c4679 100644 --- a/test/integrations/destinations/pinterest_tag/router/data.ts +++ b/test/integrations/destinations/pinterest_tag/router/data.ts @@ -815,7 +815,9 @@ export const data = [ order_id: '50314b8e9bcf000000000000', num_items: 2, content_ids: ['123'], - contents: [{ quantity: 2, item_price: '25' }], + contents: [ + { id: '123', item_name: 'undefined', quantity: 2, item_price: '25' }, + ], }, }, { diff --git a/test/integrations/destinations/pinterest_tag/step/data.ts b/test/integrations/destinations/pinterest_tag/step/data.ts index b607e3c9fa..8f0680a77c 100644 --- a/test/integrations/destinations/pinterest_tag/step/data.ts +++ b/test/integrations/destinations/pinterest_tag/step/data.ts @@ -468,7 +468,9 @@ export const data = [ order_id: '50314b8e9bcf000000000000', num_items: 2, content_ids: ['123'], - contents: [{ quantity: 2, item_price: '25' }], + contents: [ + { id: '123', item_name: 'undefined', quantity: 2, item_price: '25' }, + ], }, }, JSON_ARRAY: {}, @@ -2420,7 +2422,9 @@ export const data = [ order_id: '50314b8e9bcf000000000000', num_items: 0, content_ids: ['1234'], - contents: [{ quantity: 1, item_price: 'undefined' }], + contents: [ + { id: '1234', item_name: 'undefined', quantity: 1, item_price: 'undefined' }, + ], }, }, JSON_ARRAY: {}, @@ -2685,7 +2689,7 @@ export const data = [ advertiser_id: '123456', app_id: '429047995', custom_data: { - contents: [{ item_price: 'undefined', quantity: 1 }], + contents: [{ item_name: 'undefined', item_price: 'undefined', quantity: 1 }], currency: 'USD', num_items: 0, order_id: '50314b8e9bcf000000000000', @@ -3605,6 +3609,7 @@ export const data = [ num_items: 0, contents: [ { + item_name: 'undefined', quantity: 1, item_price: 'undefined', }, From f79dfe74b447b8ccd80287e143ff771688c510be Mon Sep 17 00:00:00 2001 From: Sankeerth Date: Wed, 23 Oct 2024 12:39:17 +0530 Subject: [PATCH 13/21] feat: support for multiple zap urls (#3825) * feat: support for multiple zap urls * fix: update endpoint to array * fix: use forEach instead of map, remove unused dependency --------- Co-authored-by: Sai Sankeerth --- .../v2/destinations/zapier/procWorkflow.yaml | 20 +- src/cdk/v2/destinations/zapier/utils.js | 15 + .../destinations/zapier/processor/data.ts | 266 ++++++++++++++++++ 3 files changed, 288 insertions(+), 13 deletions(-) create mode 100644 src/cdk/v2/destinations/zapier/utils.js diff --git a/src/cdk/v2/destinations/zapier/procWorkflow.yaml b/src/cdk/v2/destinations/zapier/procWorkflow.yaml index c14c57378c..d7a5429129 100644 --- a/src/cdk/v2/destinations/zapier/procWorkflow.yaml +++ b/src/cdk/v2/destinations/zapier/procWorkflow.yaml @@ -1,10 +1,9 @@ bindings: - name: EventType path: ../../../../constants - - name: getHashFromArray + - name: getHashFromArrayWithDuplicate path: ../../../../v0/util/index - - name: defaultRequestConfig - path: ../../../../v0/util + - path: ./utils steps: - name: validateInput @@ -15,18 +14,18 @@ steps: - name: prepareContext template: | $.context.messageType = .message.type.toLowerCase(); - $.context.endpoint = .destination.Config.zapUrl; + $.context.endpoint = [.destination.Config.zapUrl]; - name: trackEndpoint condition: $.context.messageType === {{$.EventType.TRACK}} template: | - const trackEventsMap = $.getHashFromArray(.destination.Config.trackEventsToZap); + const trackEventsMap = $.getHashFromArrayWithDuplicate(.destination.Config.trackEventsToZap); const eventName = .message.event.toLowerCase(); (eventName && trackEventsMap[eventName]) ? ($.context.endpoint = trackEventsMap[eventName]) else: name: endpointForOthers template: | - const pageScreenEventsMap = $.getHashFromArray(.destination.Config.pageScreenEventsToZap); + const pageScreenEventsMap = $.getHashFromArrayWithDuplicate(.destination.Config.pageScreenEventsToZap); const pageName = .message.name.toLowerCase(); (pageName && pageScreenEventsMap[pageName]) ? ($.context.endpoint = pageScreenEventsMap[pageName]) @@ -37,10 +36,5 @@ steps: else: name: buildResponseForProcessTransformation template: | - const response = $.defaultRequestConfig(); - response.body.JSON = .message; - response.endpoint = $.context.endpoint; - response.headers = { - "content-type": "application/json" - }; - response + const responseList = $.buildResponseList(.message, $.context.endpoint) + responseList diff --git a/src/cdk/v2/destinations/zapier/utils.js b/src/cdk/v2/destinations/zapier/utils.js new file mode 100644 index 0000000000..43de6e58dd --- /dev/null +++ b/src/cdk/v2/destinations/zapier/utils.js @@ -0,0 +1,15 @@ +const { defaultRequestConfig } = require('../../../../v0/util'); + +const buildResponseList = (payload, endpointList) => { + const responseList = []; + endpointList.forEach((endpoint) => { + const response = defaultRequestConfig(); + response.body.JSON = payload; + response.endpoint = endpoint; + response.headers = { 'content-type': 'application/json' }; + responseList.push(response); + }); + return responseList; +}; + +module.exports = { buildResponseList }; diff --git a/test/integrations/destinations/zapier/processor/data.ts b/test/integrations/destinations/zapier/processor/data.ts index b938f68dc5..b4f5a2a8c5 100644 --- a/test/integrations/destinations/zapier/processor/data.ts +++ b/test/integrations/destinations/zapier/processor/data.ts @@ -643,6 +643,62 @@ export const data = [ response: { status: 200, body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'def.zap-hook', + headers: { + 'content-type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'def', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-04-17T14:42:44.724Z', + sentAt: '2020-04-17T14:42:44.724Z', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, { output: { version: '1', @@ -703,4 +759,214 @@ export const data = [ }, }, }, + { + id: 'Test 5', + name: 'zapier', + description: 'Track call with Multiplexing', + scenario: 'Framework+Business', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'def', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + timestamp: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-04-17T14:42:44.724Z', + sentAt: '2020-04-17T14:42:44.724Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + zapUrl: 'abcd.zap-hook', + trackEventsToZap: [ + { + from: 'def', + to: ['def.zap-hook', 'ghi.zap-hook'], + }, + ], + pageScreenEventsToZap: [{}], + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: ['def.zap-hook', 'ghi.zap-hook'], + headers: { + 'content-type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'def', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + timestamp: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-04-17T14:42:44.724Z', + sentAt: '2020-04-17T14:42:44.724Z', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + id: 'Test 6', + name: 'zapier', + description: 'Page call with Multiplexing', + scenario: 'Framework+Business', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + name: 'abc_page_test', + userId: 'identified user id', + type: 'page', + anonymousId: 'anon-id-new', + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-04-17T14:42:44.724Z', + sentAt: '2020-04-17T14:42:44.724Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + zapUrl: 'abcd.zap-hook', + trackEventsToZap: [{}], + pageScreenEventsToZap: [ + { + from: 'abc_page_test', + to: ['page.zap-hook', 'ghi.zap-hook'], + }, + ], + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: ['page.zap-hook', 'ghi.zap-hook'], + headers: { + 'content-type': 'application/json', + }, + params: {}, + body: { + JSON: { + name: 'abc_page_test', + userId: 'identified user id', + type: 'page', + anonymousId: 'anon-id-new', + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-04-17T14:42:44.724Z', + sentAt: '2020-04-17T14:42:44.724Z', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, ]; From 8f18e1aca70ab68e3f157a4632d63ae7cec0e87b Mon Sep 17 00:00:00 2001 From: Manish Kumar <144022547+manish339k@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:24:11 +0530 Subject: [PATCH 14/21] fix: str replace is not a function error (#3799) * fix: str.replace is not a function * fix: resolving comments --- .../transform.js | 22 +- src/v0/util/index.js | 6 +- src/v0/util/index.test.js | 16 + .../router/data.ts | 307 ++++++++++++++++++ 4 files changed, 345 insertions(+), 6 deletions(-) diff --git a/src/v0/destinations/google_adwords_enhanced_conversions/transform.js b/src/v0/destinations/google_adwords_enhanced_conversions/transform.js index 55d0c16c8c..007f16d7f8 100644 --- a/src/v0/destinations/google_adwords_enhanced_conversions/transform.js +++ b/src/v0/destinations/google_adwords_enhanced_conversions/transform.js @@ -1,8 +1,9 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); -const { cloneDeep } = require('lodash'); +const { cloneDeep, isNumber } = require('lodash'); const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); +const isString = require('lodash/isString'); const { constructPayload, defaultRequestConfig, @@ -35,7 +36,18 @@ const updateMappingJson = (mapping) => { const responseBuilder = async (metadata, message, { Config }, payload) => { const response = defaultRequestConfig(); const { event } = message; - const filteredCustomerId = removeHyphens(Config.customerId); + const { subAccount } = Config; + let { customerId, loginCustomerId } = Config; + if (isNumber(customerId)) { + customerId = customerId.toString(); + } + if (isNumber(loginCustomerId)) { + loginCustomerId = loginCustomerId.toString(); + } + if (!isString(customerId) || !isString(loginCustomerId)) { + throw new InstrumentationError('customerId and loginCustomerId should be a string or number'); + } + const filteredCustomerId = removeHyphens(customerId); response.endpoint = `${BASE_ENDPOINT}/${filteredCustomerId}:uploadConversionAdjustments`; response.body.JSON = payload; const accessToken = getAccessToken(metadata, 'access_token'); @@ -45,9 +57,9 @@ const responseBuilder = async (metadata, message, { Config }, payload) => { 'developer-token': getValueFromMessage(metadata, 'secret.developer_token'), }; response.params = { event, customerId: filteredCustomerId }; - if (Config.subAccount) - if (Config.loginCustomerId) { - const filteredLoginCustomerId = removeHyphens(Config.loginCustomerId); + if (subAccount) + if (loginCustomerId) { + const filteredLoginCustomerId = removeHyphens(loginCustomerId); response.headers['login-customer-id'] = filteredLoginCustomerId; } else throw new ConfigurationError(`LoginCustomerId is required as subAccount is true.`); diff --git a/src/v0/util/index.js b/src/v0/util/index.js index ca81262f88..f034ab802b 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -26,6 +26,7 @@ const { } = require('@rudderstack/integrations-lib'); const { JsonTemplateEngine, PathType } = require('@rudderstack/json-template-engine'); +const isString = require('lodash/isString'); const logger = require('../../logger'); const stats = require('../../util/stats'); const { DestCanonicalNames, DestHandlerMap } = require('../../constants/destinationCanonicalNames'); @@ -1622,7 +1623,7 @@ function isHttpStatusRetryable(status) { function generateUUID() { return crypto.randomUUID({ disableEntropyCache: true, - }); /* using disableEntropyCache as true to not cache the generated uuids. + }); /* using disableEntropyCache as true to not cache the generated uuids. For more Info https://nodejs.org/api/crypto.html#cryptorandomuuidoptions:~:text=options%20%3CObject%3E-,disableEntropyCache,-%3Cboolean%3E%20By */ } @@ -1646,6 +1647,9 @@ function isAppleFamily(platform) { } function removeHyphens(str) { + if (!isString(str)) { + return str; + } return str.replace(/-/g, ''); } diff --git a/src/v0/util/index.test.js b/src/v0/util/index.test.js index 6bf689eca7..eaf8b79d54 100644 --- a/src/v0/util/index.test.js +++ b/src/v0/util/index.test.js @@ -10,6 +10,7 @@ const { validateEventAndLowerCaseConversion, groupRouterTransformEvents, isAxiosError, + removeHyphens, } = require('./index'); const exp = require('constants'); @@ -968,3 +969,18 @@ describe('isAxiosError', () => { expect(isAxiosError(error)).toBe(false); }); }); + +describe('removeHyphens', () => { + const data = [ + { input: 'hello-w--orld', expected: 'helloworld' }, + { input: '', expected: '' }, + { input: null, expected: null }, + { input: undefined, expected: undefined }, + { input: 12345, expected: 12345 }, + ]; + it('should remove hyphens from string else return the input as it is', () => { + data.forEach(({ input, expected }) => { + expect(removeHyphens(input)).toBe(expected); + }); + }); +}); diff --git a/test/integrations/destinations/google_adwords_enhanced_conversions/router/data.ts b/test/integrations/destinations/google_adwords_enhanced_conversions/router/data.ts index 1d77b5d774..89ce06818b 100644 --- a/test/integrations/destinations/google_adwords_enhanced_conversions/router/data.ts +++ b/test/integrations/destinations/google_adwords_enhanced_conversions/router/data.ts @@ -225,6 +225,194 @@ const events = [ sentAt: '2019-10-14T11:15:53.296Z', }, }, + { + metadata: { + secret: { + access_token: 'abcd1234', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 4, + userId: 'u1', + }, + destination: { + Config: { + rudderAccountId: '25u5whFH7gVTnCiAjn4ykoCLGoC', + customerId: '{{event.context.customerID || "" }}', + subAccount: true, + loginCustomerId: '{{event.context.subaccountID || "" }}', + listOfConversions: [{ conversions: 'Page View' }, { conversions: 'Product Added' }], + authStatus: 'active', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + phone: '912382193', + firstName: 'John', + lastName: 'Gomes', + city: 'London', + state: 'UK', + streetAddress: '71 Cherry Court SOUTHAMPTON SO53 5PD UK', + }, + library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { name: '', version: '' }, + screen: { density: 2 }, + customerID: 1234567890, + subaccountID: 11, + }, + event: 'Page View', + type: 'track', + messageId: '5e10d13a-bf9a-44bf-b884-43a9e591ea71', + originalTimestamp: '2019-10-14T11:15:18.299Z', + anonymousId: '00000000000000000000000000', + userId: '12345', + properties: { + gclid: 'gclid1234', + conversionDateTime: '2022-01-01 12:32:45-08:00', + adjustedValue: '10', + currency: 'INR', + adjustmentDateTime: '2022-01-01 12:32:45-08:00', + partialFailure: true, + campaignId: '1', + templateId: '0', + order_id: 10000, + total: 1000, + products: [ + { + product_id: '507f1f77bcf86cd799439011', + sku: '45790-32', + name: 'Monopoly: 3rd Edition', + price: '19', + position: '1', + category: 'cars', + url: 'https://www.example.com/product/path', + image_url: 'https://www.example.com/product/path.jpg', + quantity: '2', + }, + { + product_id: '507f1f77bcf86cd7994390112', + sku: '45790-322', + name: 'Monopoly: 3rd Edition2', + price: '192', + quantity: 22, + position: '12', + category: 'Cars2', + url: 'https://www.example.com/product/path2', + image_url: 'https://www.example.com/product/path.jpg2', + }, + ], + }, + integrations: { All: true }, + name: 'ApplicationLoaded', + sentAt: '2019-10-14T11:15:53.296Z', + }, + }, + { + metadata: { + secret: { + access_token: 'abcd1234', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 5, + userId: 'u1', + }, + destination: { + Config: { + rudderAccountId: '25u5whFH7gVTnCiAjn4ykoCLGoC', + customerId: '{{event.context.customerID || "" }}', + subAccount: true, + loginCustomerId: '{{event.context.subaccountID || "" }}', + listOfConversions: [{ conversions: 'Page View' }, { conversions: 'Product Added' }], + authStatus: 'active', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + phone: '912382193', + firstName: 'John', + lastName: 'Gomes', + city: 'London', + state: 'UK', + streetAddress: '71 Cherry Court SOUTHAMPTON SO53 5PD UK', + }, + library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { name: '', version: '' }, + screen: { density: 2 }, + customerID: {}, + subaccountID: 11, + }, + event: 'Page View', + type: 'track', + messageId: '5e10d13a-bf9a-44bf-b884-43a9e591ea71', + originalTimestamp: '2019-10-14T11:15:18.299Z', + anonymousId: '00000000000000000000000000', + userId: '12345', + properties: { + gclid: 'gclid1234', + conversionDateTime: '2022-01-01 12:32:45-08:00', + adjustedValue: '10', + currency: 'INR', + adjustmentDateTime: '2022-01-01 12:32:45-08:00', + partialFailure: true, + campaignId: '1', + templateId: '0', + order_id: 10000, + total: 1000, + products: [ + { + product_id: '507f1f77bcf86cd799439011', + sku: '45790-32', + name: 'Monopoly: 3rd Edition', + price: '19', + position: '1', + category: 'cars', + url: 'https://www.example.com/product/path', + image_url: 'https://www.example.com/product/path.jpg', + quantity: '2', + }, + { + product_id: '507f1f77bcf86cd7994390112', + sku: '45790-322', + name: 'Monopoly: 3rd Edition2', + price: '192', + quantity: 22, + position: '12', + category: 'Cars2', + url: 'https://www.example.com/product/path2', + image_url: 'https://www.example.com/product/path.jpg2', + }, + ], + }, + integrations: { All: true }, + name: 'ApplicationLoaded', + sentAt: '2019-10-14T11:15:53.296Z', + }, + }, ]; const invalidRtTfCases = [ @@ -500,6 +688,125 @@ export const data = [ module: 'destination', }, }, + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: `https://googleads.googleapis.com/${API_VERSION}/customers/1234567890:uploadConversionAdjustments`, + headers: { + Authorization: 'Bearer abcd1234', + 'Content-Type': 'application/json', + 'developer-token': 'ijkl91011', + 'login-customer-id': '11', + }, + params: { event: 'Page View', customerId: '1234567890' }, + body: { + JSON: { + partialFailure: true, + conversionAdjustments: [ + { + gclidDateTimePair: { + gclid: 'gclid1234', + conversionDateTime: '2022-01-01 12:32:45-08:00', + }, + restatementValue: { adjustedValue: 10, currencyCode: 'INR' }, + orderId: '10000', + adjustmentDateTime: '2022-01-01 12:32:45-08:00', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + userIdentifiers: [ + { + hashedPhoneNumber: + '04387707e6cbed8c4538c81cc570ed9252d579469f36c273839b26d784e4bdbe', + }, + { + addressInfo: { + hashedFirstName: + 'a8cfcd74832004951b4408cdb0a5dbcd8c7e52d43f7fe244bf720582e05241da', + hashedLastName: + '1c574b17eefa532b6d61c963550a82d2d3dfca4a7fb69e183374cfafd5328ee4', + state: 'UK', + city: 'London', + hashedStreetAddress: + '9a4d2e50828448f137f119a3ebdbbbab8d6731234a67595fdbfeb2a2315dd550', + }, + }, + ], + adjustmentType: 'ENHANCEMENT', + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + secret: { + access_token: 'abcd1234', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 4, + userId: 'u1', + }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + rudderAccountId: '25u5whFH7gVTnCiAjn4ykoCLGoC', + customerId: 1234567890, + subAccount: true, + loginCustomerId: 11, + listOfConversions: [ + { conversions: 'Page View' }, + { conversions: 'Product Added' }, + ], + authStatus: 'active', + }, + }, + }, + { + batched: false, + statusCode: 400, + error: 'customerId and loginCustomerId should be a string or number', + statTags: { + destType: 'GOOGLE_ADWORDS_ENHANCED_CONVERSIONS', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + metadata: [ + { + secret: { + access_token: 'abcd1234', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 5, + userId: 'u1', + }, + ], + destination: { + Config: { + rudderAccountId: '25u5whFH7gVTnCiAjn4ykoCLGoC', + customerId: {}, + subAccount: true, + loginCustomerId: 11, + listOfConversions: [ + { conversions: 'Page View' }, + { conversions: 'Product Added' }, + ], + authStatus: 'active', + }, + }, + }, ], }, }, From 3a091810bff12ae893c16b514c07d17e6374062a Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:40:46 +0530 Subject: [PATCH 15/21] feat: add support for identity stitching for shopify pixel flow (#3818) --- src/util/prometheus.js | 18 +++ src/v0/sources/shopify/util.js | 4 +- src/v1/sources/shopify/config.js | 13 ++ src/v1/sources/shopify/pixelTransform.js | 69 ++++++++++- .../pixelTransform.redisCartToken.test.js | 116 ++++++++++++++++++ 5 files changed, 217 insertions(+), 3 deletions(-) create mode 100644 src/v1/sources/shopify/pixelTransform.redisCartToken.test.js diff --git a/src/util/prometheus.js b/src/util/prometheus.js index 27747faf4b..c8dd55068b 100644 --- a/src/util/prometheus.js +++ b/src/util/prometheus.js @@ -439,6 +439,24 @@ class Prometheus { type: 'counter', labelNames: ['writeKey', 'source', 'shopifyTopic'], }, + { + name: 'shopify_pixel_cart_token_not_found', + help: 'shopify_pixel_cart_token_not_found', + type: 'counter', + labelNames: ['event', 'writeKey'], + }, + { + name: 'shopify_pixel_cart_token_set', + help: 'shopify_pixel_cart_token_set', + type: 'counter', + labelNames: ['event', 'writeKey'], + }, + { + name: 'shopify_pixel_cart_token_redis_error', + help: 'shopify_pixel_cart_token_redis_error', + type: 'counter', + labelNames: ['event', 'writeKey'], + }, { name: 'outgoing_request_count', help: 'Outgoing HTTP requests count', diff --git a/src/v0/sources/shopify/util.js b/src/v0/sources/shopify/util.js index 6d13d13bdf..981832363e 100644 --- a/src/v0/sources/shopify/util.js +++ b/src/v0/sources/shopify/util.js @@ -124,11 +124,11 @@ const extractEmailFromPayload = (event) => { }; const getCartToken = (message) => { - const { event, properties } = message; + const { event, properties, context } = message; if (event === SHOPIFY_TRACK_MAP.carts_update) { return properties?.id || properties?.token; } - return properties?.cart_token || null; + return properties?.cart_token || context?.cart_token || null; }; /** diff --git a/src/v1/sources/shopify/config.js b/src/v1/sources/shopify/config.js index 5a3ce99b40..57e7e168a1 100644 --- a/src/v1/sources/shopify/config.js +++ b/src/v1/sources/shopify/config.js @@ -1,6 +1,8 @@ const path = require('path'); const fs = require('fs'); +const commonCartTokenLocation = 'context.document.location.pathname'; + const PIXEL_EVENT_TOPICS = { CART_VIEWED: 'cart_viewed', PRODUCT_ADDED_TO_CART: 'product_added_to_cart', @@ -61,6 +63,16 @@ const checkoutStartedCompletedEventMappingJSON = JSON.parse( ), ); +const pixelEventToCartTokenLocationMapping = { + cart_viewed: 'properties.cart_id', + checkout_address_info_submitted: commonCartTokenLocation, + checkout_contact_info_submitted: commonCartTokenLocation, + checkout_shipping_info_submitted: commonCartTokenLocation, + payment_info_submitted: commonCartTokenLocation, + checkout_started: commonCartTokenLocation, + checkout_completed: commonCartTokenLocation, +}; + const INTEGERATION = 'SHOPIFY'; module.exports = { @@ -73,4 +85,5 @@ module.exports = { productViewedEventMappingJSON, productToCartEventMappingJSON, checkoutStartedCompletedEventMappingJSON, + pixelEventToCartTokenLocationMapping, }; diff --git a/src/v1/sources/shopify/pixelTransform.js b/src/v1/sources/shopify/pixelTransform.js index a19d431757..e308f626b4 100644 --- a/src/v1/sources/shopify/pixelTransform.js +++ b/src/v1/sources/shopify/pixelTransform.js @@ -1,6 +1,11 @@ +/* eslint-disable no-param-reassign */ +// eslint-disable-next-line @typescript-eslint/naming-convention +const _ = require('lodash'); +const { isDefinedNotNullNotEmpty } = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const logger = require('../../../logger'); const { removeUndefinedAndNullValues } = require('../../../v0/util'); +const { RedisDB } = require('../../../util/redis/redisConnector'); const { pageViewedEventBuilder, cartViewedEventBuilder, @@ -11,7 +16,11 @@ const { checkoutStepEventBuilder, searchEventBuilder, } = require('./pixelUtils'); -const { INTEGERATION, PIXEL_EVENT_TOPICS } = require('./config'); +const { + INTEGERATION, + PIXEL_EVENT_TOPICS, + pixelEventToCartTokenLocationMapping, +} = require('./config'); const NO_OPERATION_SUCCESS = { outputToSource: { @@ -21,6 +30,59 @@ const NO_OPERATION_SUCCESS = { statusCode: 200, }; +/** + * Parses and extracts cart token value from the input event + * @param {Object} inputEvent + * @returns {String} cartToken + */ +function extractCartToken(inputEvent) { + const cartTokenLocation = pixelEventToCartTokenLocationMapping[inputEvent.name]; + if (!cartTokenLocation) { + stats.increment('shopify_pixel_cart_token_not_found', { + event: inputEvent.name, + writeKey: inputEvent.query_parameters.writeKey, + }); + return undefined; + } + // the unparsedCartToken is a string like '/checkout/cn/1234' + const unparsedCartToken = _.get(inputEvent, cartTokenLocation); + if (typeof unparsedCartToken !== 'string') { + logger.error(`Cart token is not a string`); + stats.increment('shopify_pixel_cart_token_not_found', { + event: inputEvent.name, + writeKey: inputEvent.query_parameters.writeKey, + }); + return undefined; + } + const cartTokenParts = unparsedCartToken.split('/'); + const cartToken = cartTokenParts[3]; + return cartToken; +} + +/** + * Handles storing cart token and anonymousId (clientId) in Redis + * @param {Object} inputEvent + * @param {String} clientId + */ +const handleCartTokenRedisOperations = async (inputEvent, clientId) => { + const cartToken = extractCartToken(inputEvent); + try { + if (isDefinedNotNullNotEmpty(clientId) && isDefinedNotNullNotEmpty(cartToken)) { + await RedisDB.setVal(cartToken, ['anonymousId', clientId]); + stats.increment('shopify_pixel_cart_token_set', { + event: inputEvent.name, + writeKey: inputEvent.query_parameters.writeKey, + }); + } + } catch (error) { + logger.error(`Error handling Redis operations for event: ${inputEvent.name}`, error); + stats.increment('shopify_pixel_cart_token_redis_error', { + event: inputEvent.name, + writeKey: inputEvent.query_parameters.writeKey, + }); + } +}; + function processPixelEvent(inputEvent) { // eslint-disable-next-line @typescript-eslint/naming-convention const { name, query_parameters, clientId, data, id } = inputEvent; @@ -37,6 +99,7 @@ function processPixelEvent(inputEvent) { message = pageViewedEventBuilder(inputEvent); break; case PIXEL_EVENT_TOPICS.CART_VIEWED: + handleCartTokenRedisOperations(inputEvent, clientId); message = cartViewedEventBuilder(inputEvent); break; case PIXEL_EVENT_TOPICS.COLLECTION_VIEWED: @@ -52,6 +115,7 @@ function processPixelEvent(inputEvent) { case PIXEL_EVENT_TOPICS.CHECKOUT_STARTED: case PIXEL_EVENT_TOPICS.CHECKOUT_COMPLETED: if (customer.id) message.userId = customer.id || ''; + handleCartTokenRedisOperations(inputEvent, clientId); message = checkoutEventBuilder(inputEvent); break; case PIXEL_EVENT_TOPICS.CHECKOUT_ADDRESS_INFO_SUBMITTED: @@ -59,6 +123,7 @@ function processPixelEvent(inputEvent) { case PIXEL_EVENT_TOPICS.CHECKOUT_SHIPPING_INFO_SUBMITTED: case PIXEL_EVENT_TOPICS.PAYMENT_INFO_SUBMITTED: if (customer.id) message.userId = customer.id || ''; + handleCartTokenRedisOperations(inputEvent, clientId); message = checkoutStepEventBuilder(inputEvent); break; case PIXEL_EVENT_TOPICS.SEARCH_SUBMITTED: @@ -94,4 +159,6 @@ const processEventFromPixel = async (event) => { module.exports = { processEventFromPixel, + handleCartTokenRedisOperations, + extractCartToken, }; diff --git a/src/v1/sources/shopify/pixelTransform.redisCartToken.test.js b/src/v1/sources/shopify/pixelTransform.redisCartToken.test.js new file mode 100644 index 0000000000..8f54efc373 --- /dev/null +++ b/src/v1/sources/shopify/pixelTransform.redisCartToken.test.js @@ -0,0 +1,116 @@ +const { extractCartToken, handleCartTokenRedisOperations } = require('./pixelTransform'); +const { RedisDB } = require('../../../util/redis/redisConnector'); +const stats = require('../../../util/stats'); +const logger = require('../../../logger'); +const { pixelEventToCartTokenLocationMapping } = require('./config'); + +jest.mock('../../../util/redis/redisConnector', () => ({ + RedisDB: { + setVal: jest.fn(), + }, +})); + +jest.mock('../../../util/stats', () => ({ + increment: jest.fn(), +})); + +jest.mock('../../../logger', () => ({ + info: jest.fn(), + error: jest.fn(), +})); + +jest.mock('./config', () => ({ + pixelEventToCartTokenLocationMapping: { cart_viewed: 'properties.cart_id' }, +})); + +describe('extractCartToken', () => { + it('should return undefined if cart token location is not found', () => { + const inputEvent = { name: 'unknownEvent', query_parameters: { writeKey: 'testWriteKey' } }; + + const result = extractCartToken(inputEvent); + + expect(result).toBeUndefined(); + expect(stats.increment).toHaveBeenCalledWith('shopify_pixel_cart_token_not_found', { + event: 'unknownEvent', + writeKey: 'testWriteKey', + }); + }); + + it('should return undefined if cart token is not a string', () => { + const inputEvent = { + name: 'cart_viewed', + properties: { cart_id: 12345 }, + query_parameters: { writeKey: 'testWriteKey' }, + }; + + const result = extractCartToken(inputEvent); + + expect(result).toBeUndefined(); + expect(logger.error).toHaveBeenCalledWith('Cart token is not a string'); + expect(stats.increment).toHaveBeenCalledWith('shopify_pixel_cart_token_not_found', { + event: 'cart_viewed', + writeKey: 'testWriteKey', + }); + }); + + it('should return the cart token if it is a valid string', () => { + const inputEvent = { + name: 'cart_viewed', + properties: { cart_id: '/checkout/cn/1234' }, + query_parameters: { writeKey: 'testWriteKey' }, + }; + + const result = extractCartToken(inputEvent); + + expect(result).toBe('1234'); + }); +}); + +describe('handleCartTokenRedisOperations', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + it('should handle undefined or null cart token gracefully', async () => { + const inputEvent = { + name: 'unknownEvent', + query_parameters: { + writeKey: 'testWriteKey', + }, + }; + const clientId = 'testClientId'; + + await handleCartTokenRedisOperations(inputEvent, clientId); + + expect(stats.increment).toHaveBeenCalledWith('shopify_pixel_cart_token_not_found', { + event: 'unknownEvent', + writeKey: 'testWriteKey', + }); + }); + + it('should log error and increment stats when exception occurs', async () => { + const inputEvent = { + name: 'cart_viewed', + properties: { + cart_id: '/checkout/cn/1234', + }, + query_parameters: { + writeKey: 'testWriteKey', + }, + }; + const clientId = 'testClientId'; + const error = new Error('Redis error'); + RedisDB.setVal.mockRejectedValue(error); + + await handleCartTokenRedisOperations(inputEvent, clientId); + + expect(logger.error).toHaveBeenCalledWith( + 'Error handling Redis operations for event: cart_viewed', + error, + ); + expect(stats.increment).toHaveBeenCalledWith('shopify_pixel_cart_token_redis_error', { + event: 'cart_viewed', + writeKey: 'testWriteKey', + }); + }); +}); From dc5d3cf0a625478a98667e2feca40d52e57a6cdb Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 25 Oct 2024 10:06:09 +0000 Subject: [PATCH 16/21] chore(release): 1.83.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4d972f67c..bcfd6f2835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.83.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.82.2...v1.83.0) (2024-10-25) + + +### Features + +* add support for identity stitching for shopify pixel flow ([#3818](https://github.com/rudderlabs/rudder-transformer/issues/3818)) ([3a09181](https://github.com/rudderlabs/rudder-transformer/commit/3a091810bff12ae893c16b514c07d17e6374062a)) +* onboard tune destination ([#3795](https://github.com/rudderlabs/rudder-transformer/issues/3795)) ([741f0c6](https://github.com/rudderlabs/rudder-transformer/commit/741f0c6d6714cf760ce98cc9354b61f7b5ce4684)) +* snowpipe streaming ([#3740](https://github.com/rudderlabs/rudder-transformer/issues/3740)) ([21b1039](https://github.com/rudderlabs/rudder-transformer/commit/21b1039c26067b4896a15adf8b10a044e69cb495)) +* support for multiple zap urls ([#3825](https://github.com/rudderlabs/rudder-transformer/issues/3825)) ([f79dfe7](https://github.com/rudderlabs/rudder-transformer/commit/f79dfe74b447b8ccd80287e143ff771688c510be)) + + +### Bug Fixes + +* add missing field for pinterest_tag single product events ([f781a84](https://github.com/rudderlabs/rudder-transformer/commit/f781a84ade98649d68cebf4da13c2ceff8df2df2)) +* add missing field for pinterest_tag single product events ([#3826](https://github.com/rudderlabs/rudder-transformer/issues/3826)) ([4a63277](https://github.com/rudderlabs/rudder-transformer/commit/4a63277efd0b4357d8321618640d1a0ba2a47d71)) +* heap userId extraction ([#3801](https://github.com/rudderlabs/rudder-transformer/issues/3801)) ([e578413](https://github.com/rudderlabs/rudder-transformer/commit/e57841396ad666d716e195fbd4e9b74a63bf5191)) +* not allowing empty string or null values for mandatory fields in zoho ([#3800](https://github.com/rudderlabs/rudder-transformer/issues/3800)) ([fcd8d99](https://github.com/rudderlabs/rudder-transformer/commit/fcd8d997fe815d61d21ffff235b0799e69b7ded9)) +* populate source destination info env set properly ([#3806](https://github.com/rudderlabs/rudder-transformer/issues/3806)) ([d730daf](https://github.com/rudderlabs/rudder-transformer/commit/d730dafbbd2de30b67c35db8ca05396a98a8d2e0)) +* str replace is not a function error ([#3799](https://github.com/rudderlabs/rudder-transformer/issues/3799)) ([8f18e1a](https://github.com/rudderlabs/rudder-transformer/commit/8f18e1aca70ab68e3f157a4632d63ae7cec0e87b)) +* update order_id in checkout events, messageId in pixel events ([#3794](https://github.com/rudderlabs/rudder-transformer/issues/3794)) ([427be71](https://github.com/rudderlabs/rudder-transformer/commit/427be71a91df8495f81b42d2b58aa490db439b23)) + ### [1.82.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.82.1...v1.82.2) (2024-10-18) diff --git a/package-lock.json b/package-lock.json index 77cc67cc72..ccf7ed2c2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.82.2", + "version": "1.83.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.82.2", + "version": "1.83.0", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "0.7.24", diff --git a/package.json b/package.json index f87249e77c..79571462d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.82.2", + "version": "1.83.0", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": { From e9c5a755e6ff2d46aafcc3c6117871c42d750ace Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:14:39 +0530 Subject: [PATCH 17/21] chore: allow only mapped in properties, update event name (#3830) * chore: allow only mapped in properties, update event name * chore: remove redundant checks * chore: add jsdoc descriptions * chore: address comments --- src/v1/sources/shopify/config.js | 2 +- src/v1/sources/shopify/pixelUtils.js | 58 +- src/v1/sources/shopify/pixelUtils.test.js | 636 ++++++++++++++++-- .../pixelTestScenarios/CheckoutEventsTests.ts | 29 +- .../pixelTestScenarios/ProductEventsTests.ts | 150 ----- 5 files changed, 631 insertions(+), 244 deletions(-) diff --git a/src/v1/sources/shopify/config.js b/src/v1/sources/shopify/config.js index 57e7e168a1..5d88353d60 100644 --- a/src/v1/sources/shopify/config.js +++ b/src/v1/sources/shopify/config.js @@ -27,7 +27,7 @@ const PIXEL_EVENT_MAPPING = { product_viewed: 'Product Viewed', collection_viewed: 'Collection Viewed', checkout_started: 'Checkout Started', - checkout_completed: 'Checkout Completed', + checkout_completed: 'Order Completed', checkout_address_info_submitted: 'Checkout Address Info Submitted', checkout_contact_info_submitted: 'Checkout Contact Info Submitted', checkout_shipping_info_submitted: 'Checkout Shipping Info Submitted', diff --git a/src/v1/sources/shopify/pixelUtils.js b/src/v1/sources/shopify/pixelUtils.js index 4c39e80549..9abef5c2f8 100644 --- a/src/v1/sources/shopify/pixelUtils.js +++ b/src/v1/sources/shopify/pixelUtils.js @@ -30,10 +30,14 @@ function setNestedValue(object, path, value) { }, object); } -function mapObjectKeys(sourceObject, keyMappings) { - if (!Array.isArray(keyMappings)) { - throw new TypeError('keyMappings should be an array'); - } +/* + * Creates a copy of the source object with the keys mapped to the destination keys + * Keys that are not present in the mapping will be copied as is + * @param {Object} sourceObject + * @param {Array} keyMappings + * @returns {Object} resultObject + */ +function mapContextObjectKeys(sourceObject, keyMappings) { const resultObject = { ...sourceObject }; // eslint-disable-next-line @typescript-eslint/no-shadow @@ -46,10 +50,31 @@ function mapObjectKeys(sourceObject, keyMappings) { }, resultObject); } +/* + * Maps the keys of the source object to the destination object + * Only the keys that are present in the mapping will be copied + * @param {Object} sourceObject + * @param {Array} keyMappings + * @returns {Object} trackProperties + */ +function mapObjectKeys(sourceObject, keyMappings) { + const trackProperties = {}; + + keyMappings.forEach(({ sourceKeys, destKeys }) => { + const value = getNestedValue(sourceObject, sourceKeys); + if (value !== undefined) { + setNestedValue(trackProperties, destKeys, value); + } + }); + + return trackProperties; +} + const createMessage = (eventType, eventName, properties, context) => { const message = new Message(INTEGERATION); message.setEventType(eventType); - message.setEventName(eventName); + if (eventType === EventType.TRACK) message.setEventName(eventName); + else message.name = eventName; message.properties = properties; message.context = context; return message; @@ -57,13 +82,8 @@ const createMessage = (eventType, eventName, properties, context) => { const pageViewedEventBuilder = (inputEvent) => { const { data, context } = inputEvent; - const pageEventContextValues = mapObjectKeys(context, contextualFieldMappingJSON); - const message = new Message(INTEGERATION); - message.name = 'Page View'; - message.setEventType(EventType.PAGE); - message.properties = { ...data }; - message.context = { ...pageEventContextValues }; - return message; + const pageEventContextValues = mapContextObjectKeys(context, contextualFieldMappingJSON); + return createMessage(EventType.PAGE, 'Page View', { ...data }, pageEventContextValues); }; const cartViewedEventBuilder = (inputEvent) => { @@ -83,7 +103,7 @@ const cartViewedEventBuilder = (inputEvent) => { cart_id: inputEvent.data.cart.id, total, }; - const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON); + const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON); return createMessage(EventType.TRACK, 'Cart Viewed', properties, contextualPayload); }; @@ -102,7 +122,7 @@ const productListViewedEventBuilder = (inputEvent) => { products, }; - const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON); + const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON); return createMessage(EventType.TRACK, 'Product List Viewed', properties, contextualPayload); }; @@ -110,7 +130,7 @@ const productViewedEventBuilder = (inputEvent) => { const properties = { ...mapObjectKeys(inputEvent.data, productViewedEventMappingJSON), }; - const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON); + const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON); return createMessage(EventType.TRACK, 'Product Viewed', properties, contextualPayload); }; @@ -118,7 +138,7 @@ const productToCartEventBuilder = (inputEvent) => { const properties = { ...mapObjectKeys(inputEvent.data, productToCartEventMappingJSON), }; - const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON); + const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON); return createMessage( EventType.TRACK, PIXEL_EVENT_MAPPING[inputEvent.name], @@ -148,7 +168,7 @@ const checkoutEventBuilder = (inputEvent) => { value: inputEvent?.data?.checkout?.totalPrice?.amount, tax: inputEvent?.data?.checkout?.totalTax?.amount, }; - const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON); + const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON); return createMessage( EventType.TRACK, PIXEL_EVENT_MAPPING[inputEvent.name], @@ -158,7 +178,7 @@ const checkoutEventBuilder = (inputEvent) => { }; const checkoutStepEventBuilder = (inputEvent) => { - const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON); + const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON); const properties = { ...inputEvent.data.checkout, }; @@ -174,7 +194,7 @@ const searchEventBuilder = (inputEvent) => { const properties = { query: inputEvent.data.searchResult.query, }; - const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON); + const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON); return createMessage( EventType.TRACK, PIXEL_EVENT_MAPPING[inputEvent.name], diff --git a/src/v1/sources/shopify/pixelUtils.test.js b/src/v1/sources/shopify/pixelUtils.test.js index ed64862228..4bff8eada4 100644 --- a/src/v1/sources/shopify/pixelUtils.test.js +++ b/src/v1/sources/shopify/pixelUtils.test.js @@ -82,21 +82,6 @@ describe('utilV2.js', () => { price: 629.95, quantity: 2, variant: 'The Multi-managed Snowboard', - merchandise: { - id: '41327143157873', - price: { - amount: 629.95, - currencyCode: 'USD', - }, - product: { - title: 'The Multi-managed Snowboard', - }, - title: 'Default Title', - untranslatedTitle: 'Default Title', - }, - cost: { - totalAmount: { amount: 1259.9, currencyCode: 'USD' }, - }, }, ], cart_id: '123', @@ -112,8 +97,27 @@ describe('utilV2.js', () => { data: { collection: { productVariants: [ - { id: 'product123', name: 'Product 123' }, - { id: 'product456', name: 'Product 456' }, + { + price: { + amount: 10, + currencyCode: 'USD', + }, + product: { + title: 'Gift Card', + vendor: 'Snowboard Vendor', + id: '7234590605425', + untranslatedTitle: 'Gift Card', + url: '/products/gift-card', + type: 'giftcard', + }, + id: '41327142895729', + image: { + src: '//store.myshopify.com/cdn/shop/files/gift_card.png?v=1724736596', + }, + sku: '', + title: '$10', + untranslatedTitle: '$10', + }, ], }, }, @@ -127,8 +131,17 @@ describe('utilV2.js', () => { cart_id: 'client123', list_id: 'list123', products: [ - { id: 'product123', name: 'Product 123' }, - { id: 'product456', name: 'Product 456' }, + { + brand: 'Snowboard Vendor', + category: 'giftcard', + image_url: '//store.myshopify.com/cdn/shop/files/gift_card.png?v=1724736596', + name: '$10', + price: 10, + product_id: '7234590605425', + sku: '', + url: '/products/gift-card', + variant: 'Gift Card', + }, ], }); expect(message.context).toEqual({ userAgent: 'Mozilla/5.0' }); @@ -138,12 +151,43 @@ describe('utilV2.js', () => { describe('productViewedEventBuilder', () => { it('should build a product viewed event message', () => { const inputEvent = { - data: { id: 'product123', name: 'Product 123' }, + data: { + productVariant: { + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + title: 'The Collection Snowboard: Liquid', + vendor: 'Hydrogen Vendor', + id: '7234590834801', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + type: 'snowboard', + }, + id: '41327143321713', + image: { + src: '//store.myshopify.com/cdn/shop/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', + }, + sku: '', + title: 'Default Title', + untranslatedTitle: 'Default Title', + }, + }, context: { userAgent: 'Mozilla/5.0' }, }; const message = productViewedEventBuilder(inputEvent); expect(message).toBeInstanceOf(Message); - expect(message.properties).toEqual({ id: 'product123', name: 'Product 123' }); + expect(message.properties).toEqual({ + brand: 'Hydrogen Vendor', + category: 'snowboard', + currency: 'USD', + name: 'The Collection Snowboard: Liquid', + price: 749.95, + product_id: '7234590834801', + url: '/products/the-collection-snowboard-liquid', + variant: 'The Collection Snowboard: Liquid', + }); expect(message.context).toEqual({ userAgent: 'Mozilla/5.0' }); }); }); @@ -151,13 +195,56 @@ describe('utilV2.js', () => { describe('productToCartEventBuilder', () => { it('should build a product to cart event message', () => { const inputEvent = { - data: { id: 'product123', name: 'Product 123' }, + data: { + cartLine: { + cost: { + totalAmount: { + amount: 749.95, + currencyCode: 'USD', + }, + }, + merchandise: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + vendor: 'Hydrogen Vendor', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid?variant=41327143321713', + }, + sku: '', + title: null, + untranslatedTitle: null, + }, + quantity: 1, + }, + }, context: { userAgent: 'Mozilla/5.0' }, name: 'add_to_cart', }; const message = productToCartEventBuilder(inputEvent); expect(message).toBeInstanceOf(Message); - expect(message.properties).toEqual({ id: 'product123', name: 'Product 123' }); + expect(message.properties).toEqual({ + brand: 'Hydrogen Vendor', + category: 'snowboard', + image_url: + 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', + name: null, + price: 749.95, + product_id: '7234590834801', + quantity: 1, + sku: '', + url: '/products/the-collection-snowboard-liquid?variant=41327143321713', + variant: 'The Collection Snowboard: Liquid', + }); expect(message.context).toEqual({ userAgent: 'Mozilla/5.0' }); }); }); @@ -167,20 +254,128 @@ describe('utilV2.js', () => { const inputEvent = { data: { checkout: { + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + attributes: [], + token: '5f7028e0bd5225c17b24bdaa0c09f914', + currencyCode: 'USD', + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: '', + phone: '', lineItems: [ - { id: 'product123', name: 'Product 123' }, - { id: 'product456', name: 'Product 456' }, + { + discountAllocations: [], + id: '41327143321713', + quantity: 2, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + vendor: 'Hydrogen Vendor', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + sellingPlanAllocation: null, + properties: [], + }, + { + discountAllocations: [], + id: '41327143157873', + quantity: 2, + title: 'The Multi-managed Snowboard', + variant: { + id: '41327143157873', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + vendor: 'Multi-managed Vendor', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + }, + sku: 'sku-managed-1', + title: null, + untranslatedTitle: null, + }, + finalLinePrice: { + amount: 1259.9, + currencyCode: 'USD', + }, + sellingPlanAllocation: null, + properties: [], + }, ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + id: 'gid://shopify/Market/23505895537', + handle: 'us', + }, + }, order: { - id: 'order123', + id: null, + customer: { + id: null, + isFirstOrder: null, + }, }, - token: 'checkout123', - totalPrice: { amount: 200 }, - currencyCode: 'USD', - discountsAmount: { amount: 10 }, - shippingLine: { price: { amount: 5 } }, - subtotalPrice: { amount: 185 }, - totalTax: { amount: 15 }, + delivery: { + selectedDeliveryOptions: [], + }, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + transactions: [], }, }, id: 'order123', @@ -191,18 +386,42 @@ describe('utilV2.js', () => { expect(message).toBeInstanceOf(Message); expect(message.properties).toEqual({ products: [ - { id: 'product123', name: 'Product 123' }, - { id: 'product456', name: 'Product 456' }, + { + brand: 'Hydrogen Vendor', + category: 'snowboard', + image_url: + 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + name: 'The Collection Snowboard: Liquid', + price: 749.95, + product_id: '7234590834801', + quantity: 2, + sku: null, + url: '/products/the-collection-snowboard-liquid', + variant: 'The Collection Snowboard: Liquid', + }, + { + brand: 'Multi-managed Vendor', + category: 'snowboard', + image_url: + 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + name: 'The Multi-managed Snowboard', + price: 629.95, + product_id: '7234590736497', + quantity: 2, + sku: 'sku-managed-1', + url: '/products/the-multi-managed-snowboard', + variant: 'The Multi-managed Snowboard', + }, ], - order_id: 'order123', - checkout_id: 'checkout123', - total: 200, + order_id: null, + checkout_id: '5f7028e0bd5225c17b24bdaa0c09f914', + total: 2759.8, currency: 'USD', - discount: 10, - shipping: 5, - revenue: 185, - value: 200, - tax: 15, + discount: 0, + shipping: 0, + revenue: 2759.8, + value: 2759.8, + tax: 0, }); expect(message.context).toEqual({ userAgent: 'Mozilla/5.0' }); }); @@ -213,8 +432,169 @@ describe('utilV2.js', () => { const inputEvent = { data: { checkout: { - step: 1, - action: 'shipping_info_submitted', + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + attributes: [], + billingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + token: '5f7028e0bd5225c17b24bdaa0c09f914', + currencyCode: 'USD', + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: 'test-user@sampleemail.com', + phone: '', + lineItems: [ + { + discountAllocations: [], + id: '41327143321713', + quantity: 2, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + vendor: 'Hydrogen Vendor', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + sellingPlanAllocation: null, + properties: [], + }, + { + discountAllocations: [], + id: '41327143157873', + quantity: 2, + title: 'The Multi-managed Snowboard', + variant: { + id: '41327143157873', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + vendor: 'Multi-managed Vendor', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + }, + sku: 'sku-managed-1', + title: null, + untranslatedTitle: null, + }, + finalLinePrice: { + amount: 1259.9, + currencyCode: 'USD', + }, + sellingPlanAllocation: null, + properties: [], + }, + ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + id: 'gid://shopify/Market/23505895537', + handle: 'us', + }, + }, + order: { + id: null, + customer: { + id: null, + isFirstOrder: null, + }, + }, + delivery: { + selectedDeliveryOptions: [ + { + cost: { + amount: 0, + currencyCode: 'USD', + }, + costAfterDiscounts: { + amount: 0, + currencyCode: 'USD', + }, + description: null, + handle: '5f7028e0bd5225c17b24bdaa0c09f914-8388085074acab7e91de633521be86f0', + title: 'Economy', + type: 'shipping', + }, + ], + }, + shippingAddress: { + address1: 'Queens Center', + address2: null, + city: 'Elmhurst', + country: 'US', + countryCode: 'US', + firstName: 'test', + lastName: 'user', + phone: null, + province: 'NY', + provinceCode: 'NY', + zip: '11373', + }, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + transactions: [], }, }, context: { userAgent: 'Mozilla/5.0' }, @@ -222,7 +602,171 @@ describe('utilV2.js', () => { }; const message = checkoutStepEventBuilder(inputEvent); expect(message).toBeInstanceOf(Message); - expect(message.properties).toEqual({ step: 1, action: 'shipping_info_submitted' }); + expect(message.properties).toEqual({ + attributes: [], + billingAddress: { + address1: null, + address2: null, + city: null, + country: 'US', + countryCode: 'US', + firstName: null, + lastName: null, + phone: null, + province: null, + provinceCode: null, + zip: null, + }, + buyerAcceptsEmailMarketing: false, + buyerAcceptsSmsMarketing: false, + currencyCode: 'USD', + delivery: { + selectedDeliveryOptions: [ + { + cost: { + amount: 0, + currencyCode: 'USD', + }, + costAfterDiscounts: { + amount: 0, + currencyCode: 'USD', + }, + description: null, + handle: '5f7028e0bd5225c17b24bdaa0c09f914-8388085074acab7e91de633521be86f0', + title: 'Economy', + type: 'shipping', + }, + ], + }, + discountApplications: [], + discountsAmount: { + amount: 0, + currencyCode: 'USD', + }, + email: 'test-user@sampleemail.com', + lineItems: [ + { + discountAllocations: [], + finalLinePrice: { + amount: 1499.9, + currencyCode: 'USD', + }, + id: '41327143321713', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Collection Snowboard: Liquid', + variant: { + id: '41327143321713', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', + }, + price: { + amount: 749.95, + currencyCode: 'USD', + }, + product: { + id: '7234590834801', + title: 'The Collection Snowboard: Liquid', + type: 'snowboard', + untranslatedTitle: 'The Collection Snowboard: Liquid', + url: '/products/the-collection-snowboard-liquid', + vendor: 'Hydrogen Vendor', + }, + sku: null, + title: null, + untranslatedTitle: null, + }, + }, + { + discountAllocations: [], + finalLinePrice: { + amount: 1259.9, + currencyCode: 'USD', + }, + id: '41327143157873', + properties: [], + quantity: 2, + sellingPlanAllocation: null, + title: 'The Multi-managed Snowboard', + variant: { + id: '41327143157873', + image: { + src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', + }, + price: { + amount: 629.95, + currencyCode: 'USD', + }, + product: { + id: '7234590736497', + title: 'The Multi-managed Snowboard', + type: 'snowboard', + untranslatedTitle: 'The Multi-managed Snowboard', + url: '/products/the-multi-managed-snowboard', + vendor: 'Multi-managed Vendor', + }, + sku: 'sku-managed-1', + title: null, + untranslatedTitle: null, + }, + }, + ], + localization: { + country: { + isoCode: 'US', + }, + language: { + isoCode: 'en-US', + }, + market: { + handle: 'us', + id: 'gid://shopify/Market/23505895537', + }, + }, + order: { + customer: { + id: null, + isFirstOrder: null, + }, + id: null, + }, + phone: '', + shippingAddress: { + address1: 'Queens Center', + address2: null, + city: 'Elmhurst', + country: 'US', + countryCode: 'US', + firstName: 'test', + lastName: 'user', + phone: null, + province: 'NY', + provinceCode: 'NY', + zip: '11373', + }, + shippingLine: { + price: { + amount: 0, + currencyCode: 'USD', + }, + }, + smsMarketingPhone: null, + subtotalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + token: '5f7028e0bd5225c17b24bdaa0c09f914', + totalPrice: { + amount: 2759.8, + currencyCode: 'USD', + }, + totalTax: { + amount: 0, + currencyCode: 'USD', + }, + transactions: [], + }); expect(message.context).toEqual({ userAgent: 'Mozilla/5.0' }); }); }); diff --git a/test/integrations/sources/shopify/pixelTestScenarios/CheckoutEventsTests.ts b/test/integrations/sources/shopify/pixelTestScenarios/CheckoutEventsTests.ts index 3381223317..ff1ea39ed1 100644 --- a/test/integrations/sources/shopify/pixelTestScenarios/CheckoutEventsTests.ts +++ b/test/integrations/sources/shopify/pixelTestScenarios/CheckoutEventsTests.ts @@ -342,17 +342,8 @@ export const pixelCheckoutEventsTestScenarios = [ properties: { products: [ { - discountAllocations: [], - id: '41327143321713', quantity: 2, - title: 'The Collection Snowboard: Liquid', variant: 'The Collection Snowboard: Liquid', - finalLinePrice: { - amount: 1499.9, - currencyCode: 'USD', - }, - sellingPlanAllocation: null, - properties: [], name: 'The Collection Snowboard: Liquid', image_url: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', @@ -786,21 +777,12 @@ export const pixelCheckoutEventsTestScenarios = [ SHOPIFY: true, }, type: 'track', - event: 'Checkout Completed', + event: 'Order Completed', properties: { products: [ { - discountAllocations: [], - id: '41327143321713', quantity: 2, - title: 'The Collection Snowboard: Liquid', variant: 'The Collection Snowboard: Liquid', - finalLinePrice: { - amount: 1499.9, - currencyCode: 'USD', - }, - sellingPlanAllocation: null, - properties: [], name: 'The Collection Snowboard: Liquid', image_url: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6_64x64.jpg?v=1724736600', @@ -812,17 +794,8 @@ export const pixelCheckoutEventsTestScenarios = [ brand: 'Hydrogen Vendor', }, { - discountAllocations: [], - id: '41327143157873', quantity: 2, - title: 'The Multi-managed Snowboard', variant: 'The Multi-managed Snowboard', - finalLinePrice: { - amount: 1259.9, - currencyCode: 'USD', - }, - sellingPlanAllocation: null, - properties: [], name: 'The Multi-managed Snowboard', image_url: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a_64x64.jpg?v=1724736597', diff --git a/test/integrations/sources/shopify/pixelTestScenarios/ProductEventsTests.ts b/test/integrations/sources/shopify/pixelTestScenarios/ProductEventsTests.ts index b293bd46f9..46bd4f9615 100644 --- a/test/integrations/sources/shopify/pixelTestScenarios/ProductEventsTests.ts +++ b/test/integrations/sources/shopify/pixelTestScenarios/ProductEventsTests.ts @@ -170,27 +170,6 @@ export const pixelEventsTestScenarios = [ type: 'track', event: 'Product Viewed', properties: { - productVariant: { - price: { - amount: 749.95, - currencyCode: 'USD', - }, - product: { - title: 'The Collection Snowboard: Liquid', - vendor: 'Hydrogen Vendor', - id: '7234590834801', - untranslatedTitle: 'The Collection Snowboard: Liquid', - url: '/products/the-collection-snowboard-liquid', - type: 'snowboard', - }, - id: '41327143321713', - image: { - src: '//store.myshopify.com/cdn/shop/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', - }, - sku: '', - title: 'Default Title', - untranslatedTitle: 'Default Title', - }, product_id: '7234590834801', variant: 'The Collection Snowboard: Liquid', brand: 'Hydrogen Vendor', @@ -357,33 +336,6 @@ export const pixelEventsTestScenarios = [ properties: { products: [ { - cost: { - totalAmount: { - amount: 1259.9, - currencyCode: 'USD', - }, - }, - merchandise: { - price: { - amount: 629.95, - currencyCode: 'USD', - }, - product: { - title: 'The Multi-managed Snowboard', - vendor: 'Multi-managed Vendor', - id: '7234590736497', - untranslatedTitle: 'The Multi-managed Snowboard', - url: '/products/the-multi-managed-snowboard', - type: 'snowboard', - }, - id: '41327143157873', - image: { - src: '//store.myshopify.com/cdn/shop/files/Main_9129b69a-0c7b-4f66-b6cf-c4222f18028a.jpg?v=1724736597', - }, - sku: 'sku-managed-1', - title: 'Default Title', - untranslatedTitle: 'Default Title', - }, quantity: 2, product_id: '7234590736497', variant: 'The Multi-managed Snowboard', @@ -612,21 +564,7 @@ export const pixelEventsTestScenarios = [ products: [ { price: 10, - product: { - title: 'Gift Card', - vendor: 'Snowboard Vendor', - id: '7234590605425', - untranslatedTitle: 'Gift Card', - url: '/products/gift-card', - type: 'giftcard', - }, - id: '41327142895729', - image: { - src: '//store.myshopify.com/cdn/shop/files/gift_card.png?v=1724736596', - }, sku: '', - title: '$10', - untranslatedTitle: '$10', image_url: '//store.myshopify.com/cdn/shop/files/gift_card.png?v=1724736596', product_id: '7234590605425', @@ -638,21 +576,7 @@ export const pixelEventsTestScenarios = [ }, { price: 24.95, - product: { - title: 'Selling Plans Ski Wax', - vendor: 'pixel-testing-rs', - id: '7234590802033', - untranslatedTitle: 'Selling Plans Ski Wax', - url: '/products/selling-plans-ski-wax', - type: 'accessories', - }, - id: '41327143223409', - image: { - src: '//store.myshopify.com/cdn/shop/files/snowboard_wax.png?v=1724736599', - }, sku: '', - title: 'Selling Plans Ski Wax', - untranslatedTitle: 'Selling Plans Ski Wax', image_url: '//store.myshopify.com/cdn/shop/files/snowboard_wax.png?v=1724736599', product_id: '7234590802033', @@ -664,21 +588,7 @@ export const pixelEventsTestScenarios = [ }, { price: 2629.95, - product: { - title: 'The 3p Fulfilled Snowboard', - vendor: 'pixel-testing-rs', - id: '7234590703729', - untranslatedTitle: 'The 3p Fulfilled Snowboard', - url: '/products/the-3p-fulfilled-snowboard', - type: 'snowboard', - }, - id: '41327143125105', - image: { - src: '//store.myshopify.com/cdn/shop/files/Main_b9e0da7f-db89-4d41-83f0-7f417b02831d.jpg?v=1724736597', - }, sku: 'sku-hosted-1', - title: 'Default Title', - untranslatedTitle: 'Default Title', image_url: '//store.myshopify.com/cdn/shop/files/Main_b9e0da7f-db89-4d41-83f0-7f417b02831d.jpg?v=1724736597', product_id: '7234590703729', @@ -819,36 +729,6 @@ export const pixelEventsTestScenarios = [ type: 'track', event: 'Product Added', properties: { - cartLine: { - cost: { - totalAmount: { - amount: 749.95, - currencyCode: 'USD', - }, - }, - merchandise: { - id: '41327143321713', - image: { - src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', - }, - price: { - amount: 749.95, - currencyCode: 'USD', - }, - product: { - id: '7234590834801', - title: 'The Collection Snowboard: Liquid', - vendor: 'Hydrogen Vendor', - type: 'snowboard', - untranslatedTitle: 'The Collection Snowboard: Liquid', - url: '/products/the-collection-snowboard-liquid?variant=41327143321713', - }, - sku: '', - title: null, - untranslatedTitle: null, - }, - quantity: 1, - }, image_url: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', price: 749.95, @@ -990,36 +870,6 @@ export const pixelEventsTestScenarios = [ type: 'track', event: 'Product Removed', properties: { - cartLine: { - cost: { - totalAmount: { - amount: 749.95, - currencyCode: 'USD', - }, - }, - merchandise: { - id: '41327143321713', - image: { - src: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', - }, - price: { - amount: 749.95, - currencyCode: 'USD', - }, - product: { - id: '7234590834801', - title: 'The Collection Snowboard: Liquid', - vendor: 'Hydrogen Vendor', - type: 'snowboard', - untranslatedTitle: 'The Collection Snowboard: Liquid', - url: '/products/the-collection-snowboard-liquid?variant=41327143321713', - }, - sku: '', - title: null, - untranslatedTitle: null, - }, - quantity: 1, - }, image_url: 'https://cdn.shopify.com/s/files/1/0590/2696/4593/files/Main_b13ad453-477c-4ed1-9b43-81f3345adfd6.jpg?v=1724736600', price: 749.95, From a0eb8e90d8dff3ae44800abfb23d59ed3dedc6fc Mon Sep 17 00:00:00 2001 From: Aanshi Lahoti <110057617+aanshi07@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:52:18 +0530 Subject: [PATCH 18/21] fix: endpoint fix for tune destination (#3833) * feat: endpoint fix for tune destination * chore: minor fix --- src/v0/destinations/tune/transform.js | 8 ++++++-- .../destinations/tune/processor/trackTestData.ts | 4 ++-- test/integrations/destinations/tune/router/data.ts | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/v0/destinations/tune/transform.js b/src/v0/destinations/tune/transform.js index 97dad0e3d3..8103b4d2dc 100644 --- a/src/v0/destinations/tune/transform.js +++ b/src/v0/destinations/tune/transform.js @@ -8,6 +8,8 @@ const { isNotEmpty, } = require('../../util'); +const getTuneEndpoint = (subdomain) => `https://${subdomain}.go2cloud.org/aff_l`; + const mapPropertiesWithNestedSupport = (msg, properties, mappings) => { const mappedObj = {}; // Create a new object for parameters Object.entries(mappings).forEach(([key, value]) => { @@ -26,7 +28,7 @@ const mapPropertiesWithNestedSupport = (msg, properties, mappings) => { }; const responseBuilder = (message, { Config }) => { - const { tuneEvents } = Config; // Extract tuneEvents from config + const { tuneEvents, subdomain } = Config; // Extract tuneEvents from config const { properties, event: messageEvent } = message; // Destructure properties and event from message // Find the relevant tune event based on the message's event name @@ -43,10 +45,12 @@ const responseBuilder = (message, { Config }) => { ...mapPropertiesWithNestedSupport(message, properties, advUniqueIdHashMap), }; + const endpoint = getTuneEndpoint(subdomain); + // Prepare the response const response = defaultRequestConfig(); response.params = params; // Set only the mapped params - response.endpoint = tuneEvent.url; // Use the user-defined URL + response.endpoint = endpoint; return response; } diff --git a/test/integrations/destinations/tune/processor/trackTestData.ts b/test/integrations/destinations/tune/processor/trackTestData.ts index c19ffdd84c..63178d0e33 100644 --- a/test/integrations/destinations/tune/processor/trackTestData.ts +++ b/test/integrations/destinations/tune/processor/trackTestData.ts @@ -20,12 +20,12 @@ const destination: Destination = { connectionMode: { web: 'cloud', }, + subdomain: 'demo', consentManagement: {}, oneTrustCookieCategories: {}, ketchConsentPurposes: {}, tuneEvents: [ { - url: 'https://demo.go2cloud.org/aff_l?offer_id=45&aff_id=1029', eventName: 'Product added', standardMapping: [ { to: 'aff_id', from: 'affId' }, @@ -89,7 +89,7 @@ export const trackTestdata: ProcessorTestData[] = [ { output: transformResultBuilder({ method: 'POST', - endpoint: 'https://demo.go2cloud.org/aff_l?offer_id=45&aff_id=1029', + endpoint: 'https://demo.go2cloud.org/aff_l', event: 'Product added', headers: {}, params: { diff --git a/test/integrations/destinations/tune/router/data.ts b/test/integrations/destinations/tune/router/data.ts index 65bfee4ade..f21714d058 100644 --- a/test/integrations/destinations/tune/router/data.ts +++ b/test/integrations/destinations/tune/router/data.ts @@ -15,12 +15,12 @@ const destination: Destination = { connectionMode: { web: 'cloud', }, + subdomain: 'demo', consentManagement: {}, oneTrustCookieCategories: {}, ketchConsentPurposes: {}, tuneEvents: [ { - url: 'https://demo.go2cloud.org/aff_l?offer_id=45&aff_id=1029', eventName: 'Product added', standardMapping: [ { to: 'aff_id', from: 'affId' }, @@ -92,7 +92,7 @@ export const data: RouterTestData[] = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://demo.go2cloud.org/aff_l?offer_id=45&aff_id=1029', + endpoint: 'https://demo.go2cloud.org/aff_l', headers: {}, params: { security_token: '1123', From 386b8c2c13d1b10d4267e1b62c312b49ba7e480d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:52:38 +0530 Subject: [PATCH 19/21] chore(deps): bump docker/setup-buildx-action from 3.6.1 to 3.7.1 (#3787) --- .github/workflows/build-push-docker-image.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml index acc06496c2..c73469907c 100644 --- a/.github/workflows/build-push-docker-image.yml +++ b/.github/workflows/build-push-docker-image.yml @@ -98,7 +98,7 @@ jobs: fetch-depth: 1 - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3.6.1 + uses: docker/setup-buildx-action@v3.7.1 - name: Login to DockerHub uses: docker/login-action@v3.3.0 @@ -151,7 +151,7 @@ jobs: fetch-depth: 1 - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3.6.1 + uses: docker/setup-buildx-action@v3.7.1 - name: Login to DockerHub uses: docker/login-action@v3.3.0 @@ -199,7 +199,7 @@ jobs: steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3.6.1 + uses: docker/setup-buildx-action@v3.7.1 - name: Login to DockerHub uses: docker/login-action@v3.3.0 From 34a2dfac095639321bd495ca5850fec60128bce0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:53:51 +0530 Subject: [PATCH 20/21] chore(deps): bump codecov/codecov-action from 4.0.1 to 4.6.0 (#3788) --- .github/workflows/dt-test-and-report-code-coverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dt-test-and-report-code-coverage.yml b/.github/workflows/dt-test-and-report-code-coverage.yml index 86963b6270..33b9d881d9 100644 --- a/.github/workflows/dt-test-and-report-code-coverage.yml +++ b/.github/workflows/dt-test-and-report-code-coverage.yml @@ -58,14 +58,14 @@ jobs: npm run lint:fix - name: Upload Coverage Reports to Codecov - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v4.6.0 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: directory: ./reports/coverage - name: Upload TS Coverage Reports to Codecov - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v4.6.0 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: From ba694a5b38c2382981a4fc4e81b29c9672574534 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:55:17 +0530 Subject: [PATCH 21/21] chore(deps): bump docker/build-push-action from 6.7.0 to 6.9.0 (#3789) --- .github/workflows/build-push-docker-image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml index c73469907c..c7e59dce86 100644 --- a/.github/workflows/build-push-docker-image.yml +++ b/.github/workflows/build-push-docker-image.yml @@ -107,7 +107,7 @@ jobs: password: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - name: Build Docker Image - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.9.0 with: context: . file: ${{ inputs.dockerfile }} @@ -124,7 +124,7 @@ jobs: docker run ${{ inputs.build_tag }} npm run test:ts:ci - name: Build and Push Multi-platform Images - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.9.0 with: context: . file: ${{ inputs.dockerfile }} @@ -160,7 +160,7 @@ jobs: password: ${{ secrets.DOCKERHUB_PROD_TOKEN }} - name: Build Docker Image - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.9.0 with: context: . file: ${{ inputs.dockerfile }} @@ -177,7 +177,7 @@ jobs: docker run ${{ inputs.build_tag }} npm run test:ts:ci - name: Build and Push Multi-platform Images - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.9.0 with: context: . file: ${{ inputs.dockerfile }}