diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml index 7ddae0a3ae..0d3494e8d1 100644 --- a/.github/workflows/build-push-docker-image.yml +++ b/.github/workflows/build-push-docker-image.yml @@ -38,6 +38,7 @@ jobs: - name: Checkout uses: actions/checkout@v4.1.1 with: + ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 1 - name: Setup Docker Buildx @@ -88,6 +89,7 @@ jobs: - name: Checkout uses: actions/checkout@v4.1.1 with: + ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 1 - name: Setup Docker Buildx diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c04835cd4..3ba14c6e92 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.68.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.67.0...v1.68.0) (2024-05-27) + + +### Features + +* add json-data type support in redis ([#3336](https://github.com/rudderlabs/rudder-transformer/issues/3336)) ([0196f20](https://github.com/rudderlabs/rudder-transformer/commit/0196f20cc79e1f470d96a649dd9404c3c9284329)) +* facebook custom audience app secret support ([#3357](https://github.com/rudderlabs/rudder-transformer/issues/3357)) ([fce4ef9](https://github.com/rudderlabs/rudder-transformer/commit/fce4ef973500411c7ad812e7949bb1b73dabc3ba)) +* filtering unknown events in awin ([#3392](https://github.com/rudderlabs/rudder-transformer/issues/3392)) ([d842da8](https://github.com/rudderlabs/rudder-transformer/commit/d842da87a34cb63023eba288e0c5258e29997dcf)) +* **ga4:** component test refactor ([#3220](https://github.com/rudderlabs/rudder-transformer/issues/3220)) ([3ff9a5e](https://github.com/rudderlabs/rudder-transformer/commit/3ff9a5e8e955b929a1b04a89dcf0ccbc49e18648)) +* **integrations/auth0:** include Auth0 event type in Rudderstack message ([#3370](https://github.com/rudderlabs/rudder-transformer/issues/3370)) ([e9409fd](https://github.com/rudderlabs/rudder-transformer/commit/e9409fde6063d7eaa8558396b85b5fdf99f964e1)) +* onboard koddi destination ([#3359](https://github.com/rudderlabs/rudder-transformer/issues/3359)) ([f74c4a0](https://github.com/rudderlabs/rudder-transformer/commit/f74c4a0bc92ae6ccb0c00ac5b21745e496a015bc)) +* onboarding adjust source ([#3395](https://github.com/rudderlabs/rudder-transformer/issues/3395)) ([668d331](https://github.com/rudderlabs/rudder-transformer/commit/668d3311aadacbb92b1873bf43919db7d341afbb)) + + +### Bug Fixes + +* fb custom audience html response ([#3402](https://github.com/rudderlabs/rudder-transformer/issues/3402)) ([d1a2bd6](https://github.com/rudder +* standardise hashing for all CAPI integrations ([#3379](https://github.com/rudderlabs/rudder-transformer/issues/3379)) ([c249a69](https://github.com/rudderlabs/rudder-transformer/commit/c249a694d735f6d241a35b6e21f493c54890ac84)) +* tiktok_v2 remove default value for content-type for custom events ([#3383](https://github.com/rudderlabs/rudder-transformer/issues/3383)) ([6e7b5a0](https://github.com/rudderlabs/rudder-transformer/commit/6e7b5a0d8bf2c859dfb15b9cad7ed6070bd0892b)) +* added step for reconciling openfaas functions for python transformations ([#3420](https://github.com/rudderlabs/rudder-transformer/issues/3420)) ([7a2ab63](https://github.com/rudderlabs/rudder-transformer/commit/7a2ab63674d40870af4d16f0673a2a2594c899e9)) + ## [1.67.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.66.1...v1.67.0) (2024-05-23) diff --git a/package-lock.json b/package-lock.json index bfeb00963a..b8e2c81a29 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.67.0", + "version": "1.68.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.67.0", + "version": "1.68.0", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "0.7.24", diff --git a/package.json b/package.json index 7fa3a7330c..ed15683d4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.67.0", + "version": "1.68.0", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": { diff --git a/src/cdk/v2/destinations/koddi/config.js b/src/cdk/v2/destinations/koddi/config.js new file mode 100644 index 0000000000..927e1858fc --- /dev/null +++ b/src/cdk/v2/destinations/koddi/config.js @@ -0,0 +1,39 @@ +const { getMappingConfig } = require('../../../../v0/util'); + +/** + * ref :- https://developers.koddi.com/reference/winning-ads + * impressions - https://developers.koddi.com/reference/impressions-1 + * clicks - https://developers.koddi.com/reference/clicks-1 + * conversions - https://developers.koddi.com/reference/conversions-1 + */ +const EVENT_TYPES = { + IMPRESSIONS: 'impressions', + CLICKS: 'clicks', + CONVERSIONS: 'conversions', +}; + +const CONFIG_CATEGORIES = { + IMPRESSIONS: { + type: 'track', + name: 'ImpressionsConfig', + }, + CLICKS: { + type: 'track', + name: 'ClicksConfig', + }, + CONVERSIONS: { + type: 'track', + name: 'ConversionsConfig', + }, +}; + +const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname); + +module.exports = { + EVENT_TYPES, + CONFIG_CATEGORIES, + MAPPING_CONFIG, + IMPRESSIONS_CONFIG: MAPPING_CONFIG[CONFIG_CATEGORIES.IMPRESSIONS.name], + CLICKS_CONFIG: MAPPING_CONFIG[CONFIG_CATEGORIES.CLICKS.name], + CONVERSIONS_CONFIG: MAPPING_CONFIG[CONFIG_CATEGORIES.CONVERSIONS.name], +}; diff --git a/src/cdk/v2/destinations/koddi/data/ClicksConfig.json b/src/cdk/v2/destinations/koddi/data/ClicksConfig.json new file mode 100644 index 0000000000..96ab27b2ae --- /dev/null +++ b/src/cdk/v2/destinations/koddi/data/ClicksConfig.json @@ -0,0 +1,35 @@ +[ + { + "sourceKeys": "properties.tracking_data", + "required": true, + "destKey": "trackingData" + }, + { + "sourceKeys": "properties.rank", + "required": true, + "destKey": "rank" + }, + { + "sourceKeys": "properties.beacon_issued", + "required": true, + "destKey": "beaconIssued" + }, + { + "sourceKeys": "userId", + "sourceFromGenericMap": true, + "required": true, + "destKey": "userGuid" + }, + { + "sourceKeys": "properties.test_version_override", + "destKey": "testVersionOverride" + }, + { + "sourceKeys": "properties.destination_url", + "destKey": "destinationUrl" + }, + { + "sourceKeys": "properties.overrides", + "destKey": "overrides" + } +] diff --git a/src/cdk/v2/destinations/koddi/data/ConversionsConfig.json b/src/cdk/v2/destinations/koddi/data/ConversionsConfig.json new file mode 100644 index 0000000000..495574f198 --- /dev/null +++ b/src/cdk/v2/destinations/koddi/data/ConversionsConfig.json @@ -0,0 +1,53 @@ +[ + { + "sourceKeys": "context.page.referring_domain", + "destKey": "domain" + }, + { + "sourceKeys": "context.locale", + "required": true, + "destKey": "culture" + }, + { + "sourceKeys": "properties.currency", + "required": true, + "destKey": "currency" + }, + { + "sourceKeys": ["context.ip", "request_ip"], + "destKey": "user_ip" + }, + { + "sourceKeys": "context.userAgent", + "destKey": "user_agent" + }, + { + "sourceKeys": "userId", + "sourceFromGenericMap": true, + "required": true, + "destKey": "user_guid" + }, + { + "sourceKeys": "context.device.type", + "destKey": "device_type" + }, + { + "sourceKeys": ["properties.order_id", "properties.transaction_id"], + "required": true, + "destKey": "transaction_id" + }, + { + "sourceKeys": "properties.conversion_source", + "destKey": "conversion_source" + }, + { + "sourceKeys": "timestamp", + "sourceFromGenericMap": true, + "destKey": "unixtime" + }, + { + "sourceKeys": "properties.bidders", + "required": true, + "destKey": "bidders" + } +] diff --git a/src/cdk/v2/destinations/koddi/data/ImpressionsConfig.json b/src/cdk/v2/destinations/koddi/data/ImpressionsConfig.json new file mode 100644 index 0000000000..de53703b32 --- /dev/null +++ b/src/cdk/v2/destinations/koddi/data/ImpressionsConfig.json @@ -0,0 +1,22 @@ +[ + { + "sourceKeys": "properties.tracking_data", + "required": true, + "destKey": "trackingData" + }, + { + "sourceKeys": "properties.rank", + "required": true, + "destKey": "rank" + }, + { + "sourceKeys": "properties.beacon_issued", + "required": true, + "destKey": "beaconIssued" + }, + { + "sourceKeys": "timestamp", + "sourceFromGenericMap": true, + "destKey": "ts" + } +] diff --git a/src/cdk/v2/destinations/koddi/procWorkflow.yaml b/src/cdk/v2/destinations/koddi/procWorkflow.yaml new file mode 100644 index 0000000000..cc3f0166dc --- /dev/null +++ b/src/cdk/v2/destinations/koddi/procWorkflow.yaml @@ -0,0 +1,33 @@ +bindings: + - name: EventType + path: ../../../../constants + - path: ../../bindings/jsontemplate + - name: removeUndefinedAndNullValues + path: ../../../../v0/util + - path: ./utils + - path: ./config + +steps: + - name: messageType + template: | + .message.type.toLowerCase(); + - name: eventType + template: | + .message.integrations.koddi.eventType.toLowerCase(); + - name: validateInput + template: | + let messageType = $.outputs.messageType; + let eventType = $.outputs.eventType; + $.assert(messageType, "message Type is not present. Aborting message."); + $.assert(messageType in {{$.EventType.([.TRACK])}}, "message type " + messageType + " is not supported"); + $.assert(eventType in {{$.EVENT_TYPES.([.IMPRESSIONS, .CLICKS, .CONVERSIONS])}}, "event type " + eventType + " is not supported"); + $.assertConfig(.destination.Config.apiBaseUrl, "API Base URL is not present. Aborting"); + $.assertConfig(.destination.Config.clientName, "Client Name is not present. Aborting"); + - name: preparePayload + template: | + const payload = $.constructFullPayload($.outputs.eventType, .message, .destination.Config); + $.context.payload = $.removeUndefinedAndNullValues(payload); + - name: buildResponse + template: | + const response = $.constructResponse($.outputs.eventType, .destination.Config, $.context.payload); + response diff --git a/src/cdk/v2/destinations/koddi/rtWorkflow.yaml b/src/cdk/v2/destinations/koddi/rtWorkflow.yaml new file mode 100644 index 0000000000..dd438a911c --- /dev/null +++ b/src/cdk/v2/destinations/koddi/rtWorkflow.yaml @@ -0,0 +1,31 @@ +bindings: + - name: handleRtTfSingleEventError + path: ../../../../v0/util/index + +steps: + - name: validateInput + template: | + $.assert(Array.isArray(^) && ^.length > 0, "Invalid event array") + + - name: transform + externalWorkflow: + path: ./procWorkflow.yaml + loopOverInput: true + + - name: successfulEvents + template: | + $.outputs.transform#idx.output.({ + "batchedRequest": ., + "batched": false, + "destination": ^[idx].destination, + "metadata": ^[idx].metadata[], + "statusCode": 200 + })[] + - name: failedEvents + template: | + $.outputs.transform#idx.error.( + $.handleRtTfSingleEventError(^[idx], .originalError ?? ., {}) + )[] + - name: finalPayload + template: | + [...$.outputs.successfulEvents, ...$.outputs.failedEvents] diff --git a/src/cdk/v2/destinations/koddi/utils.js b/src/cdk/v2/destinations/koddi/utils.js new file mode 100644 index 0000000000..13014e2e7c --- /dev/null +++ b/src/cdk/v2/destinations/koddi/utils.js @@ -0,0 +1,116 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); +const { EVENT_TYPES, IMPRESSIONS_CONFIG, CLICKS_CONFIG, CONVERSIONS_CONFIG } = require('./config'); +const { + constructPayload, + defaultRequestConfig, + toUnixTimestamp, + stripTrailingSlash, +} = require('../../../../v0/util'); + +const validateBidders = (bidders) => { + if (!Array.isArray(bidders)) { + throw new InstrumentationError('properties.bidders should be an array of objects. Aborting.'); + } + if (bidders.length === 0) { + throw new InstrumentationError( + 'properties.bidders should contains at least one bidder. Aborting.', + ); + } + bidders.forEach((bidder) => { + if (!(bidder.bidder || bidder.alternate_bidder)) { + throw new InstrumentationError('bidder or alternate_bidder is not present. Aborting.'); + } + if (!bidder.count) { + throw new InstrumentationError('count is not present. Aborting.'); + } + if (!bidder.base_price) { + throw new InstrumentationError('base_price is not present. Aborting.'); + } + }); +}; + +/** + * This function constructs payloads based upon mappingConfig for all calls. + * @param {*} eventType + * @param {*} message + * @param {*} Config + * @returns + */ +const constructFullPayload = (eventType, message, Config) => { + let payload; + switch (eventType) { + case EVENT_TYPES.IMPRESSIONS: + payload = constructPayload(message, IMPRESSIONS_CONFIG); + payload.clientName = Config.clientName; + break; + case EVENT_TYPES.CLICKS: + payload = constructPayload(message, CLICKS_CONFIG); + payload.clientName = Config.clientName; + if (!Config.testVersionOverride) { + payload.testVersionOverride = null; + } + if (!Config.overrides) { + payload.overrides = null; + } + break; + case EVENT_TYPES.CONVERSIONS: + payload = constructPayload(message, CONVERSIONS_CONFIG); + payload.client_name = Config.clientName; + payload.unixtime = toUnixTimestamp(payload.unixtime); + validateBidders(payload.bidders); + break; + default: + throw new InstrumentationError(`event type ${eventType} is not supported.`); + } + return payload; +}; + +const getEndpoint = (eventType, Config) => { + let endpoint = stripTrailingSlash(Config.apiBaseUrl); + switch (eventType) { + case EVENT_TYPES.IMPRESSIONS: + endpoint += '?action=impression'; + break; + case EVENT_TYPES.CLICKS: + endpoint += '?action=click'; + break; + case EVENT_TYPES.CONVERSIONS: + endpoint += '/conversion'; + break; + default: + throw new InstrumentationError(`event type ${eventType} is not supported.`); + } + return endpoint; +}; + +/** + * This function constructs response based upon event. + * @param {*} eventType + * @param {*} Config + * @param {*} payload + * @returns + */ +const constructResponse = (eventType, Config, payload) => { + if (!Object.values(EVENT_TYPES).includes(eventType)) { + throw new InstrumentationError(`event type ${eventType} is not supported.`); + } + const response = defaultRequestConfig(); + response.endpoint = getEndpoint(eventType, Config); + response.headers = { + accept: 'application/json', + }; + if (eventType === EVENT_TYPES.CONVERSIONS) { + response.body.JSON = payload; + response.method = 'POST'; + response.headers = { + ...response.headers, + 'content-type': 'application/json', + }; + } else { + response.params = payload; + response.method = 'GET'; + } + return response; +}; + +module.exports = { getEndpoint, validateBidders, constructFullPayload, constructResponse }; diff --git a/src/cdk/v2/destinations/koddi/utils.test.js b/src/cdk/v2/destinations/koddi/utils.test.js new file mode 100644 index 0000000000..2c1f660f70 --- /dev/null +++ b/src/cdk/v2/destinations/koddi/utils.test.js @@ -0,0 +1,421 @@ +const { + getEndpoint, + validateBidders, + constructFullPayload, + constructResponse, +} = require('./utils'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); + +describe('getEndpoint', () => { + it('returns the correct endpoint for IMPRESSIONS event', () => { + const eventType = 'impressions'; + const Config = { + apiBaseUrl: 'https://www.test-client.com/', + clientName: 'test-client', + }; + const result = getEndpoint(eventType, Config); + expect(result).toEqual('https://www.test-client.com?action=impression'); + }); + + it('returns the correct endpoint for CLICKS event', () => { + const eventType = 'clicks'; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + const result = getEndpoint(eventType, Config); + expect(result).toEqual('https://www.test-client.com?action=click'); + }); + + it('returns the correct endpoint for IMPRESSIONS event', () => { + const eventType = 'conversions'; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + const result = getEndpoint(eventType, Config); + expect(result).toEqual('https://www.test-client.com/conversion'); + }); + + it('should throw error for unsupported event', () => { + const eventType = 'test'; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + expect(() => getEndpoint(eventType, Config)).toThrow(InstrumentationError); + expect(() => getEndpoint(eventType, Config)).toThrow('event type test is not supported.'); + }); +}); + +describe('validateBidders', () => { + it('should throw error if bidders is not an array', () => { + const bidders = {}; + expect(() => validateBidders(bidders)).toThrow(InstrumentationError); + expect(() => validateBidders(bidders)).toThrow( + 'properties.bidders should be an array of objects. Aborting.', + ); + }); + + it('should throw error if bidders is an empty array', () => { + const bidders = []; + expect(() => validateBidders(bidders)).toThrow(InstrumentationError); + expect(() => validateBidders(bidders)).toThrow( + 'properties.bidders should contains at least one bidder. Aborting.', + ); + }); + + it('should throw error if bidder or alternate_bidder is not present', () => { + const bidders = [ + { count: 1, base_price: 100 }, + { bidder: 'bidder1', count: 2, base_price: 200 }, + { alternate_bidder: 'alternate1', count: 3, base_price: 300 }, + ]; + expect(() => validateBidders(bidders)).toThrow(InstrumentationError); + expect(() => validateBidders(bidders)).toThrow( + 'bidder or alternate_bidder is not present. Aborting.', + ); + }); + + it('should throw error if count is not present', () => { + const bidders = [{ bidder: 'bidder1', alternate_bidder: 'alternate1', base_price: 100 }]; + expect(() => validateBidders(bidders)).toThrow(InstrumentationError); + expect(() => validateBidders(bidders)).toThrow('count is not present. Aborting.'); + }); + + it('should throw error if base_price is not present', () => { + const bidders = [{ bidder: 'bidder1', alternate_bidder: 'alternate1', count: 1 }]; + expect(() => validateBidders(bidders)).toThrow(InstrumentationError); + expect(() => validateBidders(bidders)).toThrow('base_price is not present. Aborting.'); + }); + + it('should not throw error if all required fields are present for all bidders', () => { + const bidders = [ + { bidder: 'bidder1', alternate_bidder: 'alternate1', count: 1, base_price: 100 }, + { bidder: 'bidder2', alternate_bidder: 'alternate2', count: 2, base_price: 200 }, + ]; + expect(() => validateBidders(bidders)).not.toThrow(); + }); +}); + +describe('constructFullPayload', () => { + it('should construct payload for IMPRESSIONS event', () => { + const eventType = 'impressions'; + const message = { + type: 'track', + event: 'Impressions Event', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + timestamp: '2024-03-03T00:29:12.117+05:30', + }; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + const expectedPayload = { + beaconIssued: '2024-03-04T15:32:56.409Z', + clientName: 'test-client', + rank: 1, + trackingData: 'dummy-tracking-data', + ts: '2024-03-03T00:29:12.117+05:30', + }; + const payload = constructFullPayload(eventType, message, Config); + expect(payload).toEqual(expectedPayload); + }); + it('should throw error if required value is missing for IMPRESSIONS event', () => { + const eventType = 'impressions'; + const message = { + type: 'track', + event: 'Impressions Event', + properties: { + tracking_data: '', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + timestamp: '2024-03-03T00:29:12.117+05:30', + }; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + try { + const payload = constructFullPayload(eventType, message, Config); + } catch (error) { + expect(error.message).toEqual('Missing required value from "properties.tracking_data"'); + } + }); + + it('should construct payload for CLICKS event', () => { + const eventType = 'clicks'; + const message = { + type: 'track', + event: 'Clicks Event', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + anonymousId: '1234', + }; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + const expectedPayload = { + beaconIssued: '2024-03-04T15:32:56.409Z', + clientName: 'test-client', + rank: 1, + trackingData: 'dummy-tracking-data', + userGuid: '1234', + overrides: null, + testVersionOverride: null, + }; + const payload = constructFullPayload(eventType, message, Config); + expect(payload).toEqual(expectedPayload); + }); + it('should construct payload with non-null value if overrides and testVersionOverride are enable and values for these are provided for CLICKS event ', () => { + const eventType = 'clicks'; + const message = { + type: 'track', + event: 'Clicks Event', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + overrides: 'overridden-value', + testVersionOverride: 1, + }, + anonymousId: '1234', + }; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + overrides: true, + testVersionOverride: false, + }; + const expectedPayload = { + beaconIssued: '2024-03-04T15:32:56.409Z', + clientName: 'test-client', + rank: 1, + trackingData: 'dummy-tracking-data', + userGuid: '1234', + overrides: 'overridden-value', + testVersionOverride: null, + }; + const payload = constructFullPayload(eventType, message, Config); + expect(payload).toEqual(expectedPayload); + }); + it('should throw error if required value is missing for CLICKS event', () => { + const eventType = 'clicks'; + const message = { + type: 'track', + event: 'Clicks Event', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + }; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + try { + const payload = constructFullPayload(eventType, message, Config); + } catch (error) { + expect(error.message).toEqual('Missing required value from "userId"'); + } + }); + + it('should construct payload for CONVERSIONS event', () => { + const eventType = 'conversions'; + const message = { + type: 'track', + event: 'Conversions Event', + properties: { + currency: 'USD', + order_id: '123', + bidders: [ + { + bidder: 'dummy-bidder-id', + count: 1, + base_price: 100.1, + }, + ], + }, + context: { + locale: 'en-US', + ip: '127.0.0.1', + }, + timestamp: '2024-03-03T00:29:12.117+05:30', + anonymousId: '1234', + }; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + const expectedPayload = { + client_name: 'test-client', + culture: 'en-US', + currency: 'USD', + transaction_id: '123', + unixtime: 1709405952, + user_guid: '1234', + user_ip: '127.0.0.1', + bidders: [ + { + bidder: 'dummy-bidder-id', + count: 1, + base_price: 100.1, + }, + ], + }; + const payload = constructFullPayload(eventType, message, Config); + expect(payload).toEqual(expectedPayload); + }); + it('should throw error if required value is missing for CONVERSIONS event', () => { + const eventType = 'conversions'; + const message = { + type: 'track', + event: 'Conversions Event', + properties: { + currency: 'USD', + order_id: '123', + bidders: [ + { + bidder: 'dummy-bidder-id', + count: 1, + base_price: 100.1, + }, + ], + }, + context: { + ip: '127.0.0.1', + }, + timestamp: '2024-03-03T00:29:12.117+05:30', + anonymousId: '1234', + }; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + try { + const payload = constructFullPayload(eventType, message, Config); + } catch (error) { + expect(error.message).toEqual('Missing required value from "context.locale"'); + } + }); + + it('should throw error for unsupported event', () => { + const eventType = 'test'; + const message = {}; + const Config = {}; + expect(() => constructFullPayload(eventType, message, Config)).toThrow(InstrumentationError); + expect(() => constructFullPayload(eventType, message, Config)).toThrow( + 'event type test is not supported.', + ); + }); +}); + +describe('constructResponse', () => { + it('should construct response for IMPRESSIONS event', () => { + const eventType = 'impressions'; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + const payload = { + beaconIssued: '2024-03-04T15:32:56.409Z', + clientName: 'test-client', + rank: 1, + trackingData: 'dummy-tracking-data', + ts: '2024-03-03T00:29:12.117+05:30', + }; + const expectedResponse = { + endpoint: 'https://www.test-client.com?action=impression', + headers: { + accept: 'application/json', + }, + method: 'GET', + params: payload, + }; + const response = constructResponse(eventType, Config, payload); + expect(response).toMatchObject(expectedResponse); + }); + + it('should construct response for CLICKS event', () => { + const eventType = 'clicks'; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + const payload = { + beaconIssued: '2024-03-04T15:32:56.409Z', + clientName: 'test-client', + rank: 1, + trackingData: 'dummy-tracking-data', + userGuid: '1234', + }; + const expectedResponse = { + endpoint: 'https://www.test-client.com?action=click', + headers: { + accept: 'application/json', + }, + method: 'GET', + params: payload, + }; + const response = constructResponse(eventType, Config, payload); + expect(response).toMatchObject(expectedResponse); + }); + + it('should construct response for CONVERSIONS event', () => { + const eventType = 'conversions'; + const Config = { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }; + const payload = { + client_name: 'test-client', + culture: 'en-US', + currency: 'USD', + transaction_id: '123', + unixtime: 1709405952, + userGuid: '1234', + user_ip: '127.0.0.1', + bidders: [ + { + bidder: 'dummy-bidder-id', + count: 1, + base_price: 100.1, + }, + ], + }; + + const expectedResponse = { + endpoint: 'https://www.test-client.com/conversion', + headers: { + accept: 'application/json', + 'content-type': 'application/json', + }, + method: 'POST', + body: { + JSON: payload, + }, + }; + const response = constructResponse(eventType, Config, payload); + expect(response).toMatchObject(expectedResponse); + }); + + it('should throw error for unsupported event', () => { + const eventType = 'test'; + const Config = {}; + const payload = {}; + expect(() => constructResponse(eventType, Config, payload)).toThrow(InstrumentationError); + expect(() => constructResponse(eventType, Config, payload)).toThrow( + 'event type test is not supported.', + ); + }); +}); diff --git a/src/cdk/v2/destinations/reddit/procWorkflow.yaml b/src/cdk/v2/destinations/reddit/procWorkflow.yaml index 7b989f15e4..06d2c95f25 100644 --- a/src/cdk/v2/destinations/reddit/procWorkflow.yaml +++ b/src/cdk/v2/destinations/reddit/procWorkflow.yaml @@ -36,13 +36,13 @@ steps: const os = (.message.context.os.name)? .message.context.os.name.toLowerCase(): null; const hashData = .destination.Config.hashData; let user = .message.().({ - "email": hashData ? $.SHA256({{{{$.getGenericPaths("email")}}}}) : ({{{{$.getGenericPaths("email")}}}}), - "external_id": hashData ? $.SHA256({{{{$.getGenericPaths("userId")}}}}) : ({{{{$.getGenericPaths("userId")}}}}), - "ip_address": hashData? $.SHA256(.context.ip || .request_ip) : (.context.ip || .request_ip), + "email": hashData ? $.SHA256({{{{$.getGenericPaths("email")}}}}.trim()) : ({{{{$.getGenericPaths("email")}}}}), + "external_id": hashData ? $.SHA256({{{{$.getGenericPaths("userId")}}}}.trim()) : ({{{{$.getGenericPaths("userId")}}}}), + "ip_address": hashData? $.SHA256(.context.ip.trim() || .request_ip.trim()) : (.context.ip || .request_ip), "uuid": .properties.uuid, "user_agent": .context.userAgent, - "idfa": $.isAppleFamily(os)? (hashData? $.SHA256(.context.device.advertisingId): .context.device.advertisingId): null, - "aaid": os === "android" && .context.device ? (hashData? $.SHA256(.context.device.advertisingId): .context.device.advertisingId): null, + "idfa": $.isAppleFamily(os)? (hashData? $.SHA256(.context.device.advertisingId.trim()): .context.device.advertisingId): null, + "aaid": os === "android" && .context.device ? (hashData? $.SHA256(.context.device.advertisingId.trim()): .context.device.advertisingId): null, "opt_out": .properties.optOut, "screen_dimensions": {"width": .context.screen.width, "height": .context.screen.height}, }); diff --git a/src/features.json b/src/features.json index a7e4b70109..58af795a77 100644 --- a/src/features.json +++ b/src/features.json @@ -71,7 +71,8 @@ "LINKEDIN_ADS": true, "BLOOMREACH": true, "MOVABLE_INK": true, - "EMARSYS": true + "EMARSYS": true, + "KODDI": true }, "regulations": [ "BRAZE", diff --git a/src/util/customTransformer-faas.js b/src/util/customTransformer-faas.js index 2c0bbfd8c0..9ac9804097 100644 --- a/src/util/customTransformer-faas.js +++ b/src/util/customTransformer-faas.js @@ -11,9 +11,10 @@ const { } = require('./openfaas'); const { getLibraryCodeV1 } = require('./customTransforrmationsStore-v1'); +const HASH_SECRET = process.env.OPENFAAS_FN_HASH_SECRET || ''; const libVersionIdsCache = new NodeCache(); -function generateFunctionName(userTransformation, libraryVersionIds, testMode) { +function generateFunctionName(userTransformation, libraryVersionIds, testMode, hashSecret = '') { if (userTransformation.versionId === FAAS_AST_VID) return FAAS_AST_FN_NAME; if (testMode) { @@ -21,10 +22,15 @@ function generateFunctionName(userTransformation, libraryVersionIds, testMode) { return funcName.substring(0, 63).toLowerCase(); } - const ids = [userTransformation.workspaceId, userTransformation.versionId].concat( + let ids = [userTransformation.workspaceId, userTransformation.versionId].concat( (libraryVersionIds || []).sort(), ); + if (hashSecret !== '') { + ids = ids.concat([hashSecret]); + } + + // FIXME: Why the id's are sorted ?! const hash = crypto.createHash('md5').update(`${ids}`).digest('hex'); return `fn-${userTransformation.workspaceId}-${hash}`.substring(0, 63).toLowerCase(); } @@ -90,7 +96,13 @@ async function setOpenFaasUserTransform( testMode, }; const functionName = - pregeneratedFnName || generateFunctionName(userTransformation, libraryVersionIds, testMode); + pregeneratedFnName || + generateFunctionName( + userTransformation, + libraryVersionIds, + testMode, + process.env.OPENFAAS_FN_HASH_SECRET, + ); const setupTime = new Date(); await setupFaasFunction( @@ -130,7 +142,13 @@ async function runOpenFaasUserTransform( const trMetadata = events[0].metadata ? getTransformationMetadata(events[0].metadata) : {}; // check and deploy faas function if not exists - const functionName = generateFunctionName(userTransformation, libraryVersionIds, testMode); + const functionName = generateFunctionName( + userTransformation, + libraryVersionIds, + testMode, + process.env.OPENFAAS_FN_HASH_SECRET, + ); + if (testMode) { await setOpenFaasUserTransform( userTransformation, diff --git a/src/util/openfaas/faasApi.js b/src/util/openfaas/faasApi.js index f8f830f6e4..b932b70032 100644 --- a/src/util/openfaas/faasApi.js +++ b/src/util/openfaas/faasApi.js @@ -1,6 +1,8 @@ const axios = require('axios'); const { RespStatusError, RetryRequestError } = require('../utils'); +const logger = require('../../logger'); + const OPENFAAS_GATEWAY_URL = process.env.OPENFAAS_GATEWAY_URL || 'http://localhost:8080'; const OPENFAAS_GATEWAY_USERNAME = process.env.OPENFAAS_GATEWAY_USERNAME || ''; const OPENFAAS_GATEWAY_PASSWORD = process.env.OPENFAAS_GATEWAY_PASSWORD || ''; @@ -12,7 +14,7 @@ const basicAuth = { const parseAxiosError = (error) => { if (error.response) { - const status = error.response.status || 400; + const status = error.response.status || 500; const errorData = error.response?.data; const message = (errorData && (errorData.message || errorData.error || errorData)) || error.message; @@ -61,6 +63,8 @@ const invokeFunction = async (functionName, payload) => }); const checkFunctionHealth = async (functionName) => { + logger.debug(`Checking function health: ${functionName}`); + return new Promise((resolve, reject) => { const url = `${OPENFAAS_GATEWAY_URL}/function/${functionName}`; axios @@ -76,8 +80,10 @@ const checkFunctionHealth = async (functionName) => { }); }; -const deployFunction = async (payload) => - new Promise((resolve, reject) => { +const deployFunction = async (payload) => { + logger.debug(`Deploying function: ${payload?.name}`); + + return new Promise((resolve, reject) => { const url = `${OPENFAAS_GATEWAY_URL}/system/functions`; axios .post(url, payload, { auth: basicAuth }) @@ -86,6 +92,21 @@ const deployFunction = async (payload) => reject(parseAxiosError(err)); }); }); +}; + +const updateFunction = async (fnName, payload) => { + logger.debug(`Updating function: ${fnName}`); + + return new Promise((resolve, reject) => { + const url = `${OPENFAAS_GATEWAY_URL}/system/functions`; + axios + .put(url, payload, { auth: basicAuth }) + .then((resp) => resolve(resp.data)) + .catch((err) => { + reject(parseAxiosError(err)); + }); + }); +}; module.exports = { deleteFunction, @@ -94,4 +115,5 @@ module.exports = { getFunctionList, invokeFunction, checkFunctionHealth, + updateFunction, }; diff --git a/src/util/openfaas/index.js b/src/util/openfaas/index.js index 3cf3525e6f..c0369deb81 100644 --- a/src/util/openfaas/index.js +++ b/src/util/openfaas/index.js @@ -4,6 +4,7 @@ const { deployFunction, invokeFunction, checkFunctionHealth, + updateFunction, } = require('./faasApi'); const logger = require('../../logger'); const { RetryRequestError, RespStatusError } = require('../utils'); @@ -33,6 +34,7 @@ const FAAS_AST_FN_NAME = 'fn-ast'; const CUSTOM_NETWORK_POLICY_WORKSPACE_IDS = process.env.CUSTOM_NETWORK_POLICY_WORKSPACE_IDS || ''; const customNetworkPolicyWorkspaceIds = CUSTOM_NETWORK_POLICY_WORKSPACE_IDS.split(','); const CUSTOMER_TIER = process.env.CUSTOMER_TIER || 'shared'; +const DISABLE_RECONCILE_FN = process.env.DISABLE_RECONCILE_FN == 'true' || false; // Initialise node cache const functionListCache = new NodeCache(); @@ -67,6 +69,8 @@ const awaitFunctionReadiness = async ( maxWaitInMs = 22000, waitBetweenIntervalsInMs = 250, ) => { + logger.debug(`Awaiting function readiness: ${functionName}`); + const executionPromise = new Promise(async (resolve) => { try { await callWithRetry( @@ -121,7 +125,7 @@ const invalidateFnCache = () => { functionListCache.set(FUNC_LIST_KEY, []); }; -const deployFaasFunction = async ( +const updateFaasFunction = async ( functionName, code, versionId, @@ -130,73 +134,50 @@ const deployFaasFunction = async ( trMetadata = {}, ) => { try { - logger.debug(`[Faas] Deploying a faas function: ${functionName}`); - let envProcess = 'python index.py'; - - const lvidsString = libraryVersionIDs.join(','); + logger.debug(`Updating faas fn: ${functionName}`); - if (!testMode) { - envProcess = `${envProcess} --vid ${versionId} --config-backend-url ${CONFIG_BACKEND_URL} --lvids "${lvidsString}"`; - } else { - envProcess = `${envProcess} --code "${code}" --config-backend-url ${CONFIG_BACKEND_URL} --lvids "${lvidsString}"`; - } - - const envVars = {}; - if (FAAS_ENABLE_WATCHDOG_ENV_VARS.trim().toLowerCase() === 'true') { - envVars.max_inflight = FAAS_MAX_INFLIGHT; - envVars.exec_timeout = FAAS_EXEC_TIMEOUT; - } - if (GEOLOCATION_URL) { - envVars.geolocation_url = GEOLOCATION_URL; - } - // labels - const labels = { - 'openfaas-fn': 'true', - 'parent-component': 'openfaas', - 'com.openfaas.scale.max': FAAS_MAX_PODS_IN_TEXT, - 'com.openfaas.scale.min': FAAS_MIN_PODS_IN_TEXT, - 'com.openfaas.scale.zero': FAAS_SCALE_ZERO, - 'com.openfaas.scale.zero-duration': FAAS_SCALE_ZERO_DURATION, - 'com.openfaas.scale.target': FAAS_SCALE_TARGET, - 'com.openfaas.scale.target-proportion': FAAS_SCALE_TARGET_PROPORTION, - 'com.openfaas.scale.type': FAAS_SCALE_TYPE, - transformationId: trMetadata.transformationId, - workspaceId: trMetadata.workspaceId, - team: 'data-management', - service: 'openfaas-fn', - customer: 'shared', - 'customer-tier': CUSTOMER_TIER, - }; - if ( - trMetadata.workspaceId && - customNetworkPolicyWorkspaceIds.includes(trMetadata.workspaceId) - ) { - labels['custom-network-policy'] = 'true'; + const payload = buildOpenfaasFn( + functionName, + code, + versionId, + libraryVersionIDs, + testMode, + trMetadata, + ); + await updateFunction(functionName, payload); + // wait for function to be ready and then set it in cache + await awaitFunctionReadiness(functionName); + setFunctionInCache(functionName); + } catch (error) { + // 404 is statuscode returned from openfaas community edition + // when the function don't exist, so we can safely ignore this error + // and let the function be created in the next step. + if (error.statusCode !== 404) { + throw error; } + } +}; - // TODO: investigate and add more required labels and annotations - const payload = { - service: functionName, - name: functionName, - image: FAAS_BASE_IMG, - envProcess, - envVars, - labels, - annotations: { - 'prometheus.io.scrape': 'true', - }, - limits: { - memory: FAAS_LIMITS_MEMORY, - cpu: FAAS_LIMITS_CPU, - }, - requests: { - memory: FAAS_REQUESTS_MEMORY, - cpu: FAAS_REQUESTS_CPU, - }, - }; +const deployFaasFunction = async ( + functionName, + code, + versionId, + libraryVersionIDs, + testMode, + trMetadata = {}, +) => { + try { + logger.debug(`Deploying faas fn: ${functionName}`); + const payload = buildOpenfaasFn( + functionName, + code, + versionId, + libraryVersionIDs, + testMode, + trMetadata, + ); await deployFunction(payload); - logger.debug('[Faas] Deployed a faas function'); } catch (error) { logger.error(`[Faas] Error while deploying ${functionName}: ${error.message}`); // To handle concurrent create requests, @@ -246,6 +227,95 @@ async function setupFaasFunction( } } +// reconcileFn runs everytime the service boot's up +// trying to update the functions which are not in cache to the +// latest label and envVars +const reconcileFn = async (name, versionId, libraryVersionIDs, trMetadata) => { + if (DISABLE_RECONCILE_FN) { + return; + } + + logger.debug(`Reconciling faas function: ${name}`); + try { + if (isFunctionDeployed(name)) { + return; + } + await updateFaasFunction(name, null, versionId, libraryVersionIDs, false, trMetadata); + } catch (error) { + logger.error( + `unexpected error occurred when reconciling the function ${name}: ${error.message}`, + ); + throw error; + } +}; + +// buildOpenfaasFn is helper function to build openfaas fn CRUD payload +function buildOpenfaasFn(name, code, versionId, libraryVersionIDs, testMode, trMetadata = {}) { + logger.debug(`Building faas fn: ${name}`); + + let envProcess = 'python index.py'; + const lvidsString = libraryVersionIDs.join(','); + + if (!testMode) { + envProcess = `${envProcess} --vid ${versionId} --config-backend-url ${CONFIG_BACKEND_URL} --lvids "${lvidsString}"`; + } else { + envProcess = `${envProcess} --code "${code}" --config-backend-url ${CONFIG_BACKEND_URL} --lvids "${lvidsString}"`; + } + + const envVars = {}; + + if (FAAS_ENABLE_WATCHDOG_ENV_VARS.trim().toLowerCase() === 'true') { + envVars.max_inflight = FAAS_MAX_INFLIGHT; + envVars.exec_timeout = FAAS_EXEC_TIMEOUT; + } + + if (GEOLOCATION_URL) { + envVars.geolocation_url = GEOLOCATION_URL; + } + + const labels = { + 'openfaas-fn': 'true', + 'parent-component': 'openfaas', + 'com.openfaas.scale.max': FAAS_MAX_PODS_IN_TEXT, + 'com.openfaas.scale.min': FAAS_MIN_PODS_IN_TEXT, + 'com.openfaas.scale.zero': FAAS_SCALE_ZERO, + 'com.openfaas.scale.zero-duration': FAAS_SCALE_ZERO_DURATION, + 'com.openfaas.scale.target': FAAS_SCALE_TARGET, + 'com.openfaas.scale.target-proportion': FAAS_SCALE_TARGET_PROPORTION, + 'com.openfaas.scale.type': FAAS_SCALE_TYPE, + transformationId: trMetadata.transformationId, + workspaceId: trMetadata.workspaceId, + team: 'data-management', + service: 'openfaas-fn', + customer: 'shared', + 'customer-tier': CUSTOMER_TIER, + }; + + if (trMetadata.workspaceId && customNetworkPolicyWorkspaceIds.includes(trMetadata.workspaceId)) { + labels['custom-network-policy'] = 'true'; + } + + return { + service: name, + name: name, + image: FAAS_BASE_IMG, + envProcess, + envVars, + labels, + annotations: { + 'prometheus.io.scrape': 'true', + }, + limits: { + memory: FAAS_LIMITS_MEMORY, + cpu: FAAS_LIMITS_CPU, + }, + requests: { + memory: FAAS_REQUESTS_MEMORY, + cpu: FAAS_REQUESTS_CPU, + }, + }; +} + const executeFaasFunction = async ( name, events, @@ -260,7 +330,11 @@ const executeFaasFunction = async ( let errorRaised; try { - if (testMode) await awaitFunctionReadiness(name); + if (testMode) { + await awaitFunctionReadiness(name); + } else { + await reconcileFn(name, versionId, libraryVersionIDs, trMetadata); + } return await invokeFunction(name, events); } catch (error) { logger.error(`Error while invoking ${name}: ${error.message}`); @@ -268,6 +342,7 @@ const executeFaasFunction = async ( if (error.statusCode === 404 && error.message.includes(`error finding function ${name}`)) { removeFunctionFromCache(name); + await setupFaasFunction(name, null, versionId, libraryVersionIDs, testMode, trMetadata); throw new RetryRequestError(`${name} not found`); } @@ -314,6 +389,8 @@ module.exports = { executeFaasFunction, setupFaasFunction, invalidateFnCache, + buildOpenfaasFn, FAAS_AST_VID, FAAS_AST_FN_NAME, + setFunctionInCache, }; diff --git a/src/util/prometheus.js b/src/util/prometheus.js index a618d35068..78d32c9cb9 100644 --- a/src/util/prometheus.js +++ b/src/util/prometheus.js @@ -613,12 +613,6 @@ class Prometheus { type: 'gauge', labelNames: ['destination_id'], }, - { - name: 'mixpanel_batch_track_pack_size', - help: 'mixpanel_batch_track_pack_size', - type: 'gauge', - labelNames: ['destination_id'], - }, { name: 'mixpanel_batch_import_pack_size', help: 'mixpanel_batch_import_pack_size', diff --git a/src/v0/destinations/awin/transform.js b/src/v0/destinations/awin/transform.js index 68dd9d62e1..0e1e220548 100644 --- a/src/v0/destinations/awin/transform.js +++ b/src/v0/destinations/awin/transform.js @@ -3,6 +3,7 @@ const { BASE_URL, ConfigCategory, mappingConfig } = require('./config'); const { defaultRequestConfig, constructPayload, simpleProcessRouterDest } = require('../../util'); const { getParams, trackProduct, populateCustomTransactionProperties } = require('./utils'); +const { FilteredEventsError } = require('../../util/errorTypes'); const responseBuilder = (message, { Config }) => { const { advertiserId, eventsToTrack, customFieldMap } = Config; @@ -33,9 +34,9 @@ const responseBuilder = (message, { Config }) => { ...customTransactionProperties, }; } else { - throw new InstrumentationError( - "Event is not present in 'Events to Track' list. Aborting message.", - 400, + throw new FilteredEventsError( + "Event is not present in 'Events to Track' list. Dropping the event.", + 298, ); } } diff --git a/src/v0/destinations/facebook_offline_conversions/utils.js b/src/v0/destinations/facebook_offline_conversions/utils.js index c48de4e0b9..460ef71176 100644 --- a/src/v0/destinations/facebook_offline_conversions/utils.js +++ b/src/v0/destinations/facebook_offline_conversions/utils.js @@ -396,7 +396,7 @@ const preparePayload = (facebookOfflineConversionsPayload, destination) => { const keys = Object.keys(facebookOfflineConversionsPayload); keys.forEach((key) => { if (isHashRequired && HASHING_REQUIRED_KEYS.includes(key)) { - payload[key] = sha256(facebookOfflineConversionsPayload[key]); + payload[key] = sha256(facebookOfflineConversionsPayload[key].trim()); } else { payload[key] = facebookOfflineConversionsPayload[key]; } @@ -407,8 +407,8 @@ const preparePayload = (facebookOfflineConversionsPayload, destination) => { ? facebookOfflineConversionsPayload.name.split(' ') : null; if (split !== null && Array.isArray(split) && split.length === 2) { - payload.fn = isHashRequired ? sha256(split[0]) : split[0]; - payload.ln = isHashRequired ? sha256(split[1]) : split[1]; + payload.fn = isHashRequired ? sha256(split[0].trim()) : split[0]; + payload.ln = isHashRequired ? sha256(split[1].trim()) : split[1]; } delete payload.name; } diff --git a/src/v0/destinations/fb/transform.js b/src/v0/destinations/fb/transform.js index e6f8e986cf..1160cef407 100644 --- a/src/v0/destinations/fb/transform.js +++ b/src/v0/destinations/fb/transform.js @@ -90,7 +90,7 @@ function sanityCheckPayloadForTypesAndModifications(updatedEvent) { clonedUpdatedEvent[prop] !== '' ) { isUDSet = true; - clonedUpdatedEvent[prop] = sha256(clonedUpdatedEvent[prop].toLowerCase()); + clonedUpdatedEvent[prop] = sha256(clonedUpdatedEvent[prop].trim().toLowerCase()); } break; case 'ud[zp]': @@ -113,7 +113,7 @@ function sanityCheckPayloadForTypesAndModifications(updatedEvent) { } else { isUDSet = true; clonedUpdatedEvent[prop] = sha256( - clonedUpdatedEvent[prop].toLowerCase() === 'female' ? 'f' : 'm', + clonedUpdatedEvent[prop].trim().toLowerCase() === 'female' ? 'f' : 'm', ); } } @@ -128,7 +128,7 @@ function sanityCheckPayloadForTypesAndModifications(updatedEvent) { if (clonedUpdatedEvent[prop] && clonedUpdatedEvent[prop] !== '') { isUDSet = true; clonedUpdatedEvent[prop] = sha256( - clonedUpdatedEvent[prop].toLowerCase().replace(/ /g, ''), + clonedUpdatedEvent[prop].trim().toLowerCase().replace(/ /g, ''), ); } break; diff --git a/src/v0/destinations/fb_custom_audience/transform.js b/src/v0/destinations/fb_custom_audience/transform.js index 9320a3476b..dfe9a04618 100644 --- a/src/v0/destinations/fb_custom_audience/transform.js +++ b/src/v0/destinations/fb_custom_audience/transform.js @@ -20,6 +20,7 @@ const { prepareDataField, getSchemaForEventMappedToDest, batchingWithPayloadSize, + generateAppSecretProof, } = require('./util'); const { getEndPoint, @@ -88,7 +89,7 @@ const prepareResponse = ( userSchema, isHashRequired = true, ) => { - const { accessToken, disableFormat, type, subType, isRaw } = destination.Config; + const { accessToken, disableFormat, type, subType, isRaw, appSecret } = destination.Config; const mappedToDestination = get(message, MappedToDestinationKey); @@ -105,6 +106,12 @@ const prepareResponse = ( prepareParams.access_token = accessToken; + if (isDefinedAndNotNullAndNotEmpty(appSecret)) { + const dateNow = Date.now(); + prepareParams.appsecret_time = Math.floor(dateNow / 1000); // Get current Unix time in seconds + prepareParams.appsecret_proof = generateAppSecretProof(accessToken, appSecret, dateNow); + } + // creating the payload field for parameters if (isRaw) { paramsPayload.is_raw = isRaw; diff --git a/src/v0/destinations/fb_custom_audience/util.js b/src/v0/destinations/fb_custom_audience/util.js index 1f096215f3..9385dfbd36 100644 --- a/src/v0/destinations/fb_custom_audience/util.js +++ b/src/v0/destinations/fb_custom_audience/util.js @@ -1,5 +1,6 @@ const lodash = require('lodash'); const sha256 = require('sha256'); +const crypto = require('crypto'); const get = require('get-value'); const jsonSize = require('json-size'); const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); @@ -206,4 +207,23 @@ const prepareDataField = ( return data; }; -module.exports = { prepareDataField, getSchemaForEventMappedToDest, batchingWithPayloadSize }; +// ref: https://developers.facebook.com/docs/facebook-login/security/#generate-the-proof + +const generateAppSecretProof = (accessToken, appSecret, dateNow) => { + const currentTime = Math.floor(dateNow / 1000); // Get current Unix time in seconds + const data = `${accessToken}|${currentTime}`; + + // Creating a HMAC SHA-256 hash with the app_secret as the key + const hmac = crypto.createHmac('sha256', appSecret); + hmac.update(data); + const appsecretProof = hmac.digest('hex'); + + return appsecretProof; +}; + +module.exports = { + prepareDataField, + getSchemaForEventMappedToDest, + batchingWithPayloadSize, + generateAppSecretProof, +}; diff --git a/src/v0/destinations/google_adwords_enhanced_conversions/data/trackConfig.json b/src/v0/destinations/google_adwords_enhanced_conversions/data/trackConfig.json index bf5485270b..c38b24598d 100644 --- a/src/v0/destinations/google_adwords_enhanced_conversions/data/trackConfig.json +++ b/src/v0/destinations/google_adwords_enhanced_conversions/data/trackConfig.json @@ -55,7 +55,7 @@ "sourceFromGenericMap": true, "required": false, "metadata": { - "type": "hashToSha256" + "type": ["trim", "hashToSha256"] } }, { @@ -64,7 +64,7 @@ "sourceFromGenericMap": true, "required": false, "metadata": { - "type": "hashToSha256" + "type": ["trim", "hashToSha256"] } }, { @@ -73,7 +73,7 @@ "sourceFromGenericMap": true, "required": false, "metadata": { - "type": "hashToSha256" + "type": ["trim", "hashToSha256"] } }, { @@ -82,7 +82,7 @@ "sourceFromGenericMap": true, "required": false, "metadata": { - "type": "hashToSha256" + "type": ["trim", "hashToSha256"] } }, { @@ -127,7 +127,7 @@ "sourceKeys": ["context.traits.streetAddress", "context.traits.address"], "required": false, "metadata": { - "type": "hashToSha256" + "type": ["trim", "hashToSha256"] } } ] diff --git a/src/v0/destinations/google_adwords_enhanced_conversions/transform.js b/src/v0/destinations/google_adwords_enhanced_conversions/transform.js index 0be7c3f0ee..55d0c16c8c 100644 --- a/src/v0/destinations/google_adwords_enhanced_conversions/transform.js +++ b/src/v0/destinations/google_adwords_enhanced_conversions/transform.js @@ -24,7 +24,7 @@ const { JSON_MIME_TYPE } = require('../../util/constant'); const updateMappingJson = (mapping) => { const newMapping = []; mapping.forEach((element) => { - if (get(element, 'metadata.type') && element.metadata.type === 'hashToSha256') { + if (get(element, 'metadata.type') && element.metadata.type.includes('hashToSha256')) { element.metadata.type = 'toString'; } newMapping.push(element); diff --git a/src/v0/destinations/google_adwords_offline_conversions/utils.js b/src/v0/destinations/google_adwords_offline_conversions/utils.js index 70b42e2157..dfa892a769 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/utils.js +++ b/src/v0/destinations/google_adwords_offline_conversions/utils.js @@ -140,17 +140,17 @@ const buildAndGetAddress = (message, hashUserIdentifier) => { const address = constructPayload(message, trackAddStoreAddressConversionsMapping); if (address.hashed_last_name) { address.hashed_last_name = hashUserIdentifier - ? sha256(address.hashed_last_name).toString() + ? sha256(address.hashed_last_name.trim()).toString() : address.hashed_last_name; } if (address.hashed_first_name) { address.hashed_first_name = hashUserIdentifier - ? sha256(address.hashed_first_name).toString() + ? sha256(address.hashed_first_name.trim()).toString() : address.hashed_first_name; } if (address.hashed_street_address) { address.hashed_street_address = hashUserIdentifier - ? sha256(address.hashed_street_address).toString() + ? sha256(address.hashed_street_address.trim()).toString() : address.hashed_street_address; } return Object.keys(address).length > 0 ? address : null; @@ -269,8 +269,10 @@ const getAddConversionPayload = (message, Config) => { const phone = getFieldValueFromMessage(message, 'phone'); const userIdentifierInfo = { - email: hashUserIdentifier && isDefinedAndNotNull(email) ? sha256(email).toString() : email, - phone: hashUserIdentifier && isDefinedAndNotNull(phone) ? sha256(phone).toString() : phone, + email: + hashUserIdentifier && isDefinedAndNotNull(email) ? sha256(email.trim()).toString() : email, + phone: + hashUserIdentifier && isDefinedAndNotNull(phone) ? sha256(phone.trim()).toString() : phone, address: buildAndGetAddress(message, hashUserIdentifier), }; @@ -363,8 +365,10 @@ const getClickConversionPayloadAndEndpoint = ( // Ref - https://developers.google.com/google-ads/api/rest/reference/rest/v11/customers/uploadClickConversions#ClickConversion const userIdentifierInfo = { - email: hashUserIdentifier && isDefinedAndNotNull(email) ? sha256(email).toString() : email, - phone: hashUserIdentifier && isDefinedAndNotNull(phone) ? sha256(phone).toString() : phone, + email: + hashUserIdentifier && isDefinedAndNotNull(email) ? sha256(email.trim()).toString() : email, + phone: + hashUserIdentifier && isDefinedAndNotNull(phone) ? sha256(phone.trim()).toString() : phone, }; const keyName = getExisitingUserIdentifier(userIdentifierInfo, defaultUserIdentifier); diff --git a/src/v0/destinations/impact/transform.js b/src/v0/destinations/impact/transform.js index 2eefdf7992..729f988938 100644 --- a/src/v0/destinations/impact/transform.js +++ b/src/v0/destinations/impact/transform.js @@ -59,7 +59,7 @@ const buildPageLoadPayload = (message, campaignId, impactAppId, enableEmailHashi let payload = constructPayload(message, MAPPING_CONFIG[CONFIG_CATEGORIES.PAGELOAD.name]); if (isDefinedAndNotNull(payload.CustomerEmail)) { payload.CustomerEmail = enableEmailHashing - ? sha1(payload?.CustomerEmail) + ? sha1(payload?.CustomerEmail.trim()) : payload?.CustomerEmail; } payload.CampaignId = campaignId; @@ -155,7 +155,7 @@ const processTrackEvent = (message, Config) => { payload.ImpactAppId = impactAppId; if (isDefinedAndNotNull(payload.CustomerEmail)) { payload.CustomerEmail = enableEmailHashing - ? sha1(payload?.CustomerEmail) + ? sha1(payload?.CustomerEmail.trim()) : payload?.CustomerEmail; } diff --git a/src/v0/destinations/mp/config.js b/src/v0/destinations/mp/config.js index 35b40294f5..3abdf2eebb 100644 --- a/src/v0/destinations/mp/config.js +++ b/src/v0/destinations/mp/config.js @@ -49,7 +49,6 @@ const MP_IDENTIFY_EXCLUSION_LIST = [ ]; const GEO_SOURCE_ALLOWED_VALUES = [null, 'reverse_geocoding']; -const TRACK_MAX_BATCH_SIZE = 50; const IMPORT_MAX_BATCH_SIZE = 2000; const ENGAGE_MAX_BATCH_SIZE = 2000; const GROUPS_MAX_BATCH_SIZE = 200; @@ -68,7 +67,6 @@ module.exports = { MP_IDENTIFY_EXCLUSION_LIST, getCreateDeletionTaskEndpoint, DISTINCT_ID_MAX_BATCH_SIZE, - TRACK_MAX_BATCH_SIZE, IMPORT_MAX_BATCH_SIZE, ENGAGE_MAX_BATCH_SIZE, GROUPS_MAX_BATCH_SIZE, diff --git a/src/v0/destinations/mp/transform.js b/src/v0/destinations/mp/transform.js index 09a7862f9a..2065764b98 100644 --- a/src/v0/destinations/mp/transform.js +++ b/src/v0/destinations/mp/transform.js @@ -24,7 +24,6 @@ const { mappingConfig, BASE_ENDPOINT, BASE_ENDPOINT_EU, - TRACK_MAX_BATCH_SIZE, IMPORT_MAX_BATCH_SIZE, ENGAGE_MAX_BATCH_SIZE, GROUPS_MAX_BATCH_SIZE, @@ -47,21 +46,19 @@ const mPEventPropertiesConfigJson = mappingConfig[ConfigCategory.EVENT_PROPERTIE const setImportCredentials = (destConfig) => { const endpoint = destConfig.dataResidency === 'eu' ? `${BASE_ENDPOINT_EU}/import/` : `${BASE_ENDPOINT}/import/`; - const headers = { 'Content-Type': 'application/json' }; const params = { strict: destConfig.strictMode ? 1 : 0 }; - const { apiSecret, serviceAccountUserName, serviceAccountSecret, projectId } = destConfig; - if (apiSecret) { - headers.Authorization = `Basic ${base64Convertor(`${apiSecret}:`)}`; + const { serviceAccountUserName, serviceAccountSecret, projectId, token } = destConfig; + let credentials; + if (token) { + credentials = `${token}:`; } else if (serviceAccountUserName && serviceAccountSecret && projectId) { - headers.Authorization = `Basic ${base64Convertor( - `${serviceAccountUserName}:${serviceAccountSecret}`, - )}`; + credentials = `${serviceAccountUserName}:${serviceAccountSecret}`; params.projectId = projectId; - } else { - throw new InstrumentationError( - 'Event timestamp is older than 5 days and no API secret or service account credentials (i.e. username, secret and projectId) are provided in destination configuration', - ); } + const headers = { + 'Content-Type': 'application/json', + Authorization: `Basic ${base64Convertor(credentials)}`, + }; return { endpoint, headers, params }; }; @@ -70,46 +67,34 @@ const responseBuilderSimple = (payload, message, eventType, destConfig) => { response.method = defaultPostRequestConfig.requestMethod; response.userId = message.userId || message.anonymousId; response.body.JSON_ARRAY = { batch: JSON.stringify([removeUndefinedValues(payload)]) }; - const { apiSecret, serviceAccountUserName, serviceAccountSecret, projectId, dataResidency } = - destConfig; + const { dataResidency } = destConfig; const duration = getTimeDifference(message.timestamp); + + const setCredentials = () => { + const credentials = setImportCredentials(destConfig); + response.endpoint = credentials.endpoint; + response.headers = credentials.headers; + response.params = { + project_id: credentials.params?.projectId, + strict: credentials.params.strict, + }; + }; + switch (eventType) { case EventType.ALIAS: case EventType.TRACK: case EventType.SCREEN: - case EventType.PAGE: - if ( - !apiSecret && - !(serviceAccountUserName && serviceAccountSecret && projectId) && - duration.days <= 5 - ) { - response.endpoint = - dataResidency === 'eu' ? `${BASE_ENDPOINT_EU}/track/` : `${BASE_ENDPOINT}/track/`; - response.headers = {}; - } else if (duration.years > 5) { + case EventType.PAGE: { + if (duration.years > 5) { throw new InstrumentationError('Event timestamp should be within last 5 years'); - } else { - const credentials = setImportCredentials(destConfig); - response.endpoint = credentials.endpoint; - response.headers = credentials.headers; - response.params = { - project_id: credentials.params?.projectId, - strict: credentials.params.strict, - }; - break; } + setCredentials(); break; - case 'merge': - // eslint-disable-next-line no-case-declarations - const credentials = setImportCredentials(destConfig); - response.endpoint = credentials.endpoint; - response.headers = credentials.headers; - response.params = { - project_id: credentials.params?.projectId, - strict: credentials.params.strict, - }; + } + case 'merge': { + setCredentials(); break; - + } default: response.endpoint = dataResidency === 'eu' ? `${BASE_ENDPOINT_EU}/engage/` : `${BASE_ENDPOINT}/engage/`; @@ -484,7 +469,6 @@ const processRouterDest = async (inputs, reqMetadata) => { const batchSize = { engage: 0, groups: 0, - track: 0, import: 0, }; @@ -516,23 +500,16 @@ const processRouterDest = async (inputs, reqMetadata) => { ); transformedPayloads = lodash.flatMap(transformedPayloads); - const { engageEvents, groupsEvents, trackEvents, importEvents, batchErrorRespList } = + const { engageEvents, groupsEvents, importEvents, batchErrorRespList } = groupEventsByEndpoint(transformedPayloads); const engageRespList = batchEvents(engageEvents, ENGAGE_MAX_BATCH_SIZE, reqMetadata); const groupsRespList = batchEvents(groupsEvents, GROUPS_MAX_BATCH_SIZE, reqMetadata); - const trackRespList = batchEvents(trackEvents, TRACK_MAX_BATCH_SIZE, reqMetadata); const importRespList = batchEvents(importEvents, IMPORT_MAX_BATCH_SIZE, reqMetadata); - const batchSuccessRespList = [ - ...engageRespList, - ...groupsRespList, - ...trackRespList, - ...importRespList, - ]; + const batchSuccessRespList = [...engageRespList, ...groupsRespList, ...importRespList]; batchSize.engage += engageRespList.length; batchSize.groups += groupsRespList.length; - batchSize.track += trackRespList.length; batchSize.import += importRespList.length; return [...batchSuccessRespList, ...batchErrorRespList]; diff --git a/src/v0/destinations/mp/util.js b/src/v0/destinations/mp/util.js index d564e805ad..b2807d6e11 100644 --- a/src/v0/destinations/mp/util.js +++ b/src/v0/destinations/mp/util.js @@ -136,7 +136,7 @@ const createIdentifyResponse = (message, type, destination, responseBuilderSimpl * @returns */ const isImportAuthCredentialsAvailable = (destination) => - destination.Config.apiSecret || + destination.Config.token || (destination.Config.serviceAccountSecret && destination.Config.serviceAccountUserName && destination.Config.projectId); @@ -179,7 +179,6 @@ const groupEventsByEndpoint = (events) => { const eventMap = { engage: [], groups: [], - track: [], import: [], }; const batchErrorRespList = []; @@ -204,7 +203,6 @@ const groupEventsByEndpoint = (events) => { return { engageEvents: eventMap.engage, groupsEvents: eventMap.groups, - trackEvents: eventMap.track, importEvents: eventMap.import, batchErrorRespList, }; @@ -349,7 +347,6 @@ const generatePageOrScreenCustomEventName = (message, userDefinedEventTemplate) * @param {Object} batchSize - The object containing the batch size for different endpoints. * @param {number} batchSize.engage - The batch size for engage endpoint. * @param {number} batchSize.groups - The batch size for group endpoint. - * @param {number} batchSize.track - The batch size for track endpoint. * @param {number} batchSize.import - The batch size for import endpoint. * @param {string} destinationId - The ID of the destination. * @returns {void} @@ -361,9 +358,6 @@ const recordBatchSizeMetrics = (batchSize, destinationId) => { stats.gauge('mixpanel_batch_group_pack_size', batchSize.groups, { destination_id: destinationId, }); - stats.gauge('mixpanel_batch_track_pack_size', batchSize.track, { - destination_id: destinationId, - }); stats.gauge('mixpanel_batch_import_pack_size', batchSize.import, { destination_id: destinationId, }); diff --git a/src/v0/destinations/mp/util.test.js b/src/v0/destinations/mp/util.test.js index 40cdb34649..3666081f59 100644 --- a/src/v0/destinations/mp/util.test.js +++ b/src/v0/destinations/mp/util.test.js @@ -18,7 +18,6 @@ describe('Unit test cases for groupEventsByEndpoint', () => { expect(result).toEqual({ engageEvents: [], groupsEvents: [], - trackEvents: [], importEvents: [], batchErrorRespList: [], }); @@ -122,19 +121,6 @@ describe('Unit test cases for groupEventsByEndpoint', () => { }, }, ], - trackEvents: [ - { - message: { - endpoint: '/track', - body: { - JSON_ARRAY: { - batch: '[{prop:4}]', - }, - }, - userId: 'user1', - }, - }, - ], importEvents: [ { message: { diff --git a/src/v0/destinations/pinterest_tag/utils.js b/src/v0/destinations/pinterest_tag/utils.js index 340fba498e..57d595571f 100644 --- a/src/v0/destinations/pinterest_tag/utils.js +++ b/src/v0/destinations/pinterest_tag/utils.js @@ -41,8 +41,8 @@ const getHashedValue = (key, value) => { case 'fn': case 'ge': value = Array.isArray(value) - ? value.map((val) => val.toString().toLowerCase()) - : value.toString().toLowerCase(); + ? 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 @@ -53,7 +53,7 @@ const getHashedValue = (key, value) => { case 'zp': // zip fields should only contain digits value = Array.isArray(value) - ? value.map((val) => val.toString().replace(/\D/g, '')) + ? value.map((val) => val.toString().trim().replace(/\D/g, '')) : value.toString().replace(/\D/g, ''); break; case 'hashed_maids': diff --git a/src/v0/destinations/redis/transform.js b/src/v0/destinations/redis/transform.js index 23c73f0ba4..ec0e858d3e 100644 --- a/src/v0/destinations/redis/transform.js +++ b/src/v0/destinations/redis/transform.js @@ -2,7 +2,7 @@ const lodash = require('lodash'); const flatten = require('flat'); const { InstrumentationError } = require('@rudderstack/integrations-lib'); -const { isEmpty, isObject } = require('../../util'); +const { isEmpty, isObject, getFieldValueFromMessage } = require('../../util'); const { EventType } = require('../../../constants'); // processValues: @@ -46,6 +46,19 @@ const transformSubEventTypeProfiles = (message, workspaceId, destinationId) => { }; }; +const getJSONValue = (message) => { + const eventType = message.type.toLowerCase(); + if (eventType === EventType.IDENTIFY) { + return getFieldValueFromMessage(message, 'traits'); + } + return {}; +}; + +const getTransformedPayloadForJSON = ({ key, path, value, userId }) => ({ + message: { key, path, value }, + userId, +}); + const process = (event) => { const { message, destination, metadata } = event; const messageType = message && message.type && message.type.toLowerCase(); @@ -58,15 +71,35 @@ const process = (event) => { throw new InstrumentationError('Blank userId passed in identify event'); } - const { prefix } = destination.Config; + const { prefix, useJSONModule } = destination.Config; const destinationId = destination.ID; const keyPrefix = isEmpty(prefix) ? '' : `${prefix.trim()}:`; + const jsonValue = getJSONValue(message); + if (isSubEventTypeProfiles(message)) { const { workspaceId } = metadata; + if (useJSONModule) { + // If redis should store information as JSON type + return getTransformedPayloadForJSON({ + key: `${workspaceId}:${destinationId}:${message.context.sources.profiles_entity}:${message.context.sources.profiles_id_type}:${message.userId}`, + path: message.context.sources.profiles_model, + value: jsonValue, + userId: message.userId, + }); + } return transformSubEventTypeProfiles(message, workspaceId, destinationId); } + if (useJSONModule) { + // If redis should store information as JSON type + return getTransformedPayloadForJSON({ + key: `${keyPrefix}user:${lodash.toString(message.userId)}`, + value: jsonValue, + userId: message.userId, + }); + } + const hmap = { key: `${keyPrefix}user:${lodash.toString(message.userId)}`, fields: {}, diff --git a/src/v0/destinations/tiktok_ads/data/TikTokTrackV2.json b/src/v0/destinations/tiktok_ads/data/TikTokTrackV2.json index 530d6e392a..2910f1b44c 100644 --- a/src/v0/destinations/tiktok_ads/data/TikTokTrackV2.json +++ b/src/v0/destinations/tiktok_ads/data/TikTokTrackV2.json @@ -25,10 +25,7 @@ }, { "destKey": "properties.content_type", - "sourceKeys": ["properties.contentType", "properties.content_type"], - "metadata": { - "defaultValue": "product" - } + "sourceKeys": ["properties.contentType", "properties.content_type"] }, { "destKey": "properties.shop_id", diff --git a/src/v0/destinations/tiktok_ads/transformV2.js b/src/v0/destinations/tiktok_ads/transformV2.js index 3bd8699e3a..4624ec9181 100644 --- a/src/v0/destinations/tiktok_ads/transformV2.js +++ b/src/v0/destinations/tiktok_ads/transformV2.js @@ -31,7 +31,7 @@ const { JSON_MIME_TYPE } = require('../../util/constant'); * @param {*} event * @returns track payload */ -const getTrackResponsePayload = (message, destConfig, event) => { +const getTrackResponsePayload = (message, destConfig, event, setDefaultForContentType = true) => { const payload = constructPayload(message, trackMappingV2); // if contents is not an array converting it into array @@ -53,6 +53,10 @@ const getTrackResponsePayload = (message, destConfig, event) => { if (destConfig.hashUserProperties && isDefinedAndNotNullAndNotEmpty(payload.user)) { payload.user = hashUserField(payload.user); } + // setting content-type default value in case of all standard event except `page-view` + if (!payload.properties?.content_type && setDefaultForContentType) { + payload.properties.content_type = 'product'; + } payload.event = event; // add partner name and return payload return removeUndefinedAndNullValues(payload); @@ -90,13 +94,17 @@ const trackResponseBuilder = async (message, { Config }) => { }); } }); - } else { + } else if (!eventNameMapping[event]) { /* + Custom Event Case -> if there exists no event mapping we will build payload with custom event recieved For custom event we do not want to lower case the event or trim it we just want to send those as it is Doc https://ads.tiktok.com/help/article/standard-events-parameters?lang=en */ - event = eventNameMapping[event] || message.event; - // if there exists no event mapping we will build payload with custom event recieved + event = message.event; + responseList.push(getTrackResponsePayload(message, Config, event, false)); + } else { + // incoming event name is already a standard event name + event = eventNameMapping[event]; responseList.push(getTrackResponsePayload(message, Config, event)); } // set event source and event_source_id diff --git a/src/v0/destinations/yahoo_dsp/util.js b/src/v0/destinations/yahoo_dsp/util.js index 255f84d1c9..54002a3bce 100644 --- a/src/v0/destinations/yahoo_dsp/util.js +++ b/src/v0/destinations/yahoo_dsp/util.js @@ -51,7 +51,7 @@ const populateIdentifiers = (audienceList, Config) => { } // here, hashing the data if is not hashed and pushing in the seedList array. if (hashRequired) { - seedList.push(sha256(userTraits[audienceAttribute])); + seedList.push(sha256(userTraits[audienceAttribute].trim())); } else { seedList.push(userTraits[audienceAttribute]); } diff --git a/src/v0/sources/adjust/config.ts b/src/v0/sources/adjust/config.ts new file mode 100644 index 0000000000..d1c6ab8242 --- /dev/null +++ b/src/v0/sources/adjust/config.ts @@ -0,0 +1,16 @@ +export const excludedFieldList = [ + 'activity_kind', + 'event', + 'event_name', + 'gps_adid', + 'idfa', + 'idfv', + 'adid', + 'tracker', + 'tracker_name', + 'app_name', + 'ip_address', + 'tracking_enabled', + 'tracker_token', + 'created_at', +]; diff --git a/src/v0/sources/adjust/mapping.json b/src/v0/sources/adjust/mapping.json new file mode 100644 index 0000000000..60ea66281e --- /dev/null +++ b/src/v0/sources/adjust/mapping.json @@ -0,0 +1,52 @@ +[ + { + "sourceKeys": "activity_kind", + "destKeys": "properties.activity_kind" + }, + { + "sourceKeys": "event", + "destKeys": "properties.event_token" + }, + { + "sourceKeys": "event_name", + "destKeys": "event" + }, + { + "sourceKeys": "gps_adid", + "destKeys": "properties.gps_adid" + }, + { + "sourceKeys": "idfa", + "destKeys": "context.device.advertisingId" + }, + { + "sourceKeys": "idfv", + "destKeys": "context.device.id" + }, + { + "sourceKeys": "adid", + "destKeys": "context.device.id " + }, + { + "sourceKeys": "tracker", + "destKeys": "properties.tracker" + }, + { + "sourceKeys": "tracker_name", + "destKeys": "properties.tracker_name" + }, + { "sourceKeys": "tracker_token", "destKeys": "properties.tracker_token" }, + + { + "sourceKeys": "app_name", + "destKeys": "context.app.name" + }, + { + "sourceKeys": "ip_address", + "destKeys": ["context.ip", "request_ip"] + }, + { + "sourceKeys": "tracking_enabled", + "destKeys": "properties.tracking_enabled" + } +] diff --git a/src/v0/sources/adjust/transform.js b/src/v0/sources/adjust/transform.js new file mode 100644 index 0000000000..8568622aeb --- /dev/null +++ b/src/v0/sources/adjust/transform.js @@ -0,0 +1,61 @@ +const lodash = require('lodash'); +const path = require('path'); +const fs = require('fs'); +const { TransformationError, structuredLogger: logger } = require('@rudderstack/integrations-lib'); +const Message = require('../message'); +const { CommonUtils } = require('../../../util/common'); +const { excludedFieldList } = require('./config'); +const { extractCustomFields, generateUUID } = require('../../util'); + +// ref : https://help.adjust.com/en/article/global-callbacks#general-recommended-placeholders +// import mapping json using JSON.parse to preserve object key order +const mapping = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); + +const formatProperties = (input) => { + const { query_parameters: qParams } = input; + logger.debug(`[Adjust] Input event: query_params: ${JSON.stringify(qParams)}`); + if (!qParams) { + throw new TransformationError('Query_parameters is missing'); + } + const formattedOutput = {}; + Object.entries(qParams).forEach(([key, [value]]) => { + formattedOutput[key] = value; + }); + return formattedOutput; +}; + +const processEvent = (inputEvent) => { + const message = new Message(`Adjust`); + const event = lodash.cloneDeep(inputEvent); + const formattedPayload = formatProperties(event); + // event type is always track + const eventType = 'track'; + message.setEventType(eventType); + message.setPropertiesV2(formattedPayload, mapping); + let customProperties = {}; + customProperties = extractCustomFields( + formattedPayload, + customProperties, + 'root', + excludedFieldList, + ); + message.properties = { ...message.properties, ...customProperties }; + + if (formattedPayload.created_at) { + const ts = new Date(formattedPayload.created_at * 1000).toISOString(); + message.setProperty('originalTimestamp', ts); + message.setProperty('timestamp', ts); + } + + // adjust does not has the concept of user but we need to set some random anonymousId in order to make the server accept the message + message.anonymousId = generateUUID(); + return message; +}; + +// This fucntion just converts the incoming payload to array of already not and sends it to processEvent +const process = (events) => { + const eventsArray = CommonUtils.toArray(events); + return eventsArray.map(processEvent); +}; + +module.exports = { process }; diff --git a/src/v0/sources/auth0/mapping.json b/src/v0/sources/auth0/mapping.json index 45dcf939ad..bc5869a19b 100644 --- a/src/v0/sources/auth0/mapping.json +++ b/src/v0/sources/auth0/mapping.json @@ -62,5 +62,9 @@ { "sourceKeys": "date", "destKeys": ["originalTimestamp", "sentAt"] + }, + { + "sourceKeys": "type", + "destKeys": "source_type" } ] diff --git a/src/v0/util/facebookUtils/index.js b/src/v0/util/facebookUtils/index.js index c7753d255f..7462320cca 100644 --- a/src/v0/util/facebookUtils/index.js +++ b/src/v0/util/facebookUtils/index.js @@ -292,7 +292,13 @@ const formingFinalResponse = ( throw new TransformationError('Payload could not be constructed'); }; +const isHtmlFormat = (string) => { + const htmlTags = /<(?!(!doctype\s*html|html))\b[^>]*>[\S\s]*?<\/[^>]*>/i; + return htmlTags.test(string); +}; + module.exports = { + isHtmlFormat, getContentType, getContentCategory, transformedPayloadData, diff --git a/src/v0/util/facebookUtils/index.test.js b/src/v0/util/facebookUtils/index.test.js index 20c4ee59f2..1a2de4ed12 100644 --- a/src/v0/util/facebookUtils/index.test.js +++ b/src/v0/util/facebookUtils/index.test.js @@ -3,6 +3,7 @@ const { fetchUserData, deduceFbcParam, getContentType, + isHtmlFormat, } = require('./index'); const sha256 = require('sha256'); const { MAPPING_CONFIG, CONFIG_CATEGORIES } = require('../../destinations/facebook_pixel/config'); @@ -639,3 +640,53 @@ describe('getContentType', () => { expect(result).toBe(defaultValue); }); }); + +describe('isHtmlFormat', () => { + it('should return false for Json', () => { + expect(isHtmlFormat('{"a": 1, "b":2}')).toBe(false); + }); + + it('should return false for empty Json', () => { + expect(isHtmlFormat('{}')).toBe(false); + }); + + it('should return false for undefined', () => { + expect(isHtmlFormat(undefined)).toBe(false); + }); + + it('should return false for null', () => { + expect(isHtmlFormat(null)).toBe(false); + }); + + it('should return false for empty array', () => { + expect(isHtmlFormat([])).toBe(false); + }); + + it('should return true for html doctype', () => { + expect( + isHtmlFormat( + '

Sorry, something went wrong.

We\'re working on it and we\'ll get it fixed as soon as we can.

Go Back

', + ), + ).toBe(true); + }); + + it('should return true for html', () => { + expect( + isHtmlFormat( + ' Hello, World!

Hello World!

', + ), + ).toBe(true); + }); + + it('should return true for html', () => { + expect( + isHtmlFormat( + '

Hello World!

', + ), + ).toBe(true); + }); + + it('should return false json type', () => { + expect(isHtmlFormat('{"": 12, "b": "test, "arr": [1,2]}')).toBe(false); + }); +}); diff --git a/src/v0/util/facebookUtils/networkHandler.js b/src/v0/util/facebookUtils/networkHandler.js index d5a731067f..a84128e140 100644 --- a/src/v0/util/facebookUtils/networkHandler.js +++ b/src/v0/util/facebookUtils/networkHandler.js @@ -14,6 +14,7 @@ const { } = require('../../../adapters/utils/networkUtils'); const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network'); const { ErrorDetailsExtractorBuilder } = require('../../../util/error-extractor'); +const { isHtmlFormat } = require('./index'); /** * Only under below mentioned scenario(s), add the errorCodes, subCodes etc,. to this map @@ -277,6 +278,18 @@ const errorResponseHandler = (destResponse) => { const destResponseHandler = (responseParams) => { const { destinationResponse } = responseParams; + + // check If the response is in html format + if (isHtmlFormat(destinationResponse.response) || isHtmlFormat(destinationResponse)) { + throw new NetworkError( + 'Invalid response format (HTML) during response transformation', + 500, + { + [TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(destinationResponse.status), + }, + destinationResponse, + ); + } errorResponseHandler(destinationResponse); return { destinationResponse: destinationResponse.response, diff --git a/test/__tests__/user_transformation.test.js b/test/__tests__/user_transformation.test.js index 924bf4f791..ffb53de16b 100644 --- a/test/__tests__/user_transformation.test.js +++ b/test/__tests__/user_transformation.test.js @@ -7,9 +7,11 @@ jest.mock("axios", () => ({ ...jest.requireActual("axios"), get: jest.fn(), post: jest.fn(), - delete: jest.fn() + delete: jest.fn(), + put: jest.fn() })); +const { generateFunctionName } = require('../../src/util/customTransformer-faas.js'); const { Response, Headers } = jest.requireActual("node-fetch"); const lodashCore = require("lodash/core"); const _ = require("lodash"); @@ -35,6 +37,7 @@ const { } = require("../../src/util/customTransformer"); const { parserForImport } = require("../../src/util/parser"); const { RetryRequestError, RespStatusError } = require("../../src/util/utils"); +const { buildOpenfaasFn, setFunctionInCache, invalidateFnCache } = require("../../src/util/openfaas/index"); const OPENFAAS_GATEWAY_URL = "http://localhost:8080"; const defaultBasicAuth = { @@ -88,8 +91,12 @@ const pyLibCode = (name, versionId) => { } } -const pyfaasFuncName = (workspaceId, versionId, libraryVersionIds=[]) => { - const ids = [workspaceId, versionId].concat(libraryVersionIds.sort()); +const pyfaasFuncName = (workspaceId, versionId, libraryVersionIds=[], hashSecret="") => { + let ids = [workspaceId, versionId].concat(libraryVersionIds.sort()); + if (hashSecret !== "") { + ids = ids.concat([hashSecret]); + } + const hash = crypto.createHash('md5').update(`${ids}`).digest('hex'); return `fn-${workspaceId}-${hash}` @@ -105,6 +112,19 @@ const getfetchResponse = (resp, url) => let importNameLibraryVersionIdsMap; +describe("User transformation utils", () => { + + it("generates the openfaas-fn name correctly", () => { + const fnName = generateFunctionName( + {workspaceId: 'workspaceId', transformationId: 'transformationId'}, + [], + false, + 'hash-secret'); + expect(fnName).toEqual('fn-workspaceid-34a32ade07ebbc7bc5ea795b8200de9f'); + }); + +}); + describe("User transformation", () => { beforeEach(() => { jest.resetAllMocks(); @@ -1386,6 +1406,7 @@ describe("Geolocation function", () => { // Running tests for python transformations with openfaas mocks describe("Python transformations", () => { beforeEach(() => { + invalidateFnCache(); jest.resetAllMocks(); }); afterAll(() => {}); @@ -1421,6 +1442,7 @@ describe("Python transformations", () => { const expectedData = { success: true, publishedVersion: funcName }; + setFunctionInCache(funcName); const output = await setupUserTransformHandler([], trRevCode); expect(output).toEqual(expectedData); expect(axios.post).toHaveBeenCalledTimes(0); @@ -1604,7 +1626,7 @@ describe("Python transformations", () => { expect(axios.delete).toHaveBeenCalledTimes(1); }); - it("Simple transformation run - invokes faas function", async () => { + it("Simple transformation run with function in cache - invokes faas function", async () => { const inputData = require(`./data/${integration}_input.json`); const outputData = require(`./data/${integration}_output.json`); @@ -1612,6 +1634,8 @@ describe("Python transformations", () => { const respBody = pyTrRevCode(versionId); const funcName = pyfaasFuncName(respBody.workspaceId, versionId); + setFunctionInCache(funcName); + const transformerUrl = `https://api.rudderlabs.com/transformation/getByVersionId?versionId=${versionId}`; when(fetch) .calledWith(transformerUrl) @@ -1625,7 +1649,7 @@ describe("Python transformations", () => { const output = await userTransformHandler(inputData, versionId, []); expect(output).toEqual(outputData); - expect(axios.post).toHaveBeenCalledTimes(1); + expect(axios.post).toHaveBeenCalledWith( `${OPENFAAS_GATEWAY_URL}/function/${funcName}`, inputData, @@ -1633,12 +1657,16 @@ describe("Python transformations", () => { ); }); - it("Simple transformation run - function not found", async () => { + + it("Simple transformation run with clean cache - reconciles fn with 200OK and then invokes faas function", async () => { + const inputData = require(`./data/${integration}_input.json`); + const outputData = require(`./data/${integration}_output.json`); const versionId = randomID(); const respBody = pyTrRevCode(versionId); - const funcName = pyfaasFuncName(respBody.workspaceId, respBody.versionId); + const funcName = pyfaasFuncName(respBody.workspaceId, versionId); + const transformerUrl = `https://api.rudderlabs.com/transformation/getByVersionId?versionId=${versionId}`; when(fetch) @@ -1648,28 +1676,13 @@ describe("Python transformations", () => { json: jest.fn().mockResolvedValue(respBody) }); - axios.post - .mockRejectedValueOnce({ - response: { status: 404, data: `error finding function ${funcName}` } // invoke function not found - }) - .mockResolvedValueOnce({}); // create function + axios.put.mockResolvedValue({}); axios.get.mockResolvedValue({}); // awaitFunctionReadiness() + axios.post.mockResolvedValue({ data: { transformedEvents: outputData } }); - await expect(async () => { - await userTransformHandler(inputData, versionId, []); - }).rejects.toThrow(RetryRequestError); + const output = await userTransformHandler(inputData, versionId, []); + expect(output).toEqual(outputData); - expect(axios.post).toHaveBeenCalledTimes(2); - expect(axios.post).toHaveBeenCalledWith( - `${OPENFAAS_GATEWAY_URL}/function/${funcName}`, - inputData, - { auth: defaultBasicAuth }, - ); - expect(axios.post).toHaveBeenCalledWith( - `${OPENFAAS_GATEWAY_URL}/system/functions`, - expect.objectContaining({ name: funcName, service: funcName }), - { auth: defaultBasicAuth }, - ); expect(axios.get).toHaveBeenCalledTimes(1); expect(axios.get).toHaveBeenCalledWith( @@ -1677,6 +1690,154 @@ describe("Python transformations", () => { {"headers": {"X-REQUEST-TYPE": "HEALTH-CHECK"}}, { auth: defaultBasicAuth }, ); + expect(axios.put).toHaveBeenCalledTimes(1); + expect(axios.put).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/system/functions`, + buildOpenfaasFn(funcName, null, versionId, [], false, {}), + { auth: defaultBasicAuth }); + expect(axios.post).toHaveBeenCalledTimes(1); + expect(axios.post).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/function/${funcName}`, + inputData, + { auth: defaultBasicAuth }, + ); + }); + + describe("Simple transformation run with clean cache - function not found", () => { + + it('eventually sets up the function on 404 from update and then invokes it', async () => { + const inputData = require(`./data/${integration}_input.json`); + + const versionId = randomID(); + const respBody = pyTrRevCode(versionId); + const funcName = pyfaasFuncName(respBody.workspaceId, respBody.versionId); + + const transformerUrl = `https://api.rudderlabs.com/transformation/getByVersionId?versionId=${versionId}`; + when(fetch) + .calledWith(transformerUrl) + .mockResolvedValue({ + status: 200, + json: jest.fn().mockResolvedValue(respBody) + }); + + + axios.put.mockRejectedValueOnce({ + response: { status: 404, data: `deployment not found`} + }); + + axios.post + .mockRejectedValueOnce({ + response: { status: 404, data: `error finding function ${funcName}` } // invoke function not found + }) + .mockResolvedValueOnce({}); // create function + axios.get.mockResolvedValue({}); // awaitFunctionReadiness() + + await expect(async () => { + await userTransformHandler(inputData, versionId, []); + }).rejects.toThrow(RetryRequestError); + + expect(axios.put).toHaveBeenCalledTimes(1); + expect(axios.put).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/system/functions`, + buildOpenfaasFn(funcName, null, versionId, [], false, {}), + { auth: defaultBasicAuth }, + ); + expect(axios.post).toHaveBeenCalledTimes(2); + expect(axios.post).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/function/${funcName}`, + inputData, + { auth: defaultBasicAuth }, + ); + expect(axios.post).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/system/functions`, + expect.objectContaining({ name: funcName, service: funcName }), + { auth: defaultBasicAuth }, + ); + + expect(axios.get).toHaveBeenCalledTimes(1); + expect(axios.get).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/function/${funcName}`, + {"headers": {"X-REQUEST-TYPE": "HEALTH-CHECK"}}, + { auth: defaultBasicAuth }, + ); + }); + + it('sets up the function on 202 from update and then invokes it', async() => { + const inputData = require(`./data/${integration}_input.json`); + const outputData = require(`./data/${integration}_output.json`); + + const versionId = randomID(); + const respBody = pyTrRevCode(versionId); + const funcName = pyfaasFuncName(respBody.workspaceId, respBody.versionId); + + const transformerUrl = `https://api.rudderlabs.com/transformation/getByVersionId?versionId=${versionId}`; + when(fetch) + .calledWith(transformerUrl) + .mockResolvedValue({ + status: 200, + json: jest.fn().mockResolvedValue(respBody) + }); + + + axios.put.mockResolvedValueOnce({ + response: { status: 202, data: `deployment created`} + }); + axios.get.mockResolvedValue({}); // awaitFunctionReadiness() + axios.post.mockResolvedValue({ data: { transformedEvents: outputData } }); + + const output = await userTransformHandler(inputData, versionId, []); + expect(output).toEqual(outputData); + + expect(axios.put).toHaveBeenCalledTimes(1); + expect(axios.put).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/system/functions`, + buildOpenfaasFn(funcName, null, versionId, [], false, {}), + { auth: defaultBasicAuth }, + ); + expect(axios.post).toHaveBeenCalledTimes(1); + expect(axios.post).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/function/${funcName}`, + inputData, + { auth: defaultBasicAuth }, + ); + expect(axios.get).toHaveBeenCalledTimes(1); + expect(axios.get).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/function/${funcName}`, + {"headers": {"X-REQUEST-TYPE": "HEALTH-CHECK"}}, + { auth: defaultBasicAuth }, + ); + }); + + it('throws from the userTransform handler when reconciles errors with anything other than 404', async() => { + const inputData = require(`./data/${integration}_input.json`); + const outputData = require(`./data/${integration}_output.json`); + + const versionId = randomID(); + const respBody = pyTrRevCode(versionId); + const funcName = pyfaasFuncName(respBody.workspaceId, respBody.versionId); + + const transformerUrl = `https://api.rudderlabs.com/transformation/getByVersionId?versionId=${versionId}`; + when(fetch) + .calledWith(transformerUrl) + .mockResolvedValue({ + status: 200, + json: jest.fn().mockResolvedValue(respBody) + }); + + + axios.put.mockRejectedValueOnce({response: {status: 400, data: 'bad request'}}); + await expect(async () => { + await userTransformHandler(inputData, versionId, []); + }).rejects.toThrow(RespStatusError); + + expect(axios.put).toHaveBeenCalledTimes(1); + expect(axios.put).toHaveBeenCalledWith( + `${OPENFAAS_GATEWAY_URL}/system/functions`, + buildOpenfaasFn(funcName, null, versionId, [], false, {}), + { auth: defaultBasicAuth }, + ); + }); + }); it("Simple transformation run - error requests", async () => { @@ -1694,6 +1855,8 @@ describe("Python transformations", () => { json: jest.fn().mockResolvedValue(respBody) }); + setFunctionInCache(funcName); + axios.post .mockRejectedValueOnce({ response: { status: 429, data: `Rate limit exceeded` } // invoke function with rate limit diff --git a/test/integrations/destinations/awin/data.ts b/test/integrations/destinations/awin/data.ts index 5a7fcfb50f..821b55637e 100644 --- a/test/integrations/destinations/awin/data.ts +++ b/test/integrations/destinations/awin/data.ts @@ -828,16 +828,14 @@ export const data = [ status: 200, body: [ { - error: "Event is not present in 'Events to Track' list. Aborting message.", + error: "Event is not present in 'Events to Track' list. Dropping the event.", statTags: { destType: 'AWIN', - errorCategory: 'dataValidation', - errorType: 'instrumentation', feature: 'processor', implementation: 'native', module: 'destination', }, - statusCode: 400, + statusCode: 298, }, ], }, diff --git a/test/integrations/destinations/facebook_offline_conversions/processor/data.ts b/test/integrations/destinations/facebook_offline_conversions/processor/data.ts index 26d9a5e2f9..90709b67a2 100644 --- a/test/integrations/destinations/facebook_offline_conversions/processor/data.ts +++ b/test/integrations/destinations/facebook_offline_conversions/processor/data.ts @@ -1436,7 +1436,7 @@ export const data = [ traits: { email: 'test@rudderstack.com', birthday: '2005-01-01T23:28:56.782Z', - firstName: 'test', + firstName: ' test', name: 'test rudderlabs', address: { city: 'kalkata', diff --git a/test/integrations/destinations/fb/processor/data.ts b/test/integrations/destinations/fb/processor/data.ts index a437b90855..b0b4ba9ecf 100644 --- a/test/integrations/destinations/fb/processor/data.ts +++ b/test/integrations/destinations/fb/processor/data.ts @@ -497,7 +497,7 @@ export const data = [ traits: { email: 'abc@gmail.com', anonymousId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', - firstName: 'test', + firstName: ' test', lastName: 'last', gender: 1234, phone: '+91-9831311135', diff --git a/test/integrations/destinations/fb_custom_audience/dataDelivery/other.ts b/test/integrations/destinations/fb_custom_audience/dataDelivery/other.ts index 52138604b0..2ad5964934 100644 --- a/test/integrations/destinations/fb_custom_audience/dataDelivery/other.ts +++ b/test/integrations/destinations/fb_custom_audience/dataDelivery/other.ts @@ -1,6 +1,6 @@ -import { generateMetadata, generateProxyV1Payload } from '../../../testUtils'; -import { ProxyV1TestData } from '../../../testTypes'; import { getEndPoint } from '../../../../../src/v0/destinations/fb_custom_audience/config'; +import { ProxyV1TestData } from '../../../testTypes'; +import { generateMetadata, generateProxyV1Payload } from '../../../testUtils'; import { statTags, testParams2 as testParams } from './business'; export const otherScenariosV1: ProxyV1TestData[] = [ @@ -50,4 +50,47 @@ export const otherScenariosV1: ProxyV1TestData[] = [ }, }, }, + { + id: 'fbca_v1_other_scenario_2', + name: 'fb_custom_audience', + description: 'got invalid response format (not-json) from facebook', + successCriteria: 'should throw retyable error', + scenario: 'Framework', + feature: 'dataDelivery', + module: 'destination', + version: 'v1', + input: { + request: { + body: generateProxyV1Payload({ + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'htmlResponse', + }, + params: testParams, + }), + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 500, + message: 'Invalid response format (HTML) during response transformation', + statTags, + response: [ + { + error: + '"

My First Heading

My first paragraph.

"', + statusCode: 500, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, + }, + }, ]; diff --git a/test/integrations/destinations/fb_custom_audience/network.ts b/test/integrations/destinations/fb_custom_audience/network.ts index 9b498bc07e..3331f874a3 100644 --- a/test/integrations/destinations/fb_custom_audience/network.ts +++ b/test/integrations/destinations/fb_custom_audience/network.ts @@ -523,4 +523,64 @@ export const networkCallsData = [ status: 400, }, }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'htmlResponse', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + data: '

My First Heading

My first paragraph.

', + status: 400, + }, + }, ]; diff --git a/test/integrations/destinations/fb_custom_audience/processor/data.ts b/test/integrations/destinations/fb_custom_audience/processor/data.ts index 602f8a7fb6..75fa321aca 100644 --- a/test/integrations/destinations/fb_custom_audience/processor/data.ts +++ b/test/integrations/destinations/fb_custom_audience/processor/data.ts @@ -1,5 +1,10 @@ import { getEndPoint } from '../../../../../src/v0/destinations/fb_custom_audience/config'; +export const mockFns = (_) => { + // @ts-ignore + jest.useFakeTimers().setSystemTime(new Date('2023-10-15')); +}; + export const data = [ { name: 'fb_custom_audience', @@ -54463,4 +54468,149 @@ export const data = [ }, }, }, -]; + { + name: 'fb_custom_audience', + description: + 'If App secret is configured in the UI, appsecret_proof and appsecret_time will be added to destination request.', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user 1', + anonymousId: 'anon-id-new', + event: 'event1', + type: 'audiencelist', + properties: { + listData: { + add: [ + { + EMAIL: 'shrouti2@abc.com', + DOBM: '2', + DOBD: '13', + DOBY: '2013', + PHONE: '@09432457768', + GEN: 'f', + FI: 'Ms.', + MADID: 'ABC', + ZIP: 'ZIP ', + ST: '123abc ', + COUNTRY: 'IN', + }, + ], + }, + }, + context: { + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + Config: { + accessToken: 'ABC', + appSecret: 'dummySecret', + userSchema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + isHashRequired: false, + disableFormat: false, + audienceId: 'aud1', + isRaw: true, + type: 'NA', + subType: 'ANYTHING', + maxUserCount: '50', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + libraries: [], + request: { + query: {}, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: getEndPoint('aud1'), + headers: {}, + params: { + access_token: 'ABC', + appsecret_proof: 'd103874f3b5f01f57c4f84edfb96ac94055da8f83c2b45e6f26dafca9188ff4d', + appsecret_time: 1697328000, + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti2@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + statusCode: 200, + }, + ], + }, + }, + }, +].map((d) => ({ ...d, mockFns })); diff --git a/test/integrations/destinations/ga4/mocks.ts b/test/integrations/destinations/ga4/mocks.ts index 7b47fe9f44..3a27349ff7 100644 --- a/test/integrations/destinations/ga4/mocks.ts +++ b/test/integrations/destinations/ga4/mocks.ts @@ -1,3 +1,5 @@ export const defaultMockFns = () => { - jest.spyOn(Date, 'now').mockImplementation(() => new Date('2022-04-29T05:17:09Z').valueOf()); + return jest + .spyOn(Date, 'now') + .mockImplementation(() => new Date('2022-04-29T05:17:09Z').valueOf()); }; diff --git a/test/integrations/destinations/ga4/processor/data.ts b/test/integrations/destinations/ga4/processor/data.ts index 4465ec9e2c..ba5b53c7d2 100644 --- a/test/integrations/destinations/ga4/processor/data.ts +++ b/test/integrations/destinations/ga4/processor/data.ts @@ -1,15212 +1,13 @@ -import { defaultMockFns } from '../mocks'; +import { pageTestData } from './pageTestData'; +import { ecommTestData } from './ecomTestData'; +import { trackTestData } from './trackTestData'; +import { groupTestData } from './groupTestData'; +import { validationTestData } from './validationTestData'; + export const data = [ - { - name: 'ga4', - description: "(gtag) check all property mappings for 'Products Searched' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99v4f979fb997ce453373900f891', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'Products Searched', - properties: { - query: 't-shirts', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-22T10:57:58Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - timestamp_micros: 1650950229000000, - events: [ - { - name: 'search', - params: { - search_term: 't-shirts', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'product list viewed' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - rudderId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99v4f979fb997ce453373900f891', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product list viewed', - properties: { - list_id: 'related_products', - category: 'Related_products', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'view_item_list', - params: { - item_list_id: 'related_products', - item_list_name: 'Related_products', - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'promotion viewed' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'promotion viewed', - properties: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '0', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'client_id', - events: [ - { - name: 'view_promotion', - params: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 0, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'promotion clicked' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'promotion clicked', - properties: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '0', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'select_promotion', - params: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 0, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) exclude only 'products' property from 'promotion clicked' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'promotion clicked', - properties: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'select_promotion', - params: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'product clicked' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product clicked', - properties: { - list_id: 'related_products', - category: 'Related_products', - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - timezone: { - name: 'Europe/Tallinn', - }, - engagementTimeMsec: 100, - sessionId: 655, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'select_item', - params: { - item_list_id: 'related_products', - item_list_name: 'Related_products', - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Related_products', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - timezone_name: 'Europe/Tallinn', - engagement_time_msec: 100, - session_id: 655, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'product viewed' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product viewed', - properties: { - currency: 'USD', - total: '7.77', - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'view_item', - params: { - currency: 'USD', - value: 7.77, - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'promotion clicked' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'promotion clicked', - properties: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '0', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - typesOfClient: 'gtag', - firebaseAppId: '1:17864591371:android:7a9520d3c78962e21f9fee', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'client_id', - events: [ - { - name: 'select_promotion', - params: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 0, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(firebase) check all property mappings for 'promotion clicked' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'promotion clicked', - properties: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '0', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - typesOfClient: 'firebase', - firebaseAppId: '1:17864591371:android:7a9520d3c78962e21f9fee', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - firebase_app_id: '1:17864591371:android:7a9520d3c78962e21f9fee', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - app_instance_id: 'f0dd99b6f979fb551ce583373900f937', - events: [ - { - name: 'select_promotion', - params: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 0, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'product added' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - total: '7.77', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'add_to_cart', - params: { - currency: 'USD', - value: 7.77, - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'product removed' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product removed', - properties: { - currency: 'USD', - total: '7.77', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - engagementTimeMsec: 100, - sessionId: 655, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'remove_from_cart', - params: { - currency: 'USD', - value: 7.77, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - engagement_time_msec: 100, - session_id: 655, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'cart viewed' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'cart viewed', - properties: { - currency: 'USD', - total: '7.77', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'view_cart', - params: { - currency: 'USD', - value: 7.77, - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'checkout started' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'checkout started', - properties: { - currency: 'USD', - total: 7.77, - coupon: 'SUMMER_FUN', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'begin_checkout', - params: { - currency: 'USD', - value: 7.77, - coupon: 'SUMMER_FUN', - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - "(gtag) check all property mappings for 'payment info entered' -> 'add_payment_info' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'payment info entered', - properties: { - currency: 'USD', - value: '7.77', - coupon: 'SUMMER_FUN', - payment_method: 'Credit Card', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - params: { - currency: 'USD', - value: 7.77, - coupon: 'SUMMER_FUN', - payment_type: 'Credit Card', - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - name: 'add_payment_info', - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - "(gtag) check all property mappings for 'checkout Step Completed' -> 'add_shipping_info' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'checkout Step Completed', - properties: { - currency: 'USD', - value: '7.77', - coupon: 'SUMMER_FUN', - shipping_method: 'Ground', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - params: { - currency: 'USD', - value: 7.77, - coupon: 'SUMMER_FUN', - shipping_tier: 'Ground', - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - name: 'add_shipping_info', - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'order completed' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'order completed', - properties: { - currency: 'USD', - order_id: 'T_12345', - total: 12.21, - affiliation: 'Google Store', - coupon: 'SUMMER_FUN', - shipping: 3.33, - tax: 1.11, - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'purchase', - params: { - currency: 'USD', - transaction_id: 'T_12345', - value: 12.21, - affiliation: 'Google Store', - coupon: 'SUMMER_FUN', - shipping: 3.33, - tax: 1.11, - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'order refunded' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'order refunded', - properties: { - currency: 'USD', - order_id: 'T_12345', - total: 12.21, - affiliation: 'Google Store', - coupon: 'SUMMER_FUN', - shipping: 3.33, - tax: 1.11, - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'refund', - params: { - currency: 'USD', - transaction_id: 'T_12345', - value: 12.21, - affiliation: 'Google Store', - coupon: 'SUMMER_FUN', - shipping: 3.33, - tax: 1.11, - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) exclude only 'products' property from 'order refunded' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'order refunded', - properties: { - currency: 'USD', - order_id: 'T_12345', - total: 12.21, - affiliation: 'Google Store', - coupon: 'SUMMER_FUN', - shipping: 3.33, - tax: 1.11, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'refund', - params: { - currency: 'USD', - transaction_id: 'T_12345', - value: 12.21, - affiliation: 'Google Store', - coupon: 'SUMMER_FUN', - shipping: 3.33, - tax: 1.11, - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'product added to wishlist' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added to wishlist', - properties: { - currency: 'USD', - total: '7.77', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'add_to_wishlist', - params: { - currency: 'USD', - value: 7.77, - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'product_shared' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product_shared', - properties: { - share_via: 'Twitter', - content_type: 'image', - item_id: 'C_12345', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'share', - params: { - method: 'Twitter', - content_type: 'image', - item_id: 'C_12345', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send only 'product_shared' event name without it's properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product_shared', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'share', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'cart Shared' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'cart Shared', - properties: { - share_via: 'Twitter', - content_type: 'image', - item_id: 'C_12345', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'share', - params: { - method: 'Twitter', - content_type: 'image', - item_id: 'C_12345', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send only 'cart Shared' event name with empty properties: {}", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'cart Shared', - properties: {}, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'share', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) check all property mappings for group call', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'group', - properties: { - group_id: 'G_12345', - engagementTimeMsec: 100, - sessionId: 655, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'group', - params: { - group_id: 'G_12345', - engagement_time_msec: 100, - session_id: 655, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) group: send only group event name without it's properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'group', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'group', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'earn virtual currency' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'earn virtual currency', - properties: { - virtual_currency_name: 'Gems', - value: 5, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'earn_virtual_currency', - params: { - virtual_currency_name: 'Gems', - value: 5, - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send only 'earn virtual currency' event name without it's properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'earn virtual currency', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'earn_virtual_currency', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'generate_lead' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'generate_lead', - properties: { - currency: 'USD', - value: 99.99, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'generate_lead', - params: { - currency: 'USD', - value: 99.99, - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'level_up' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'level_up', - properties: { - level: 5, - character: 'Player 1', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'level_up', - params: { - level: 5, - character: 'Player 1', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send only 'level_up' event name without it's properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'level_up', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'level_up', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'login' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'login', - properties: { - method: 'Google', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'login', - params: { - method: 'Google', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send only 'login' event name without it's properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'login', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'login', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'post_score' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'post_score', - properties: { - score: 10000, - level: 5, - character: 'Player 1', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'post_score', - params: { - score: 10000, - level: 5, - character: 'Player 1', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send only 'login' event name with its required `score` properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'post_score', - properties: { - score: 10000, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'post_score', - params: { - score: 10000, - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'select_content' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'select_content', - properties: { - content_type: 'product', - item_id: 'I_12345', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'select_content', - params: { - content_type: 'product', - item_id: 'I_12345', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send only 'group' event name without it's properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'select_content', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'select_content', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'sign_up' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'sign_up', - properties: { - method: 'Google', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'sign_up', - params: { - method: 'Google', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send only 'sign_up' event name without it's properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'sign_up', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'sign_up', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'spend_virtual_currency' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'spend_virtual_currency', - properties: { - value: 5, - virtual_currency_name: 'Gems', - item_name: 'Starter Boost', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'spend_virtual_currency', - params: { - value: 5, - virtual_currency_name: 'Gems', - item_name: 'Starter Boost', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - "(gtag) send only 'spend_virtual_currency' event name with it's required 'value' and 'virtual_currency_name' properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'spend_virtual_currency', - properties: { - value: 5, - virtual_currency_name: 'Gems', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'spend_virtual_currency', - params: { - value: 5, - virtual_currency_name: 'Gems', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send 'tutorial_begin' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutorial_begin', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'tutorial_begin', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send 'tutorial_complete' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutorial_complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'tutorial_complete', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send all properties for 'unlock_achievement' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'unlock_achievement', - properties: { - achievement_id: 'A_12345', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'unlock_achievement', - params: { - achievement_id: 'A_12345', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) send all properties for 'view_search_results' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'view_search_results', - properties: { - search_term: 'Clothing', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'view_search_results', - params: { - search_term: 'Clothing', - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) pass only 'products: [...]' property for 'view_search_results' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'view_search_results', - properties: { - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'view_search_results', - params: { - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - "(gtag) pass custom event name 'rudderstack event' to GA4 along with custom properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'rudderstack event', - properties: { - total: '10', - timezone: { - name: 'Europe/Tallinn', - }, - engagementTimeMsec: 100, - sessionId: 655, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'rudderstack_event', - params: { - total: '10', - timezone_name: 'Europe/Tallinn', - engagement_time_msec: 100, - session_id: 655, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - "(gtag) pass custom event name 'rudderstack event' to GA4 along with custom properties and user_properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'rudderstack event', - properties: { - total: '10', - user_properties: { - price: '19', - }, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - user_properties: { - price: { - value: '19', - }, - }, - events: [ - { - name: 'rudderstack_event', - params: { - total: '10', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '[Error]: (gtag) pass reserved event name to GA4', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'ad_click', - properties: { - total: '10', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'track:: Reserved event names are not allowed', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '[Exclusion]: (gtag) pass reserved property name to GA4 for custom events', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'rudderstack event', - properties: { - firebase_conversion: 'firebase_conversion', - google_id: '1234', - ga_value: 'ga_value', - value: '10', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'rudderstack_event', - params: { - value: '10', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - '[Exclusion]: (gtag) pass reserved property name and reserved properties in `user_properties` to GA4 for custom events', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'rudderstack event', - properties: { - firebase_conversion: 'firebase_conversion', - google_id: '1234', - ga_value: 'ga_value', - value: '10', - user_properties: { - first_open_time: 'first_open_time', - user_id: 'user_id', - firebase_value: 'firebase_value', - price: '100', - }, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - user_properties: { - price: { - value: '100', - }, - }, - events: [ - { - name: 'rudderstack_event', - params: { - value: '10', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '[Error]: (gtag) pass reserved event names along with reserved properties', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'app_remove', - properties: { - firebase_conversion: 'firebase_conversion', - google_id: '1234', - ga_value: 'ga_value', - value: '10', - user_properties: { - first_open_time: 'first_open_time', - user_id: 'user_id', - firebase_value: 'firebase_value', - price: '100', - }, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'track:: Reserved event names are not allowed', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '[Error] (gtag) pass reserved custom prefix names to GA4 events', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'firebase_event1', - properties: { - firebase_conversion: 'firebase_conversion', - google_id: '1234', - ga_value: 'ga_value', - value: '10', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'Reserved custom prefix names are not allowed', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'product added' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - total: '7.77', - google_data: 'google_data', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'add_to_cart', - params: { - currency: 'USD', - value: 7.77, - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) pass custom event name with its properties', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'rudderstack event', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'rudderstack_event', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) map 'product added' properties to ga4 'add_to_cart' items array", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - properties: { - affiliation: 'Google Merchandise Store', - brand: 'Google', - category: 'Related_products', - coupon: 'SUMMER_FUN', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - list_id: 'related_products', - location_id: 'L_12345', - name: 'Monopoly: 3rd Edition', - position: '1', - price: '19', - product_id: '507f1f77bcf86cd799439011', - products: [], - quantity: '2', - total: '7.77', - variant: 'green', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - FORM: {}, - JSON: { - client_id: 'client_id', - events: [ - { - name: 'add_to_cart', - params: { - currency: 'USD', - engagement_time_msec: 1, - items: [ - { - affiliation: 'Google Merchandise Store', - coupon: 'SUMMER_FUN', - currency: 'USD', - discount: 2.22, - index: 1, - item_brand: 'Google', - item_category: 'Related_products', - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_id: '507f1f77bcf86cd799439011', - item_list_id: 'related_products', - item_list_name: 'Related Products', - item_name: 'Monopoly: 3rd Edition', - item_variant: 'green', - location_id: 'L_12345', - price: 19, - quantity: 2, - }, - ], - list_id: 'related_products', - value: 7.77, - }, - }, - ], - non_personalized_ads: true, - timestamp_micros: 1650950229000000, - }, - JSON_ARRAY: {}, - XML: {}, - }, - endpoint: 'https://www.google-analytics.com/mp/collect', - files: {}, - headers: { - 'Content-Type': 'application/json', - HOST: 'www.google-analytics.com', - }, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - type: 'REST', - version: '1', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - '(gtag) pass event name with invalid data type for products: {...} properties (when products parameter is optional)', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - total: '7.77', - products: { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - affiliation: 'Google Merchandise Store', - brand: 'Google', - category: 'Related_products', - coupon: 'SUMMER_FUN', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - list_id: 'related_products', - location_id: 'L_12345', - name: 'Monopoly: 3rd Edition', - position: '1', - price: '19', - product_id: '507f1f77bcf86cd799439011', - quantity: '2', - variant: 'green', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - FORM: {}, - JSON: { - client_id: 'client_id', - events: [ - { - name: 'add_to_cart', - params: { - currency: 'USD', - engagement_time_msec: 1, - items: [ - { - affiliation: 'Google Merchandise Store', - coupon: 'SUMMER_FUN', - currency: 'USD', - discount: 2.22, - index: 1, - item_brand: 'Google', - item_category: 'Related_products', - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_id: '507f1f77bcf86cd799439011', - item_list_id: 'related_products', - item_list_name: 'Related Products', - item_name: 'Monopoly: 3rd Edition', - item_variant: 'green', - location_id: 'L_12345', - price: 19, - quantity: 2, - }, - ], - list_id: 'related_products', - value: 7.77, - }, - }, - ], - non_personalized_ads: true, - timestamp_micros: 1650950229000000, - }, - JSON_ARRAY: {}, - XML: {}, - }, - endpoint: 'https://www.google-analytics.com/mp/collect', - files: {}, - headers: { - 'Content-Type': 'application/json', - HOST: 'www.google-analytics.com', - }, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - type: 'REST', - version: '1', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - '[Error] (gtag) pass event name to GA4 with missing fields i.e required in products: [..]', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - total: '7.77', - products: [ - { - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'One of product_id or name is required', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: - '[Error] (gtag) pass event name to GA4 with missing fields i.e required in properties', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'Product Viewed', - properties: { - currency: 'USD', - total: '7.77', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'One of product_id or name is required', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '[Error] (gtag) missing API Secret', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutotial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'API Secret not found. Aborting ', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'configuration', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '[Error] (gtag) missing measurementId', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutotial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: '', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'measurementId must be provided. Aborting', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'configuration', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '(gtag) firing group event with event name. should take event name by default', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'group', - event: 'tutorial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'client_id', - events: [ - { - name: 'join_group', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '[Error] (gtag) payload has missing message.type', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - event: 'tutotial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'Message Type is not present. Aborting message.', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '[Error] (gtag) payload has missing event name', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'Event name is required', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '(gtag) taking client_id from anonymousId', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutotial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - events: [ - { - name: 'tutotial_complete', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '[Error] (firebase) payload has missing ga4AppInstanceId', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutotial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: '', - firebaseAppId: '1:17864591371:android:7a9520d3c78962e21f9fee', - blockPageViewEvent: false, - typesOfClient: 'firebase', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'ga4AppInstanceId must be provided under externalId', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '[Error] (firebase) pass reserved event name', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'app_store_subscription_cancel', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: '', - firebaseAppId: '1:17864591371:android:7a9520d3c78962e21f9fee', - blockPageViewEvent: false, - typesOfClient: 'firebase', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'Reserved custom event names are not allowed', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'tutorial complete' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutorial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - non_personalized_ads: true, - events: [ - { - name: 'tutorial_complete', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) check all property mappings for 'cart viewed' event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'cart viewed', - properties: { - currency: 'USD', - total: '7.77', - products: [ - { - product_id: 0, - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'view_cart', - params: { - currency: 'USD', - value: 7.77, - engagement_time_msec: 1, - items: [ - { - item_id: 0, - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '[Error]: (firebase) missing firebaseAppId', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'promotion clicked', - properties: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '0', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: '', - typesOfClient: 'firebase', - firebaseAppId: '', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'firebaseAppId must be provided. Aborting', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'configuration', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '(gtag) firing page call', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - rudderId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'page', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - events: [ - { - name: 'page_view', - params: { - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) firing page call with custom properties', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - rudderId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'page', - event: 'page view', - properties: { - view: 'login', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - events: [ - { - name: 'page_view', - params: { - view: 'login', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '[Error]: (gtag) pass timestamp more than 72 hours into the past', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-20T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutotial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - typesOfClient: 'gtag', - blockPageViewEvent: false, - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'Allowed timestamp is [72 hours] into the past', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '[Error]: (gtag) pass timestamp more than 15 min into the future', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-05-05T15:47:57Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'tutotial complete', - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - typesOfClient: 'gtag', - blockPageViewEvent: false, - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'Allowed timestamp is [15 minutes] into the future', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: - '(gtag) pass custom properties along with products: [..] parameters to GA4 standard events along with its stated ones', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'order completed', - properties: { - checkout_id: '12345', - order_id: '1234', - myCustomProp: 'My arbitray value', - affiliation: 'Apple Store', - total: 20, - revenue: 15, - shipping: 22, - tax: 1, - discount: 1.5, - coupon: 'ImagePro', - currency: 'USD', - products: [ - { - product_id: '123', - sku: 'G-32', - name: 'Monopoly', - price: 14, - quantity: 1, - category: 'Games', - item_category2: 'Board games', - url: 'https://www.website.com/product/path', - image_url: 'https://www.website.com/product/path.jpg', - }, - ], - timezone: { - name: 'Europe/Tallinn', - }, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'purchase', - params: { - checkout_id: '12345', - transaction_id: '1234', - myCustomProp: 'My arbitray value', - affiliation: 'Apple Store', - value: 20, - shipping: 22, - tax: 1, - discount: 1.5, - coupon: 'ImagePro', - currency: 'USD', - engagement_time_msec: 1, - items: [ - { - item_id: '123', - sku: 'G-32', - item_name: 'Monopoly', - price: 14, - quantity: 1, - item_category: 'Games', - item_category2: 'Board games', - url: 'https://www.website.com/product/path', - image_url: 'https://www.website.com/product/path.jpg', - }, - ], - timezone_name: 'Europe/Tallinn', - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - '(gtag) pass custom properties excluding products: [..] parameter to GA4 standard events along with its stated ones', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'promotion clicked', - properties: { - 'customProp-1': 'check-1', - 'customProp-2': 'check-2', - timezone: { - name: 'Europe/Tallinn', - }, - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - client_id: 'client_id', - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'select_promotion', - params: { - 'customProp-1': 'check-1', - 'customProp-2': 'check-2', - timezone_name: 'Europe/Tallinn', - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: "(gtag) message type group -> 'join_group' with custom event", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'group', - traits: { - custom1: 1234, - custom2: 'custom2', - timezone: { - name: 'Europe/Tallinn', - }, - engagementTimeMsec: 100, - sessionId: 655, - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'client_id', - events: [ - { - name: 'join_group', - params: { - custom1: 1234, - custom2: 'custom2', - timezone_name: 'Europe/Tallinn', - engagement_time_msec: 100, - session_id: 655, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag): check args keyword for price x currency multiplication', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - price: 2.4, - quantity: 2, - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'client_id', - events: [ - { - name: 'add_to_cart', - params: { - currency: 'USD', - value: 4.8, - engagement_time_msec: 1, - items: [ - { - item_id: '507f1f77bcf86cd799439011', - item_name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - item_category: 'Apparel', - item_brand: 'Google', - item_variant: 'green', - price: 19, - quantity: 2, - index: 1, - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - price: 2.4, - quantity: 2, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - "(gtag): take page properties from context.page for 'page' call along with custom properties", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - rudderId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - page: { - url: 'http://morkey.in', - path: '/cart', - title: 'miphone', - search: 'MI', - referrer: 'morkey', - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'page', - integrations: { - All: true, - }, - properties: { - cust1: 1234, - engagementTimeMsec: 100, - sessionId: 655, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - events: [ - { - name: 'page_view', - params: { - page_referrer: 'morkey', - page_title: 'miphone', - page_location: 'http://morkey.in', - cust1: 1234, - engagement_time_msec: 100, - session_id: 655, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '[Error] GA4: event not as string', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: { - name: 'promotion_viewed', - }, - properties: { - creative_name: 'Summer Banner', - creative_slot: 'featured_app_1', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '0', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - promotion_id: 'P_12345', - promotion_name: 'Summer Sale', - creative_name: 'summer_banner2', - creative_slot: 'featured_app_1', - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'track:: event name should be string', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '[Error] GA4: client_id not found in all four path', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - price: 2.4, - quantity: 2, - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: true, - sendLoginSignup: true, - newOrExistingUserTrait: 'firstLogin', - loginSignupMethod: 'method', - generateLead: true, - generateLeadValueTrait: 'value', - generateLeadCurrencyTrait: 'currency', - clientIdFieldIdentifier: 'properties.client_id', - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: 'ga4ClientId, anonymousId or messageId must be provided', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'configuration', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: - "client_id isn't sent from the path defined in the webapp config, falling back to default values i.e here it is anonymousId", - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - price: 2.4, - quantity: 2, - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: true, - sendLoginSignup: true, - newOrExistingUserTrait: 'firstLogin', - loginSignupMethod: 'method', - generateLead: true, - generateLeadValueTrait: 'value', - generateLeadCurrencyTrait: 'currency', - clientIdFieldIdentifier: 'properties.client_id', - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'add_to_cart', - params: { - items: [ - { - index: 1, - price: 19, - coupon: 'SUMMER_FUN', - item_id: '507f1f77bcf86cd799439011', - currency: 'USD', - discount: 2.22, - quantity: 2, - item_name: 'Monopoly: 3rd Edition', - item_brand: 'Google', - affiliation: 'Google Merchandise Store', - location_id: 'L_12345', - item_list_id: 'related_products', - item_variant: 'green', - item_category: 'Apparel', - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_name: 'Related Products', - }, - ], - price: 2.4, - value: 4.8, - currency: 'USD', - quantity: 2, - engagement_time_msec: 1, - }, - }, - ], - client_id: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - 'any custom or item property with array value, is flattened with underscore delimeter', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'product added', - originalTimestamp: '2022-04-26T05:17:09Z', - properties: { - currency: 'USD', - total: '7.77', - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - address: { - city: 'kolkata', - district: '24pgs', - }, - categoryLevels: ['Furniture', 'Bedroom Furniture', 'Dressers & Chests'], - products: [ - { - product_id: '1234', - product_details: { - colour: 'red', - shape: 'rectangle', - }, - productLevels: ['test1', 'test2', 'test3'], - }, - ], - }, - integrations: { - All: true, - }, - sentAt: '2022-11-14T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - client_id: 'client_id', - events: [ - { - name: 'add_to_cart', - params: { - currency: 'USD', - value: 7.77, - items: [ - { - item_id: '1234', - product_details_colour: 'red', - product_details_shape: 'rectangle', - productLevels_0: 'test1', - productLevels_1: 'test2', - productLevels_2: 'test3', - }, - ], - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - address_city: 'kolkata', - address_district: '24pgs', - categoryLevels_0: 'Furniture', - categoryLevels_1: 'Bedroom Furniture', - categoryLevels_2: 'Dressers & Chests', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: 'extract session_id from context.sessionId', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - sessionId: 16678456735, - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - price: 2.4, - quantity: 2, - client_id: 'client@1234', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: true, - sendLoginSignup: true, - newOrExistingUserTrait: 'firstLogin', - loginSignupMethod: 'method', - generateLead: true, - generateLeadValueTrait: 'value', - generateLeadCurrencyTrait: 'currency', - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'add_to_cart', - params: { - items: [ - { - index: 1, - price: 19, - coupon: 'SUMMER_FUN', - item_id: '507f1f77bcf86cd799439011', - currency: 'USD', - discount: 2.22, - quantity: 2, - item_name: 'Monopoly: 3rd Edition', - item_brand: 'Google', - affiliation: 'Google Merchandise Store', - location_id: 'L_12345', - item_list_id: 'related_products', - item_variant: 'green', - item_category: 'Apparel', - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_name: 'Related Products', - }, - ], - price: 2.4, - value: 4.8, - currency: 'USD', - quantity: 2, - session_id: 16678456735, - engagement_time_msec: 1, - client_id: 'client@1234', - }, - }, - ], - client_id: 'client_id', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) send integer userId', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - userId: 34567, - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - sessionId: 16678456735, - }, - type: 'track', - event: 'product added', - properties: { - currency: 'USD', - price: 2.4, - quantity: 2, - client_id: 'client@1234', - products: [ - { - product_id: '507f1f77bcf86cd799439011', - name: 'Monopoly: 3rd Edition', - coupon: 'SUMMER_FUN', - category: 'Apparel', - brand: 'Google', - variant: 'green', - price: '19', - quantity: '2', - position: '1', - affiliation: 'Google Merchandise Store', - currency: 'USD', - discount: 2.22, - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_id: 'related_products', - item_list_name: 'Related Products', - location_id: 'L_12345', - }, - ], - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: true, - sendLoginSignup: true, - newOrExistingUserTrait: 'firstLogin', - loginSignupMethod: 'method', - generateLead: true, - generateLeadValueTrait: 'value', - generateLeadCurrencyTrait: 'currency', - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'add_to_cart', - params: { - items: [ - { - index: 1, - price: 19, - coupon: 'SUMMER_FUN', - item_id: '507f1f77bcf86cd799439011', - currency: 'USD', - discount: 2.22, - quantity: 2, - item_name: 'Monopoly: 3rd Edition', - item_brand: 'Google', - affiliation: 'Google Merchandise Store', - location_id: 'L_12345', - item_list_id: 'related_products', - item_variant: 'green', - item_category: 'Apparel', - item_category2: 'Adult', - item_category3: 'Shirts', - item_category4: 'Crew', - item_category5: 'Short sleeve', - item_list_name: 'Related Products', - }, - ], - price: 2.4, - value: 4.8, - currency: 'USD', - quantity: 2, - session_id: 16678456735, - engagement_time_msec: 1, - client_id: 'client@1234', - }, - }, - ], - client_id: 'client_id', - user_id: '34567', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) login event with user_properties', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - userId: 'user@1', - channel: 'web', - anonymousId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - traits: { - campaign: 'advertizing', - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'login', - properties: { - method: 'facebook', - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'login', - params: { - method: 'facebook', - engagement_time_msec: 1, - }, - }, - ], - user_id: 'user@1', - user_properties: { - campaign: { - value: 'advertizing', - }, - }, - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) sign_up event', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - userId: 'user@1', - channel: 'web', - anonymousId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - traits: { - campaign: 'advertizing', - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'sign_up', - properties: { - method: 'google', - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'sign_up', - params: { - method: 'google', - engagement_time_msec: 1, - }, - }, - ], - user_id: 'user@1', - user_properties: { - campaign: { - value: 'advertizing', - }, - }, - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) generate_lead event', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - userId: 'user@1', - channel: 'web', - anonymousId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - traits: { - campaign: 'advertizing', - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'generate_lead', - properties: { - source: 'instagram', - value: 20, - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'generate_lead', - params: { - currency: 'USD', - value: 20, - source: 'instagram', - engagement_time_msec: 1, - }, - }, - ], - user_id: 'user@1', - user_properties: { - campaign: { - value: 'advertizing', - }, - }, - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) track call with page information such as url, title, referrer', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - userId: 'user@1', - channel: 'web', - anonymousId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - page: { - initial_referrer: '$direct', - path: '/', - referrer: '$direct', - tab_url: 'https://www.rudderstack.com/', - title: 'Document', - url: 'https://www.rudderstack.com/', - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'generate_lead', - properties: { - source: 'instagram', - value: 20, - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'generate_lead', - params: { - currency: 'USD', - value: 20, - source: 'instagram', - page_location: 'https://www.rudderstack.com/', - page_referrer: '$direct', - page_title: 'Document', - engagement_time_msec: 1, - }, - }, - ], - user_id: 'user@1', - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - '(gtag) track event with hybrid connection mode using buffer cloud mode event approach', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - userId: 'user@1', - channel: 'web', - anonymousId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - traits: { - campaign: 'advertizing', - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'generate_lead', - properties: { - source: 'instagram', - value: 20, - }, - integrations: { - All: true, - 'Google Analytics 4 (GA4)': { - clientId: '554581488.1683172875', - sessionId: '1683172875', - }, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - connectionMode: 'hybrid', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'generate_lead', - params: { - currency: 'USD', - value: 20, - source: 'instagram', - session_id: '1683172875', - engagement_time_msec: 1, - }, - }, - ], - user_id: 'user@1', - user_properties: { - campaign: { - value: 'advertizing', - }, - }, - client_id: '554581488.1683172875', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: - '(gtag) track event with hybrid connection mode using override client_id and session_id approach', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - userId: 'user@1', - channel: 'web', - anonymousId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - traits: { - campaign: 'advertizing', - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - sessionId: 1683172874065, - }, - type: 'track', - event: 'generate_lead', - properties: { - source: 'instagram', - value: 20, - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - connectionMode: 'hybrid', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'generate_lead', - params: { - currency: 'USD', - value: 20, - source: 'instagram', - session_id: 1683172874065, - engagement_time_msec: 1, - }, - }, - ], - user_id: 'user@1', - user_properties: { - campaign: { - value: 'advertizing', - }, - }, - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) firing group calls with GA4 hybrid mode connection', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'group', - event: 'tutorial complete', - integrations: { - 'Google Analytics 4': { - clientId: '4718026.1683606287', - sessionId: '1683606287', - sessionNumber: 1, - }, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - connectionMode: 'hybrid', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - body: { - JSON: { - non_personalized_ads: true, - client_id: '4718026.1683606287', - events: [ - { - name: 'join_group', - params: { - engagement_time_msec: 1, - session_id: '1683606287', - session_number: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) sign_up event with all data types of user_properties', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - userId: 'user@1', - channel: 'web', - anonymousId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - traits: { - campaign: 'advertizing', - name: 'rudder', - age: 45, - hobby: ['dancing', 'singing', 'reading'], - enableEURegion: false, - isEnterpriseUser: { - value: false, - }, - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'sign_up', - properties: { - method: 'google', - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6BET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'sign_up', - params: { - method: 'google', - engagement_time_msec: 1, - }, - }, - ], - user_id: 'user@1', - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - user_properties: { - age: { - value: 45, - }, - name: { - value: 'rudder', - }, - campaign: { - value: 'advertizing', - }, - enableEURegion: { - value: false, - }, - }, - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '[Error]: (gtag) event name starts with numbers', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: '1234_sign_up', - properties: { - total: '10', - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - connectionMode: 'cloud', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - error: - 'Event name must start with a letter and can only contain letters, numbers, and underscores', - statTags: { - destType: 'GA4', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', - }, - statusCode: 400, - }, - ], - }, - }, - }, - { - name: 'ga4', - description: '(gtag) event having multiple empty array and object parameters', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - type: 'track', - event: 'logIn', - userId: 'user@1', - group_id: 'group@1', - anon_id: '78e95d6d-58c0-4237-b99e-2ef510b6d502', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'f0dd99b6f979fb551ce583373900f937', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - properties: { - user_interest: 'Moderate', - company_interest: '', - profile: [ - { - is_6qa: true, - product: null, - product_fit: 'Moderate', - product_stage: 'Purchase', - intent_score: 89, - profile_score: 52, - product_display$name: 'rudderstack', - }, - ], - user_company: 'Analytics consulting', - user_account: '1', - user_id_mappings: '330098|245252|461224|282599', - company_naics_6sense: '5173', - usr_consent: null, - firebase_user_id: 'kdgMnP', - google_user_id: 'G-123456', - company_domain: 'consulting.net', - company_region: 'New Zealand', - user_product_interests: { - ids: [], - list: [ - { - id: 330098, - name: [], - }, - { - id: 245252, - name: {}, - }, - ], - names: [], - }, - company_country: {}, - company_industry: 'Business Analytics', - company_revenue: '$5M - $10M', - company_annual_revenue: '5568000', - company_sic_description: '', - company_naics_description: [], - }, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-T40PE6KET4', - firebaseAppId: '', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - connectionMode: 'cloud', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'login', - params: { - company_annual_revenue: '5568000', - company_domain: 'consulting.net', - company_industry: 'Business Analytics', - company_naics_6sense: '5173', - company_region: 'New Zealand', - company_revenue: '$5M - $10M', - engagement_time_msec: 1, - profile_0_intent_score: 89, - profile_0_is_6qa: true, - profile_0_product_display$name: 'rudderstack', - profile_0_product_fit: 'Moderate', - profile_0_product_stage: 'Purchase', - profile_0_profile_score: 52, - user_account: '1', - user_company: 'Analytics consulting', - user_id_mappings: '330098|245252|461224|282599', - user_interest: 'Moderate', - user_product_interests_list_0_id: 330098, - user_product_interests_list_1_id: 245252, - }, - }, - ], - user_id: 'user@1', - client_id: 'client_id', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-T40PE6KET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) campaign_details custom event', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - userId: 'user@1', - channel: 'web', - anonymousId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - campaign: { - id: 'google_1234', - name: 'Summer_fun', - source: 'google', - medium: 'cpc', - term: 'summer+travel', - content: 'logo link', - }, - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'Campaign Details', - properties: {}, - integrations: { - All: true, - }, - }, - destination: { - Config: { - apiSecret: 'QyWKGHj8QhG2L4ePAPiXCA', - measurementId: 'G-T40PE6BET4', - typesOfClient: 'gtag', - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - body: { - XML: {}, - FORM: {}, - JSON: { - events: [ - { - name: 'campaign_details', - params: { - campaign_id: 'google_1234', - campaign: 'Summer_fun', - source: 'google', - medium: 'cpc', - term: 'summer+travel', - content: 'logo link', - engagement_time_msec: 1, - }, - }, - ], - user_id: 'user@1', - client_id: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - non_personalized_ads: true, - }, - JSON_ARRAY: {}, - }, - type: 'REST', - files: {}, - method: 'POST', - params: { - api_secret: 'QyWKGHj8QhG2L4ePAPiXCA', - measurement_id: 'G-T40PE6BET4', - }, - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - version: '1', - endpoint: 'https://www.google-analytics.com/mp/collect', - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) send consents setting to ga4 with login event', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'dummyGA4AppInstanceId', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'login', - properties: { - method: 'Google', - }, - integrations: { - All: true, - GA4: { - consents: { - ad_personalization: 'GRANTED', - ad_user_data: 'GRANTED', - }, - }, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-123456', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-123456', - }, - body: { - JSON: { - client_id: 'client_id', - consent: { - ad_personalization: 'GRANTED', - ad_user_data: 'GRANTED', - }, - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'login', - params: { - method: 'Google', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, - { - name: 'ga4', - description: '(gtag) send consents setting to ga4 with login event', - feature: 'processor', - module: 'destination', - version: 'v0', - input: { - request: { - body: [ - { - message: { - channel: 'web', - messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', - originalTimestamp: '2022-04-26T05:17:09Z', - anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', - context: { - app: { - build: '1.0.0', - name: 'RudderLabs JavaScript SDK', - namespace: 'com.rudderlabs.javascript', - version: '1.0.0', - }, - device: { - adTrackingEnabled: 'false', - advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', - id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', - manufacturer: 'Google', - model: 'AOSP on IA Emulator', - name: 'generic_x86_arm', - type: 'ios', - attTrackingStatus: 3, - }, - ip: '0.0.0.0', - library: { - name: 'RudderLabs JavaScript SDK', - version: '1.0.0', - }, - locale: 'en-US', - os: { - name: 'iOS', - version: '14.4.1', - }, - screen: { - density: 2, - }, - externalId: [ - { - type: 'ga4AppInstanceId', - id: 'dummyGA4AppInstanceId', - }, - { - type: 'ga4ClientId', - id: 'client_id', - }, - ], - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', - }, - type: 'track', - event: 'login', - properties: { - method: 'Google', - }, - integrations: { - All: true, - GA4: { - consents: { - ad_personalization: 'NOT_SPECIFIED', - ad_user_data: 'DENIED', - }, - }, - }, - sentAt: '2022-04-20T15:20:57Z', - }, - destination: { - Config: { - apiSecret: 'dummyApiSecret', - measurementId: 'G-123456', - firebaseAppId: '', - blockPageViewEvent: false, - typesOfClient: 'gtag', - extendPageViewParams: false, - sendUserId: false, - eventFilteringOption: 'disable', - blacklistedEvents: [ - { - eventName: '', - }, - ], - whitelistedEvents: [ - { - eventName: '', - }, - ], - enableServerSideIdentify: false, - sendLoginSignup: false, - generateLead: false, - }, - Enabled: true, - }, - }, - ], - }, - }, - output: { - response: { - status: 200, - body: [ - { - output: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://www.google-analytics.com/mp/collect', - headers: { - HOST: 'www.google-analytics.com', - 'Content-Type': 'application/json', - }, - params: { - api_secret: 'dummyApiSecret', - measurement_id: 'G-123456', - }, - body: { - JSON: { - client_id: 'client_id', - consent: { - ad_user_data: 'DENIED', - }, - timestamp_micros: 1650950229000000, - non_personalized_ads: true, - events: [ - { - name: 'login', - params: { - method: 'Google', - engagement_time_msec: 1, - }, - }, - ], - }, - JSON_ARRAY: {}, - XML: {}, - FORM: {}, - }, - files: {}, - userId: '', - }, - statusCode: 200, - }, - ], - }, - }, - mockFns: defaultMockFns, - }, + ...pageTestData, + ...trackTestData, + ...ecommTestData, + ...groupTestData, + ...validationTestData, ]; diff --git a/test/integrations/destinations/ga4/processor/ecomTestData.ts b/test/integrations/destinations/ga4/processor/ecomTestData.ts new file mode 100644 index 0000000000..238e44222b --- /dev/null +++ b/test/integrations/destinations/ga4/processor/ecomTestData.ts @@ -0,0 +1,2466 @@ +import { defaultMockFns } from '../mocks'; +import { Destination } from '../../../../../src/types'; +import { ProcessorTestData } from '../../../testTypes'; +import { + generateMetadata, + transformResultBuilder, + generateSimplifiedTrackPayload, +} from '../../../testUtils'; + +const destination: Destination = { + ID: '123', + Name: 'GA4', + DestinationDefinition: { + ID: '123', + Name: 'GA4', + DisplayName: 'Google Analytics 4 (GA4)', + Config: {}, + }, + Config: { + apiSecret: 'dummyApiSecret', + measurementId: 'dummyMeasurementId', + firebaseAppId: '', + blockPageViewEvent: false, + typesOfClient: 'gtag', + extendPageViewParams: false, + sendUserId: false, + eventFilteringOption: 'disable', + blacklistedEvents: [ + { + eventName: '', + }, + ], + whitelistedEvents: [ + { + eventName: '', + }, + ], + }, + Enabled: true, + WorkspaceID: '123', + Transformations: [], +}; + +const deviceInfo = { + adTrackingEnabled: 'false', + advertisingId: 'dummyAdvertisingId', + id: 'device@1', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, +}; + +const commonOutputHeaders = { + HOST: 'www.google-analytics.com', + 'Content-Type': 'application/json', +}; + +const commonOutputParams = { + api_secret: 'dummyApiSecret', + measurement_id: 'dummyMeasurementId', +}; + +const rudderId = 'dummyRudderId'; +const anonymousId = 'dummyAnonId'; +const externalId = [ + { + type: 'ga4AppInstanceId', + id: 'dummyAppInstanceId', + }, +]; +const externalIdWithClientId = [ + { + type: 'ga4AppInstanceId', + id: 'dummyAppInstanceId', + }, + { + type: 'ga4ClientId', + id: 'dummyClientId', + }, +]; +const sentAt = '2022-04-20T15:20:57Z'; +const originalTimestamp = '2022-04-26T05:17:09Z'; + +const timezone = { + name: 'Europe/Tallinn', +}; +const clientId = 'dummyClientId'; +const userId = 'default-user-id'; + +const coupon = 'SUMMER_FUN'; +const defaultCurrency = 'USD'; +const search_term = 'Clothing'; +const shipping_method = 'Ground'; +const payment_method = 'Credit Card'; +const list_id = 'related_products'; +const category = 'Related_products'; + +const value = 7.77; +const total = '7.77'; +const sessionId = 655; +const engagementTimeMsec = 100; +const non_personalized_ads = true; +const defaultEngagementTimeMsec = 1; +const timestamp_micros = 1650950229000000; + +const commonProductInfo = [ + { + product_id: '507f1f77bcf86cd799439011', + name: 'Monopoly: 3rd Edition', + coupon: 'SUMMER_FUN', + category: 'Apparel', + brand: 'Google', + variant: 'green', + price: '19', + quantity: '2', + position: '1', + affiliation: 'Google Merchandise Store', + currency: 'USD', + discount: 2.22, + item_category2: 'Adult', + item_category3: 'Shirts', + item_category4: 'Crew', + item_category5: 'Short sleeve', + item_list_id: 'related_products', + item_list_name: 'Related Products', + location_id: 'L_12345', + }, +]; + +const expectedOutputItems = [ + { + item_id: '507f1f77bcf86cd799439011', + item_name: 'Monopoly: 3rd Edition', + coupon: 'SUMMER_FUN', + item_category: 'Apparel', + item_brand: 'Google', + item_variant: 'green', + price: 19, + quantity: 2, + index: 1, + affiliation: 'Google Merchandise Store', + currency: 'USD', + discount: 2.22, + item_category2: 'Adult', + item_category3: 'Shirts', + item_category4: 'Crew', + item_category5: 'Short sleeve', + item_list_id: 'related_products', + item_list_name: 'Related Products', + location_id: 'L_12345', + }, +]; + +const promotionEventsCommonProductInfo = [ + { + product_id: '507f1f77bcf86cd799439011', + name: 'Monopoly: 3rd Edition', + coupon: 'SUMMER_FUN', + category: 'Apparel', + brand: 'Google', + variant: 'green', + price: '19', + quantity: '2', + position: '0', + affiliation: 'Google Merchandise Store', + currency: 'USD', + discount: 2.22, + item_category2: 'Adult', + item_category3: 'Shirts', + item_category4: 'Crew', + item_category5: 'Short sleeve', + item_list_id: 'related_products', + item_list_name: 'Related Products', + location_id: 'L_12345', + promotion_id: 'P_12345', + promotion_name: 'Summer Sale', + creative_name: 'summer_banner2', + creative_slot: 'featured_app_1', + }, +]; + +const promotionEventsCommonParams = { + creative_name: 'Summer Banner', + creative_slot: 'featured_app_1', + location_id: 'L_12345', + promotion_id: 'P_12345', + promotion_name: 'Summer Sale', +}; + +const promotionEventsExpectedOutputItems = [ + { + item_id: '507f1f77bcf86cd799439011', + item_name: 'Monopoly: 3rd Edition', + coupon: 'SUMMER_FUN', + item_category: 'Apparel', + item_brand: 'Google', + item_variant: 'green', + price: 19, + quantity: 2, + index: 0, + affiliation: 'Google Merchandise Store', + currency: 'USD', + discount: 2.22, + item_category2: 'Adult', + item_category3: 'Shirts', + item_category4: 'Crew', + item_category5: 'Short sleeve', + item_list_id: 'related_products', + item_list_name: 'Related Products', + location_id: 'L_12345', + promotion_id: 'P_12345', + promotion_name: 'Summer Sale', + creative_name: 'summer_banner2', + creative_slot: 'featured_app_1', + }, +]; + +const promotionEventsExpectedOutputParams = { + creative_name: 'Summer Banner', + creative_slot: 'featured_app_1', + location_id: 'L_12345', + promotion_id: 'P_12345', + promotion_name: 'Summer Sale', + engagement_time_msec: defaultEngagementTimeMsec, +}; + +const orderEventsCommonParams = { + currency: defaultCurrency, + order_id: 'T_12345', + total: 12.21, + affiliation: 'Google Store', + coupon, + shipping: 3.33, + tax: 1.11, +}; + +const orderEventsExpectedOutputParams = { + currency: defaultCurrency, + transaction_id: 'T_12345', + value: 12.21, + affiliation: 'Google Store', + coupon, + shipping: 3.33, + tax: 1.11, +}; + +const shareProductsCommonParams = { + share_via: 'Twitter', + content_type: 'image', + item_id: 'C_12345', +}; + +const shareProductsExpectedOutputParams = { + method: 'Twitter', + content_type: 'image', + item_id: 'C_12345', +}; + +const eventEndPoint = 'https://www.google-analytics.com/mp/collect'; + +export const ecommTestData: ProcessorTestData[] = [ + { + id: 'ga4-ecom-test-1', + name: 'ga4', + description: 'Track event call for Products Searched event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all product searched event properties and event name should be search', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'Products Searched', + sentAt, + context: { + externalId, + }, + properties: { + query: 't-shirts', + }, + anonymousId, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: 'dummyAnonId', + timestamp_micros, + user_id: userId, + events: [ + { + name: 'search', + params: { + search_term: 't-shirts', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-2', + name: 'ga4', + description: 'Track event call for product list viewed event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all product list viewed event properties and event name should be view_item_list', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product list viewed', + rudderId, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + properties: { + list_id, + category, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: 'default-anonymousId', + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'view_item_list', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + item_list_id: 'related_products', + item_list_name: 'Related_products', + items: expectedOutputItems, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-3', + name: 'ga4', + description: 'Track event call for promotion viewed event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all promotion viewed event properties and event name should be view_promotion', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'promotion viewed', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + ...promotionEventsCommonParams, + products: promotionEventsCommonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'view_promotion', + params: { + ...promotionEventsExpectedOutputParams, + items: promotionEventsExpectedOutputItems, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-4', + name: 'ga4', + description: 'Track event call for promotion clicked event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all promotion clicked event properties and event name should be select_promotion', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'promotion clicked', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + ...promotionEventsCommonParams, + products: promotionEventsCommonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'select_promotion', + params: { + ...promotionEventsExpectedOutputParams, + items: promotionEventsExpectedOutputItems, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-5', + name: 'ga4', + description: + 'Track event call for promotion clicked event by excuding products from properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all promotion clicked event properties except products and event name should be select_promotion', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'promotion clicked', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + ...promotionEventsCommonParams, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'select_promotion', + params: { + ...promotionEventsExpectedOutputParams, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-6', + name: 'ga4', + description: 'Track event call for product clicked event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all product clicked event properties and event name should be select_item', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product clicked', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + ...commonProductInfo[0], + list_id, + category, + timezone, + sessionId, + engagementTimeMsec, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'select_item', + params: { + item_list_id: list_id, + item_list_name: category, + items: [{ ...expectedOutputItems[0], item_category: category }], + timezone_name: timezone.name, + engagement_time_msec: engagementTimeMsec, + session_id: sessionId, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-7', + name: 'ga4', + description: 'Track event call for product viewed event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all product viewed event properties and event name should be view_item', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product viewed', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total, + ...commonProductInfo[0], + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'view_item', + params: { + currency: defaultCurrency, + value, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-8', + name: 'ga4', + description: 'Track event call for product added event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all product added event properties and event name should be add_to_cart', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product added', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + currency: defaultCurrency, + total, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'add_to_cart', + params: { + currency: defaultCurrency, + value, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-9', + name: 'ga4', + description: 'Track event call for product removed event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all product removed event properties and event name should be remove_from_cart', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product removed', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + currency: defaultCurrency, + total, + products: commonProductInfo, + sessionId, + engagementTimeMsec, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'remove_from_cart', + params: { + currency: defaultCurrency, + value, + items: expectedOutputItems, + engagement_time_msec: engagementTimeMsec, + session_id: sessionId, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-10', + name: 'ga4', + description: 'Track event call for cart viewed event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all cart viewed event properties and event name should be view_cart', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'cart viewed', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + currency: defaultCurrency, + total, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'view_cart', + params: { + currency: defaultCurrency, + value, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-11', + name: 'ga4', + description: 'Track event call for checkout started event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all checkout started event properties and event name should be begin_checkout', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'checkout started', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + currency: defaultCurrency, + total, + coupon, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'begin_checkout', + params: { + currency: defaultCurrency, + value, + coupon, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-12', + name: 'ga4', + description: 'Track event call for payment info entered event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all payment info entered event properties and event name should be add_payment_info', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'payment info entered', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + currency: defaultCurrency, + total, + coupon, + payment_method, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'add_payment_info', + params: { + currency: defaultCurrency, + value, + coupon, + payment_type: payment_method, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-13', + name: 'ga4', + description: 'Track event call for Checkout Step Completed event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all Checkout Step Completed event properties and event name should be add_shipping_info', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'Checkout Step Completed', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + currency: defaultCurrency, + total, + coupon, + shipping_method, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'add_shipping_info', + params: { + currency: defaultCurrency, + value, + coupon, + shipping_tier: shipping_method, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-14', + name: 'ga4', + description: 'Track event call for order completed event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all order completed event properties and event name should be purchase', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'order completed', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + ...orderEventsCommonParams, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'purchase', + params: { + ...orderEventsExpectedOutputParams, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-15', + name: 'ga4', + description: 'Track event call for order refunded event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all order refunded event properties and event name should be refund', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'order refunded', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + ...orderEventsCommonParams, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'refund', + params: { + ...orderEventsExpectedOutputParams, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-16', + name: 'ga4', + description: 'Track event call for order refunded event and exclude products from properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all order refunded event properties except products and event name should be refund', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'order refunded', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + ...orderEventsCommonParams, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'refund', + params: { + ...orderEventsExpectedOutputParams, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-17', + name: 'ga4', + description: 'Track event call for product added to wishlist event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all product added to wishlist event properties and event name should be add_to_wishlist', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product added to wishlist', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + currency: defaultCurrency, + total, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'add_to_wishlist', + params: { + currency: defaultCurrency, + value, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-18', + name: 'ga4', + description: 'Track event call for product_shared event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all product_shared event properties and event name should be share', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product_shared', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: shareProductsCommonParams, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'share', + params: { + ...shareProductsExpectedOutputParams, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-19', + name: 'ga4', + description: 'Track event call for product_shared event without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no product_shared event properties and event name should be share', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product_shared', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'share', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-20', + name: 'ga4', + description: 'Track event call for cart Shared event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all cart Shared event properties and event name should be share', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'cart Shared', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: shareProductsCommonParams, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'share', + params: { + ...shareProductsExpectedOutputParams, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-21', + name: 'ga4', + description: 'Track event call for cart Shared event without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no cart Shared event properties and event name should be share', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'cart Shared', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'share', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-22', + name: 'ga4', + description: + 'Track event call for promotion clicked event with all event properties and type of client is firebase', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all promotion clicked event properties and event name should be select_promotion and response should contain all firebase related params', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { + ...destination.Config, + typesOfClient: 'firebase', + firebaseAppId: 'dummyFirebaseAppId', + }, + }, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'promotion clicked', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + ...promotionEventsCommonParams, + products: promotionEventsCommonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: { + api_secret: 'dummyApiSecret', + firebase_app_id: 'dummyFirebaseAppId', + }, + JSON: { + app_instance_id: 'dummyAppInstanceId', + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'select_promotion', + params: { + ...promotionEventsExpectedOutputParams, + items: promotionEventsExpectedOutputItems, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-23', + name: 'ga4', + description: 'Track event call for view_search_results event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all view_search_results event properties and event name should be view_search_results', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'view_search_results', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + search_term, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'view_search_results', + params: { + search_term, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-24', + name: 'ga4', + description: 'Track event call for view_search_results event with only products as properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain only products as view_search_results event properties and event name should be view_search_results', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'view_search_results', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'view_search_results', + params: { + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-25', + name: 'ga4', + description: 'Track event call for product added event with products information at root level', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain items array with product information and event name should be add_to_cart', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product added', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total, + ...commonProductInfo[0], + products: [], + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'add_to_cart', + params: { + currency: defaultCurrency, + value, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-26', + name: 'ga4', + description: 'Track event call for product added event with products as an object', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain items array with product information and event name should be add_to_cart', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product added', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total, + ...commonProductInfo[0], + products: commonProductInfo[0], + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'add_to_cart', + params: { + currency: defaultCurrency, + value, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-27', + name: 'ga4', + description: + 'Scenario to test custom properties along with products: [..] parameters to GA4 standard events along with its stated ones', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain both custom and standard properties', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'order completed', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + revenue: 15, + discount: 1.5, + checkout_id: '12345', + myCustomProp: 'My arbitray value', + ...orderEventsCommonParams, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'purchase', + params: { + affiliation: 'Google Store', + checkout_id: '12345', + coupon: 'SUMMER_FUN', + discount: 1.5, + currency: defaultCurrency, + myCustomProp: 'My arbitray value', + shipping: 3.33, + tax: 1.11, + transaction_id: 'T_12345', + value: 12.21, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-28', + name: 'ga4', + description: + 'Scenario to test custom properties excluding products: [..] parameter to GA4 standard events along with its stated ones', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain both custom and standard properties', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'promotion clicked', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + timezone, + promotion_page: '/products', + promotion_channel: 'facebook', + ...promotionEventsCommonParams, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'select_promotion', + params: { + promotion_page: '/products', + promotion_channel: 'facebook', + timezone_name: 'Europe/Tallinn', + ...promotionEventsExpectedOutputParams, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-29', + name: 'ga4', + description: 'Scenario to test price x currency multiplication for product added event', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain value calculated from price x currency and event name should be add_to_cart', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product added', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + price: 2.4, + quantity: 2, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'add_to_cart', + params: { + price: 2.4, + quantity: 2, + value: 4.8, + currency: defaultCurrency, + items: expectedOutputItems, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-ecom-test-30', + name: 'ga4', + description: + 'Scenario to test any custom or item property with array value, is flattened with underscore delimeter', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and all the nested properties should get flattened in final payload', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product added', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + properties: { + ...commonProductInfo[0], + address: { + city: 'kolkata', + district: '24pgs', + }, + categoryLevels: ['Furniture', 'Bedroom Furniture', 'Dressers & Chests'], + products: [ + { + product_id: '1234', + product_details: { + colour: 'red', + shape: 'rectangle', + }, + productLevels: ['test1', 'test2', 'test3'], + }, + ], + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'add_to_cart', + params: { + value: 38, + ...commonProductInfo[0], + address_city: 'kolkata', + address_district: '24pgs', + categoryLevels_0: 'Furniture', + categoryLevels_1: 'Bedroom Furniture', + categoryLevels_2: 'Dressers & Chests', + items: [ + { + item_id: '1234', + productLevels_0: 'test1', + productLevels_1: 'test2', + productLevels_2: 'test3', + product_details_colour: 'red', + product_details_shape: 'rectangle', + }, + ], + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, +]; diff --git a/test/integrations/destinations/ga4/processor/groupTestData.ts b/test/integrations/destinations/ga4/processor/groupTestData.ts new file mode 100644 index 0000000000..68daad3a8e --- /dev/null +++ b/test/integrations/destinations/ga4/processor/groupTestData.ts @@ -0,0 +1,306 @@ +import { defaultMockFns } from '../mocks'; +import { Destination } from '../../../../../src/types'; +import { ProcessorTestData } from '../../../testTypes'; +import { generateMetadata, transformResultBuilder, generateGroupPayload } from '../../../testUtils'; + +const destination: Destination = { + ID: '123', + Name: 'GA4', + DestinationDefinition: { + ID: '123', + Name: 'GA4', + DisplayName: 'Google Analytics 4 (GA4)', + Config: {}, + }, + Config: { + apiSecret: 'dummyApiSecret', + measurementId: 'dummyMeasurementId', + firebaseAppId: '', + blockPageViewEvent: false, + typesOfClient: 'gtag', + extendPageViewParams: false, + sendUserId: false, + eventFilteringOption: 'disable', + blacklistedEvents: [ + { + eventName: '', + }, + ], + whitelistedEvents: [ + { + eventName: '', + }, + ], + }, + Enabled: true, + WorkspaceID: '123', + Transformations: [], +}; + +const deviceInfo = { + adTrackingEnabled: 'false', + advertisingId: 'dummyAdvertisingId', + id: 'device@1', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, +}; + +const commonOutputHeaders = { + HOST: 'www.google-analytics.com', + 'Content-Type': 'application/json', +}; + +const commonOutputParams = { + api_secret: 'dummyApiSecret', + measurement_id: 'dummyMeasurementId', +}; + +const anonymousId = 'dummyAnonId'; +const externalIdWithClientId = [ + { + type: 'ga4AppInstanceId', + id: 'dummyAppInstanceId', + }, + { + type: 'ga4ClientId', + id: 'dummyClientId', + }, +]; +const sentAt = '2022-04-20T15:20:57Z'; +const originalTimestamp = '2022-04-26T05:17:09Z'; +const timezone = { + name: 'Europe/Tallinn', +}; +const clientId = 'dummyClientId'; +const userId = 'default-user-id'; + +const sessionId = 655; +const engagementTimeMsec = 100; +const non_personalized_ads = true; +const defaultEngagementTimeMsec = 1; +const timestamp_micros = 1650950229000000; + +const eventEndPoint = 'https://www.google-analytics.com/mp/collect'; + +export const groupTestData: ProcessorTestData[] = [ + { + id: 'ga4-group-test-1', + name: 'ga4', + description: 'Group event call with event name', + scenario: 'Business', + successCriteria: 'Response status code should be 200 and event name should be join_group', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateGroupPayload({ + type: 'group', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'join_group', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-group-test-2', + name: 'ga4', + description: 'Group event call with event name and properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and event payload should contain all properties and event name should be join_group', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateGroupPayload({ + type: 'group', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + traits: { + org: 'rudderlabs', + sector: 'cdp', + timezone, + engagementTimeMsec, + sessionId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'join_group', + params: { + sector: 'cdp', + org: 'rudderlabs', + timezone_name: timezone.name, + session_id: sessionId, + engagement_time_msec: engagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-group-test-3', + name: 'ga4', + description: 'Scenario to test firing group calls with GA4 hybrid mode connection', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and response should containe track event properties', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { ...destination.Config, connectionMode: 'hybrid' }, + }, + message: { + type: 'group', + event: 'tutorial complete', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + sessionId: 1683172874065, + }, + integrations: { + 'Google Analytics 4': { + clientId: '4718026.1683606287', + sessionId: '1683606287', + sessionNumber: 1, + }, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: '4718026.1683606287', + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'join_group', + params: { + session_id: '1683606287', + session_number: 1, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, +]; diff --git a/test/integrations/destinations/ga4/processor/pageTestData.ts b/test/integrations/destinations/ga4/processor/pageTestData.ts new file mode 100644 index 0000000000..fa0b187aea --- /dev/null +++ b/test/integrations/destinations/ga4/processor/pageTestData.ts @@ -0,0 +1,304 @@ +import { defaultMockFns } from '../mocks'; +import { Destination } from '../../../../../src/types'; +import { ProcessorTestData } from '../../../testTypes'; +import { + generateMetadata, + transformResultBuilder, + generatePageOrScreenPayload, +} from '../../../testUtils'; + +const destination: Destination = { + ID: '123', + Name: 'GA4', + DestinationDefinition: { + ID: '123', + Name: 'GA4', + DisplayName: 'Google Analytics 4 (GA4)', + Config: {}, + }, + Config: { + apiSecret: 'dummyApiSecret', + measurementId: 'dummyMeasurementId', + firebaseAppId: '', + blockPageViewEvent: false, + typesOfClient: 'gtag', + extendPageViewParams: false, + sendUserId: false, + eventFilteringOption: 'disable', + blacklistedEvents: [ + { + eventName: '', + }, + ], + whitelistedEvents: [ + { + eventName: '', + }, + ], + }, + Enabled: true, + WorkspaceID: '123', + Transformations: [], +}; + +const deviceInfo = { + adTrackingEnabled: 'false', + advertisingId: 'dummyAdvertisingId', + id: 'device@1', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, +}; + +const commonOutputHeaders = { + HOST: 'www.google-analytics.com', + 'Content-Type': 'application/json', +}; + +const commonOutputParams = { + api_secret: 'dummyApiSecret', + measurement_id: 'dummyMeasurementId', +}; + +const anonymousId = 'dummyAnonId'; +const externalId = [ + { + type: 'ga4AppInstanceId', + id: 'dummyAppInstanceId', + }, +]; +const page = { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + referrer: 'morkey', +}; +const sentAt = '2022-04-20T15:20:57Z'; +const originalTimestamp = '2022-04-26T05:17:09Z'; + +const userId = 'default-userId'; +const non_personalized_ads = true; +const defaultEngagementTimeMsec = 1; +const timestamp_micros = 1650950229000000; + +const expectedOutputParams = { + page_title: 'miphone', + page_referrer: 'morkey', + page_location: 'http://morkey.in', +}; + +const eventEndPoint = 'https://www.google-analytics.com/mp/collect'; + +export const pageTestData: ProcessorTestData[] = [ + { + id: 'ga4-page-test-1', + name: 'ga4', + description: 'Scenario to test page call', + scenario: 'Business', + successCriteria: 'Response status code should be 200 and event name should be page_view', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generatePageOrScreenPayload( + { + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + originalTimestamp, + }, + 'page', + ), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'page_view', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-page-test-2', + name: 'ga4', + description: 'Scenario to test page call with custom properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and event payload should contain all custom properties event name should be page_view', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generatePageOrScreenPayload( + { + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + properties: { + view: 'login', + }, + originalTimestamp, + }, + 'page', + ), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'page_view', + params: { + view: 'login', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-page-test-3', + name: 'ga4', + description: + 'Scenario to test take page properties from context.page for page call along with custom properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and event payload should contain all custom properties event name should be page_view', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generatePageOrScreenPayload( + { + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + page, + }, + properties: { + id: 'dummyId', + }, + originalTimestamp, + }, + 'page', + ), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'page_view', + params: { + id: 'dummyId', + ...expectedOutputParams, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, +]; diff --git a/test/integrations/destinations/ga4/processor/trackTestData.ts b/test/integrations/destinations/ga4/processor/trackTestData.ts new file mode 100644 index 0000000000..ce991ff845 --- /dev/null +++ b/test/integrations/destinations/ga4/processor/trackTestData.ts @@ -0,0 +1,2951 @@ +import { defaultMockFns } from '../mocks'; +import { Destination } from '../../../../../src/types'; +import { ProcessorTestData } from '../../../testTypes'; +import { + generateMetadata, + transformResultBuilder, + generateSimplifiedTrackPayload, +} from '../../../testUtils'; + +const destination: Destination = { + ID: '123', + Name: 'GA4', + DestinationDefinition: { + ID: '123', + Name: 'GA4', + DisplayName: 'Google Analytics 4 (GA4)', + Config: {}, + }, + Config: { + apiSecret: 'dummyApiSecret', + measurementId: 'dummyMeasurementId', + firebaseAppId: '', + blockPageViewEvent: false, + typesOfClient: 'gtag', + extendPageViewParams: false, + sendUserId: false, + eventFilteringOption: 'disable', + blacklistedEvents: [ + { + eventName: '', + }, + ], + whitelistedEvents: [ + { + eventName: '', + }, + ], + }, + Enabled: true, + WorkspaceID: '123', + Transformations: [], +}; + +const deviceInfo = { + adTrackingEnabled: 'false', + advertisingId: 'dummyAdvertisingId', + id: 'device@1', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, +}; + +const commonOutputHeaders = { + HOST: 'www.google-analytics.com', + 'Content-Type': 'application/json', +}; + +const commonOutputParams = { + api_secret: 'dummyApiSecret', + measurement_id: 'dummyMeasurementId', +}; + +const anonymousId = 'dummyAnonId'; +const externalId = [ + { + type: 'ga4AppInstanceId', + id: 'dummyAppInstanceId', + }, +]; +const externalIdWithClientId = [ + { + type: 'ga4AppInstanceId', + id: 'dummyAppInstanceId', + }, + { + type: 'ga4ClientId', + id: 'dummyClientId', + }, +]; +const page = { + initial_referrer: '$direct', + path: '/', + referrer: '$direct', + tab_url: 'https://www.rudderstack.com/', + title: 'Document', + url: 'https://www.rudderstack.com/', +}; +const campaign = { + id: 'google_1234', + name: 'Summer_fun', + source: 'google', + medium: 'cpc', + term: 'summer+travel', + content: 'logo link', +}; +const sentAt = '2022-04-20T15:20:57Z'; +const originalTimestamp = '2022-04-26T05:17:09Z'; + +const clientId = 'dummyClientId'; +const userId = 'default-user-id'; +const groupId = 'dummyGroupId'; +const defaultCurrency = 'USD'; +const value = 7.77; +const total = 10; +const sessionId = 655; +const engagementTimeMsec = 100; +const non_personalized_ads = true; +const defaultEngagementTimeMsec = 1; +const timestamp_micros = 1650950229000000; +const timezone = { + name: 'Europe/Tallinn', +}; + +const expectedCampaignOutputParams = { + campaign_id: 'google_1234', + campaign: 'Summer_fun', + source: 'google', + medium: 'cpc', + term: 'summer+travel', + content: 'logo link', +}; + +const eventEndPoint = 'https://www.google-analytics.com/mp/collect'; + +export const trackTestData: ProcessorTestData[] = [ + { + id: 'ga4-track-test-1', + name: 'ga4', + description: 'Track event call for earn virtual currency event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all earn virtual currency event properties and event name should be earn_virtual_currency', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'earn virtual currency', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + value, + virtual_currency_name: 'Gems', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'earn_virtual_currency', + params: { + value, + virtual_currency_name: 'Gems', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-2', + name: 'ga4', + description: 'Track event call for earn virtual currency without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no earn virtual currency event properties and event name should be earn_virtual_currency', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'earn virtual currency', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'earn_virtual_currency', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-3', + name: 'ga4', + description: 'Track event call for generate_lead event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all generate_lead event properties and event name should be generate_lead', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'generate_lead', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + value, + currency: defaultCurrency, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'generate_lead', + params: { + value, + currency: defaultCurrency, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-4', + name: 'ga4', + description: 'Track event call for level_up event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all level_up event properties and event name should be level_up', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'level_up', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + level: 5, + character: 'Player 1', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'level_up', + params: { + level: 5, + character: 'Player 1', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-5', + name: 'ga4', + description: 'Track event call for level_up without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no level_up event properties and event name should be level_up', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'level_up', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'level_up', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-6', + name: 'ga4', + description: 'Track event call for group event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all group event properties and event name should be group', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'group', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + group_id: groupId, + engagementTimeMsec, + sessionId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'group', + params: { + group_id: groupId, + session_id: sessionId, + engagement_time_msec: engagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-7', + name: 'ga4', + description: 'Track event call for group without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no group event properties and event name should be group', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'group', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'group', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-8', + name: 'ga4', + description: 'Track event call for login event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all login event properties and event name should be login', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'login', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + method: 'Google', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'login', + params: { + method: 'Google', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-9', + name: 'ga4', + description: 'Track event call for login without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no login event properties and event name should be login', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'login', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'login', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-10', + name: 'ga4', + description: 'Track event call for post_score event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all post_score event properties and event name should be post_score', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'post_score', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + score: 10000, + level: 5, + character: 'Player 1', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'post_score', + params: { + score: 10000, + level: 5, + character: 'Player 1', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-11', + name: 'ga4', + description: 'Track event call for post_score event with only required event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain only required post_score event properties and event name should be post_score', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'post_score', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + score: 10000, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'post_score', + params: { + score: 10000, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-12', + name: 'ga4', + description: 'Track event call for select_content event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all select_content event properties and event name should be select_content', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'select_content', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + item_id: 'I_12345', + content_type: 'product', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'select_content', + params: { + item_id: 'I_12345', + content_type: 'product', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-13', + name: 'ga4', + description: 'Track event call for select_content without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no select_content event properties and event name should be select_content', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'select_content', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'select_content', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-14', + name: 'ga4', + description: 'Track event call for sign_up event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all sign_up event properties and event name should be sign_up', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'sign_up', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + method: 'Google', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'sign_up', + params: { + method: 'Google', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-15', + name: 'ga4', + description: 'Track event call for sign_up without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no sign_up event properties and event name should be sign_up', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'sign_up', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'sign_up', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-16', + name: 'ga4', + description: 'Track event call for spend_virtual_currency event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all spend_virtual_currency event properties and event name should be spend_virtual_currency', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'spend_virtual_currency', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + value: 5, + item_name: 'Starter Boost', + virtual_currency_name: 'Gems', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'spend_virtual_currency', + params: { + value: 5, + item_name: 'Starter Boost', + virtual_currency_name: 'Gems', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-17', + name: 'ga4', + description: 'Track event call for spend_virtual_currency without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no spend_virtual_currency event properties and event name should be spend_virtual_currency', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'spend_virtual_currency', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'spend_virtual_currency', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-18', + name: 'ga4', + description: 'Track event call for tutorial_begin without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no tutorial_begin event properties and event name should be tutorial_begin', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'tutorial_begin', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'tutorial_begin', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-19', + name: 'ga4', + description: 'Track event call for tutorial_complete without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no tutorial_complete event properties and event name should be tutorial_complete', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'tutorial_complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'tutorial_complete', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-20', + name: 'ga4', + description: 'Track event call for unlock_achievement event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all unlock_achievement event properties and event name should be unlock_achievement', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'unlock_achievement', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + achievement_id: 'A_12345', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'unlock_achievement', + params: { + achievement_id: 'A_12345', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-21', + name: 'ga4', + description: 'Track event call for rudderstack event event with all event properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all rudderstack event event properties and event name should be rudderstack_event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'rudderstack event', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total, + timezone, + engagementTimeMsec, + sessionId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'rudderstack_event', + params: { + total, + timezone_name: timezone.name, + session_id: sessionId, + engagement_time_msec: engagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-22', + name: 'ga4', + description: + 'Track event call for rudderstack event event with all event properties and user properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all rudderstack event event properties and user properties and event name should be rudderstack_event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'rudderstack event', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total, + user_properties: { + price: '19', + }, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + user_properties: { + price: { + value: '19', + }, + }, + events: [ + { + name: 'rudderstack_event', + params: { + total, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-23', + name: 'ga4', + description: 'Scenario to test custom events by passing reserved property names in payload', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all custom event properties and reserved properties should gets filtered from transformed payload', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'rudderstack event', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total, + firebase_conversion: 'firebase_conversion', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'rudderstack_event', + params: { + total, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-24', + name: 'ga4', + description: + 'Scenario to test custom events by passing reserved properties and reserved user properties in payload', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain all custom event properties and reserved properties and reserved user properties should gets filtered from transformed payload', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'rudderstack event', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total, + firebase_conversion: 'firebase_conversion', + user_properties: { + first_open_time: 'first_open_time', + user_id: userId, + firebase_value: 'firebase_value', + }, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'rudderstack_event', + params: { + total, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-25', + name: 'ga4', + description: 'Track event call for custom event without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no custom event properties and event name should be custom event name', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'rudderstack event', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'rudderstack_event', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-26', + name: 'ga4', + description: 'Track event call for taking client_id from anonymousId', + scenario: 'Business', + successCriteria: 'Response status code should be 200 and client_id should be anonymousId', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'tutotial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'tutotial_complete', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-27', + name: 'ga4', + description: 'Track event call for tutorial_complete without properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, event payload should contain no tutorial_complete event properties and event name should be tutorial_complete', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'tutorial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: clientId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'tutorial_complete', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-28', + name: 'ga4', + description: + 'Scenario to test client_id is not sent from the path defined in the webapp config, falling back to default values i.e here it is anonymousId', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, client_id value should be equal to anonymousId', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'tutorial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'tutorial_complete', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-29', + name: 'ga4', + description: 'Scenario to test extract session_id from context.sessionId', + scenario: 'Business', + successCriteria: + 'Response status code should be 200, session_id value should be equal to context.sessionId', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'tutorial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + sessionId: 16678456735, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + non_personalized_ads, + events: [ + { + name: 'tutorial_complete', + params: { + session_id: 16678456735, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-30', + name: 'ga4', + description: 'Scenario to test integer userId', + scenario: 'Business', + successCriteria: 'Response status code should be 200, user_id value should get stringified', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'tutorial complete', + userId: 1234, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + sessionId: 16678456735, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: '1234', + non_personalized_ads, + events: [ + { + name: 'tutorial_complete', + params: { + session_id: 16678456735, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-31', + name: 'ga4', + description: 'Scenario to test login event with user_properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and response should contain all user_properties passed with payload', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'login', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + traits: { + campaign: 'advertizing', + }, + }, + properties: { + method: 'facebook', + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + user_properties: { + campaign: { + value: 'advertizing', + }, + }, + events: [ + { + name: 'login', + params: { + method: 'facebook', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-32', + name: 'ga4', + description: 'Scenario to test track call with page information such as url, title, referrer', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and response should contain all page related parameters', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'generate_lead', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + page, + }, + properties: { + value, + source: 'instagram', + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'generate_lead', + params: { + value, + currency: 'USD', + source: 'instagram', + page_location: 'https://www.rudderstack.com/', + page_referrer: '$direct', + page_title: 'Document', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-33', + name: 'ga4', + description: + 'Scenario to test track event with hybrid connection mode using buffer cloud mode event approach', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and response should contain track event properties', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { ...destination.Config, connectionMode: 'hybrid' }, + }, + message: { + type: 'track', + event: 'generate_lead', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + properties: { + value, + source: 'instagram', + }, + integrations: { + All: true, + 'Google Analytics 4 (GA4)': { + clientId: '554581488.1683172875', + sessionId: '1683172875', + }, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: '554581488.1683172875', + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'generate_lead', + params: { + value, + currency: 'USD', + source: 'instagram', + session_id: '1683172875', + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-34', + name: 'ga4', + description: + 'Scenario to test track event with hybrid connection mode using override client_id and session_id approach', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and response should contain track event properties', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { ...destination.Config, connectionMode: 'hybrid' }, + }, + message: { + type: 'track', + event: 'generate_lead', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + sessionId: 1683172874065, + }, + properties: { + value, + source: 'instagram', + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'generate_lead', + params: { + value, + currency: 'USD', + source: 'instagram', + session_id: 1683172874065, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-35', + name: 'ga4', + description: 'Scenario to test sign_up event with all data types of user_properties', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and response should contain all user_properties sent in payload', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { ...destination.Config, connectionMode: 'hybrid' }, + }, + message: { + type: 'track', + event: 'sign_up', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + sessionId: 1683172874065, + traits: { + campaign: 'advertizing', + name: 'rudder', + age: 45, + hobby: ['dancing', 'singing', 'reading'], + enableEURegion: false, + isEnterpriseUser: { + value: false, + }, + }, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + user_properties: { + age: { + value: 45, + }, + name: { + value: 'rudder', + }, + campaign: { + value: 'advertizing', + }, + enableEURegion: { + value: false, + }, + }, + events: [ + { + name: 'sign_up', + params: { + session_id: 1683172874065, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-36', + name: 'ga4', + description: 'Scenario to test event having multiple empty array and object parameters', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and in final response empty array and object should gets filtered out', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'login', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + properties: { + user_interest: 'Moderate', + company_interest: '', + profile: [ + { + is_6qa: true, + product: null, + product_fit: 'Moderate', + product_stage: 'Purchase', + intent_score: 89, + profile_score: 52, + product_display$name: 'rudderstack', + }, + ], + user_company: 'Analytics consulting', + user_account: '1', + user_id_mappings: '330098|245252|461224|282599', + company_naics_6sense: '5173', + usr_consent: null, + firebase_user_id: 'kdgMnP', + google_user_id: 'G-123456', + company_domain: 'consulting.net', + company_region: 'New Zealand', + user_product_interests: { + ids: [], + list: [ + { + id: 330098, + name: [], + }, + { + id: 245252, + name: {}, + }, + ], + names: [], + }, + company_country: {}, + company_industry: 'Business Analytics', + company_revenue: '$5M - $10M', + company_annual_revenue: '5568000', + company_sic_description: '', + company_naics_description: [], + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'login', + params: { + company_annual_revenue: '5568000', + company_domain: 'consulting.net', + company_industry: 'Business Analytics', + company_naics_6sense: '5173', + company_region: 'New Zealand', + company_revenue: '$5M - $10M', + engagement_time_msec: defaultEngagementTimeMsec, + profile_0_intent_score: 89, + profile_0_is_6qa: true, + profile_0_product_display$name: 'rudderstack', + profile_0_product_fit: 'Moderate', + profile_0_product_stage: 'Purchase', + profile_0_profile_score: 52, + user_account: '1', + user_company: 'Analytics consulting', + user_id_mappings: '330098|245252|461224|282599', + user_interest: 'Moderate', + user_product_interests_list_0_id: 330098, + user_product_interests_list_1_id: 245252, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-37', + name: 'ga4', + description: "Teack event call with campaign_details custom event and it's properties", + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and resonse should contain all campaign_details event properties and event name should be campaign_details', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'campaign_details', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + campaign, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + events: [ + { + name: 'campaign_details', + params: { + ...expectedCampaignOutputParams, + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-38', + name: 'ga4', + description: 'Send consents setting to ga4 with login event', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and response should contain all consent settings', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'login', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + campaign, + }, + originalTimestamp, + integrations: { + All: true, + GA4: { + consents: { + ad_personalization: 'GRANTED', + ad_user_data: 'GRANTED', + }, + }, + }, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + consent: { + ad_personalization: 'GRANTED', + ad_user_data: 'GRANTED', + }, + events: [ + { + name: 'login', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-track-test-39', + name: 'ga4', + description: 'Send invalid consents settings to ga4 with login event', + scenario: 'Business', + successCriteria: + 'Response status code should be 200 and response should contain only valid consent setting', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'login', + userId, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId, + campaign, + }, + originalTimestamp, + integrations: { + All: true, + GA4: { + consents: { + ad_personalization: 'NOT_SPECIFIED', + ad_user_data: 'DENIED', + }, + }, + }, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: eventEndPoint, + headers: commonOutputHeaders, + params: commonOutputParams, + JSON: { + client_id: anonymousId, + timestamp_micros, + user_id: userId, + non_personalized_ads, + consent: { + ad_user_data: 'DENIED', + }, + events: [ + { + name: 'login', + params: { + engagement_time_msec: defaultEngagementTimeMsec, + }, + }, + ], + }, + userId: '', + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, +]; diff --git a/test/integrations/destinations/ga4/processor/validationTestData.ts b/test/integrations/destinations/ga4/processor/validationTestData.ts new file mode 100644 index 0000000000..4e5d09bfcf --- /dev/null +++ b/test/integrations/destinations/ga4/processor/validationTestData.ts @@ -0,0 +1,947 @@ +import { defaultMockFns } from '../mocks'; +import { Destination } from '../../../../../src/types'; +import { ProcessorTestData } from '../../../testTypes'; +import { generateMetadata, generateSimplifiedTrackPayload } from '../../../testUtils'; + +const destination: Destination = { + ID: '123', + Name: 'GA4', + DestinationDefinition: { + ID: '123', + Name: 'GA4', + DisplayName: 'Google Analytics 4 (GA4)', + Config: {}, + }, + Config: { + apiSecret: 'dummyApiSecret', + measurementId: 'dummyMeasurementId', + firebaseAppId: '', + blockPageViewEvent: false, + typesOfClient: 'gtag', + extendPageViewParams: false, + sendUserId: false, + eventFilteringOption: 'disable', + blacklistedEvents: [ + { + eventName: '', + }, + ], + whitelistedEvents: [ + { + eventName: '', + }, + ], + }, + Enabled: true, + WorkspaceID: '123', + Transformations: [], +}; + +const deviceInfo = { + adTrackingEnabled: 'false', + advertisingId: 'dummyAdvertisingId', + id: 'device@1', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, +}; + +const anonymousId = 'dummyAnonId'; +const userId = 'default-user-id'; +const externalId = [ + { + type: 'ga4AppInstanceId', + id: 'dummyAppInstanceId', + }, +]; +const externalIdWithClientId = [ + { + type: 'ga4AppInstanceId', + id: 'dummyAppInstanceId', + }, + { + type: 'ga4ClientId', + id: 'dummyClientId', + }, +]; +const sentAt = '2022-04-20T15:20:57Z'; +const originalTimestamp = '2022-04-26T05:17:09Z'; + +const commonProductInfo = [ + { + coupon: 'SUMMER_FUN', + category: 'Apparel', + brand: 'Google', + variant: 'green', + price: '19', + quantity: '2', + position: '1', + affiliation: 'Google Merchandise Store', + currency: 'USD', + discount: 2.22, + item_category2: 'Adult', + item_category3: 'Shirts', + item_category4: 'Crew', + item_category5: 'Short sleeve', + item_list_id: 'related_products', + item_list_name: 'Related Products', + location_id: 'L_12345', + }, +]; + +const reservedEventsErrorMessage = 'track:: Reserved event names are not allowed'; +const expectedStatTags = { + destType: 'GA4', + destinationId: 'default-destinationId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + workspaceId: 'default-workspaceId', +}; + +export const validationTestData: ProcessorTestData[] = [ + { + id: 'ga4-validation-test-1', + name: 'ga4', + description: 'Scenario to test reserved event name to GA4', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'ad_click', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total: 10, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: reservedEventsErrorMessage, + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-2', + name: 'ga4', + description: 'Scenario to test reserved event name along with reserved event properties to GA4', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'app_remove', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + firebase_conversion: 'firebase_conversion', + google_id: 'ga_id', + ga_value: 'ga_value', + value: 10, + user_properties: { + first_open_time: 'first_open_time', + user_id: userId, + firebase_value: 'firebase_value', + }, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: reservedEventsErrorMessage, + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-3', + name: 'ga4', + description: 'Scenario to test reserved prefix names to GA4', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'firebase_event1', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + value: 10, + google_id: 'ga_id', + ga_value: 'ga_value', + firebase_conversion: 'firebase_conversion', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Reserved custom prefix names are not allowed', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-4', + name: 'ga4', + description: + 'Scenario to pass event name to GA4 with missing fields i.e required in products: [..]', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'product added', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total: 7.77, + products: commonProductInfo, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'One of product_id or name is required', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-5', + name: 'ga4', + description: + 'Scenario to pass event name to GA4 with missing fields i.e required in products: [..]', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'Product Viewed', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + properties: { + total: 7.77, + currency: 'USD', + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'One of product_id or name is required', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-6', + name: 'ga4', + description: 'Scenario to test missing API Secret', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw configuration error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { ...destination.Config, apiSecret: null }, + Enabled: true, + }, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'tutotial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'API Secret not found. Aborting ', + statTags: { ...expectedStatTags, errorType: 'configuration' }, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-7', + name: 'ga4', + description: 'Scenario to test missing measurementId', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw configuration error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { ...destination.Config, measurementId: null }, + Enabled: true, + }, + message: generateSimplifiedTrackPayload({ + type: 'track', + event: 'tutotial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }), + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'measurementId must be provided. Aborting', + statTags: { ...expectedStatTags, errorType: 'configuration' }, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-8', + name: 'ga4', + description: 'Scenario to test missing message type', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw instrumentation error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + event: 'tutotial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Message Type is not present. Aborting message.', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-9', + name: 'ga4', + description: 'Scenario to test missing message event name', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw instrumentation error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Event name is required', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-10', + name: 'ga4', + description: 'Scenario to test missing ga4AppInstanceId for firebase client type', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw instrumentation error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { + ...destination.Config, + typesOfClient: 'firebase', + firebaseAppId: 'dummyFirebaseAppId', + }, + }, + message: { + type: 'track', + event: 'tutotial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'ga4AppInstanceId must be provided under externalId', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-11', + name: 'ga4', + description: 'Scenario to test reserved event name for firebase client type', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw instrumentation error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { + ...destination.Config, + typesOfClient: 'firebase', + firebaseAppId: 'dummyFirebaseAppId', + }, + }, + message: { + type: 'track', + event: 'app_store_subscription_cancel', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Reserved custom event names are not allowed', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-12', + name: 'ga4', + description: 'Scenario to test missing firebaseAppId for firebase client type', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw configuration error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ...destination, + Config: { + ...destination.Config, + typesOfClient: 'firebase', + firebaseAppId: null, + }, + }, + message: { + type: 'track', + event: 'tutotial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'firebaseAppId must be provided. Aborting', + statTags: { ...expectedStatTags, errorType: 'configuration' }, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + mockFns: defaultMockFns, + }, + { + id: 'ga4-validation-test-13', + name: 'ga4', + description: 'Scenario to test timestamp more than 72 hours into the past', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw instrumentation error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'tutotial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp: '2022-04-20T05:17:09Z', + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Allowed timestamp is [72 hours] into the past', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, + { + id: 'ga4-validation-test-14', + name: 'ga4', + description: 'Scenario to test timestamp more than 15 min into the future', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw instrumentation error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'tutotial complete', + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp: '2022-05-05T15:47:57Z', + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Allowed timestamp is [15 minutes] into the future', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, + { + id: 'ga4-validation-test-15', + name: 'ga4', + description: 'Scenario to test event value other then string', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw instrumentation error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: { + name: 'promotion_viewed', + }, + properties: { + products: commonProductInfo, + }, + anonymousId, + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp: '2022-05-05T15:47:57Z', + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'track:: event name should be string', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, + { + id: 'ga4-validation-test-16', + name: 'ga4', + description: 'Scenario to test client_id not found in payload', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw configuration error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: 'product added', + properties: { + products: commonProductInfo, + }, + sentAt, + context: { + device: deviceInfo, + externalId, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'ga4ClientId, anonymousId or messageId must be provided', + statTags: { ...expectedStatTags, errorType: 'configuration' }, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, + { + id: 'ga4-validation-test-17', + name: 'ga4', + description: 'Scenario to test event name starts with numbers', + scenario: 'Business', + successCriteria: + 'Response status code should be 400 and it should throw instrumentation error with respective message', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + event: '1234_sign_up', + sentAt, + context: { + device: deviceInfo, + externalId: externalIdWithClientId, + }, + originalTimestamp, + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'Event name must start with a letter and can only contain letters, numbers, and underscores', + statTags: expectedStatTags, + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/google_adwords_enhanced_conversions/processor/data.ts b/test/integrations/destinations/google_adwords_enhanced_conversions/processor/data.ts index 0a9542a5d5..13b2609bf8 100644 --- a/test/integrations/destinations/google_adwords_enhanced_conversions/processor/data.ts +++ b/test/integrations/destinations/google_adwords_enhanced_conversions/processor/data.ts @@ -1255,7 +1255,7 @@ export const data = [ }, traits: { phone: '912382193', - firstName: 'John', + firstName: ' John', lastName: 'Gomes', city: 'London', state: 'UK', diff --git a/test/integrations/destinations/google_adwords_offline_conversions/processor/data.ts b/test/integrations/destinations/google_adwords_offline_conversions/processor/data.ts index decb1e58c7..ab3e19dc2f 100644 --- a/test/integrations/destinations/google_adwords_offline_conversions/processor/data.ts +++ b/test/integrations/destinations/google_adwords_offline_conversions/processor/data.ts @@ -321,7 +321,7 @@ export const data = [ advertisingId: '44c97318-9040-4361-8bc7-4eb30f665ca8', }, traits: { - email: 'alex@example.com', + email: ' alex@example.com', phone: '+1-202-555-0146', firstName: 'John', lastName: 'Gomes', diff --git a/test/integrations/destinations/impact/processor/data.ts b/test/integrations/destinations/impact/processor/data.ts index 1e4e91e7ad..0841f44c62 100644 --- a/test/integrations/destinations/impact/processor/data.ts +++ b/test/integrations/destinations/impact/processor/data.ts @@ -26,7 +26,7 @@ export const data = [ namespace: 'com.rudderlabs.javascript', }, traits: { - email: 'user123@email.com', + email: ' user123@email.com', phone: '+917836362334', userId: 'user123', }, diff --git a/test/integrations/destinations/koddi/common.ts b/test/integrations/destinations/koddi/common.ts new file mode 100644 index 0000000000..ec83a0f446 --- /dev/null +++ b/test/integrations/destinations/koddi/common.ts @@ -0,0 +1,78 @@ +import { Destination } from '../../../../src/types'; + +const destType = 'koddi'; +const destTypeInUpperCase = 'KODDI'; +const displayName = 'Koddi'; +const channel = 'web'; +const destination: Destination = { + Config: { + apiBaseUrl: 'https://www.test-client.com', + clientName: 'test-client', + }, + DestinationDefinition: { + DisplayName: displayName, + ID: '123', + Name: destTypeInUpperCase, + Config: { cdkV2Enabled: true }, + }, + Enabled: true, + ID: '123', + Name: destTypeInUpperCase, + Transformations: [], + WorkspaceID: 'test-workspace-id', +}; + +const processorInstrumentationErrorStatTags = { + destType: destTypeInUpperCase, + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + destinationId: 'default-destinationId', + workspaceId: 'default-workspaceId', +}; + +const RouterInstrumentationErrorStatTags = { + ...processorInstrumentationErrorStatTags, + feature: 'router', +}; + +const getHeader = { + accept: 'application/json', +}; + +const postHeader = { + ...getHeader, + 'content-type': 'application/json', +}; + +const bidders = [ + { + bidder: 'bidder1', + alternate_bidder: 'alternate1', + count: 1, + base_price: 100, + total_price: 227, + }, +]; + +const alternateBidders = [ + { + count: 1, + base_price: 100, + total_price: 227, + }, +]; + +export { + destType, + channel, + destination, + processorInstrumentationErrorStatTags, + RouterInstrumentationErrorStatTags, + getHeader, + postHeader, + bidders, + alternateBidders, +}; diff --git a/test/integrations/destinations/koddi/processor/clicks.ts b/test/integrations/destinations/koddi/processor/clicks.ts new file mode 100644 index 0000000000..6101e9bafe --- /dev/null +++ b/test/integrations/destinations/koddi/processor/clicks.ts @@ -0,0 +1,70 @@ +import { ProcessorTestData } from '../../../testTypes'; +import { generateMetadata, transformResultBuilder } from '../../../testUtils'; +import { destType, channel, destination, getHeader } from '../common'; + +export const clicks: ProcessorTestData[] = [ + { + id: 'Clicks-test', + name: destType, + description: 'Clicks call: Example Clicks Event', + scenario: 'Framework+Business', + successCriteria: + 'Response should contain the input payload with mappings configured in transformer and status code should be 200', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + event: 'Example Clicks Event', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + integrations: { + All: true, + koddi: { + eventType: 'Clicks', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'GET', + endpoint: destination.Config.apiBaseUrl + '?action=click', + headers: getHeader, + userId: '', + params: { + trackingData: 'dummy-tracking-data', + rank: 1, + beaconIssued: '2024-03-04T15:32:56.409Z', + userGuid: 'userId123', + clientName: destination.Config.clientName, + }, + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/koddi/processor/conversions.ts b/test/integrations/destinations/koddi/processor/conversions.ts new file mode 100644 index 0000000000..1647ffed7d --- /dev/null +++ b/test/integrations/destinations/koddi/processor/conversions.ts @@ -0,0 +1,142 @@ +import { ProcessorTestData } from '../../../testTypes'; +import { generateMetadata, transformResultBuilder } from '../../../testUtils'; +import { + destType, + channel, + destination, + postHeader, + bidders, + alternateBidders, + processorInstrumentationErrorStatTags, +} from '../common'; + +export const conversions: ProcessorTestData[] = [ + { + id: 'Conversions-test-1', + name: destType, + description: 'Conversions call: Example Conversions Event', + scenario: 'Framework+Business', + successCriteria: + 'Response should contain the input payload with mappings configured in transformer and status code should be 200', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + event: 'Example Conversions Event', + properties: { + currency: 'USD', + transaction_id: 'ABC123', + bidders, + }, + context: { + locale: 'en-US', + ip: '127.0.0.1', + }, + integrations: { + All: true, + koddi: { + eventType: 'Conversions', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'POST', + endpoint: destination.Config.apiBaseUrl + '/conversion', + headers: postHeader, + userId: '', + JSON: { + client_name: destination.Config.clientName, + culture: 'en-US', + currency: 'USD', + transaction_id: 'ABC123', + unixtime: 1709566376, + user_guid: 'userId123', + user_ip: '127.0.0.1', + bidders: bidders, + }, + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, + { + id: 'Conversions-test-2', + name: destType, + description: 'Conversions call: Example Conversions Event with missing required field', + scenario: 'Framework+Business', + successCriteria: 'Response should contain error and status code should be 400', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + event: 'Example Conversions Event', + properties: { + currency: 'USD', + transaction_id: 'ABC123', + alternateBidders, + }, + context: { + locale: 'en-US', + ip: '127.0.0.1', + }, + integrations: { + All: true, + koddi: { + eventType: 'Conversions', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'Missing required value from "properties.bidders": Workflow: procWorkflow, Step: preparePayload, ChildStep: undefined, OriginalError: Missing required value from "properties.bidders"', + statusCode: 400, + metadata: generateMetadata(1), + statTags: processorInstrumentationErrorStatTags, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/koddi/processor/data.ts b/test/integrations/destinations/koddi/processor/data.ts new file mode 100644 index 0000000000..5c3d7da472 --- /dev/null +++ b/test/integrations/destinations/koddi/processor/data.ts @@ -0,0 +1,5 @@ +import { impressions } from './impressions'; +import { clicks } from './clicks'; +import { conversions } from './conversions'; + +export const data = [...impressions, ...clicks, ...conversions]; diff --git a/test/integrations/destinations/koddi/processor/impressions.ts b/test/integrations/destinations/koddi/processor/impressions.ts new file mode 100644 index 0000000000..840ed9139f --- /dev/null +++ b/test/integrations/destinations/koddi/processor/impressions.ts @@ -0,0 +1,70 @@ +import { ProcessorTestData } from '../../../testTypes'; +import { generateMetadata, transformResultBuilder } from '../../../testUtils'; +import { destType, channel, destination, getHeader } from '../common'; + +export const impressions: ProcessorTestData[] = [ + { + id: 'Impressions-test', + name: destType, + description: 'Impressions call: Example Impression Event', + scenario: 'Framework+Business', + successCriteria: + 'Response should contain the input payload with mappings configured in transformer and status code should be 200', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + event: 'Example Impression Event', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + integrations: { + All: true, + koddi: { + eventType: 'Impressions', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(1), + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: transformResultBuilder({ + method: 'GET', + endpoint: destination.Config.apiBaseUrl + '?action=impression', + headers: getHeader, + userId: '', + params: { + trackingData: 'dummy-tracking-data', + rank: 1, + beaconIssued: '2024-03-04T15:32:56.409Z', + ts: '2024-03-04T15:32:56.409Z', + clientName: destination.Config.clientName, + }, + }), + statusCode: 200, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/koddi/router/data.ts b/test/integrations/destinations/koddi/router/data.ts new file mode 100644 index 0000000000..1601a481e5 --- /dev/null +++ b/test/integrations/destinations/koddi/router/data.ts @@ -0,0 +1,262 @@ +import { RouterTransformationRequest } from '../../../../../src/types'; +import { generateMetadata } from '../../../testUtils'; +import { + destType, + channel, + destination, + getHeader, + postHeader, + RouterInstrumentationErrorStatTags, + bidders, +} from '../common'; + +const routerRequest: RouterTransformationRequest = { + input: [ + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + event: 'Example Impression Event', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + integrations: { + All: true, + koddi: { + eventType: 'Impressions', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(1), + }, + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + event: 'Example Clicks Event', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + integrations: { + All: true, + koddi: { + eventType: 'Clicks', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(2), + }, + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + event: 'Example Conversions Event', + properties: { + currency: 'USD', + transaction_id: 'ABC123', + bidders, + }, + context: { + locale: 'en-US', + ip: '127.0.0.1', + }, + integrations: { + All: true, + koddi: { + eventType: 'Conversions', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(3), + }, + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + event: 'Example Impression Event', + properties: { + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + integrations: { + All: true, + koddi: { + eventType: 'Impressions', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(4), + }, + { + destination, + message: { + type: 'track', + channel, + anonymousId: 'anonId123', + userId: 'userId123', + properties: { + tracking_data: 'dummy-tracking-data', + rank: 1, + beacon_issued: '2024-03-04T15:32:56.409Z', + }, + integrations: { + All: true, + koddi: { + eventType: 'Unknown', + }, + }, + originalTimestamp: '2024-03-04T15:32:56.409Z', + }, + metadata: generateMetadata(5), + }, + ], + destType, +}; + +export const data = [ + { + id: 'koddi-router-test', + name: destType, + description: 'Basic Router Test to test payloads and missing field error', + scenario: 'Framework', + successCriteria: + 'Some events should be transformed successfully and some should fail for missing fields and status code should be 200', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: routerRequest, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batched: false, + batchedRequest: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: destination.Config.apiBaseUrl + '?action=impression', + headers: getHeader, + params: { + trackingData: 'dummy-tracking-data', + rank: 1, + beaconIssued: '2024-03-04T15:32:56.409Z', + ts: '2024-03-04T15:32:56.409Z', + clientName: destination.Config.clientName, + }, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + destination, + metadata: [generateMetadata(1)], + statusCode: 200, + }, + { + batched: false, + batchedRequest: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: destination.Config.apiBaseUrl + '?action=click', + headers: getHeader, + params: { + trackingData: 'dummy-tracking-data', + rank: 1, + beaconIssued: '2024-03-04T15:32:56.409Z', + userGuid: 'userId123', + clientName: destination.Config.clientName, + }, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + destination, + metadata: [generateMetadata(2)], + statusCode: 200, + }, + { + batched: false, + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: destination.Config.apiBaseUrl + '/conversion', + headers: postHeader, + params: {}, + body: { + JSON: { + client_name: 'test-client', + culture: 'en-US', + currency: 'USD', + transaction_id: 'ABC123', + unixtime: 1709566376, + user_guid: 'userId123', + user_ip: '127.0.0.1', + bidders: bidders, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + destination, + metadata: [generateMetadata(3)], + statusCode: 200, + }, + { + batched: false, + error: 'Missing required value from "properties.tracking_data"', + destination, + metadata: [generateMetadata(4)], + statTags: RouterInstrumentationErrorStatTags, + statusCode: 400, + }, + { + batched: false, + error: 'event type unknown is not supported', + destination, + metadata: [generateMetadata(5)], + statTags: RouterInstrumentationErrorStatTags, + statusCode: 400, + }, + ], + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/mp/common.ts b/test/integrations/destinations/mp/common.ts index 82f0e3202b..d40afa0c02 100644 --- a/test/integrations/destinations/mp/common.ts +++ b/test/integrations/destinations/mp/common.ts @@ -7,7 +7,7 @@ const defaultMockFns = () => { const sampleDestination: Destination = { Config: { apiKey: 'dummyApiKey', - token: 'dummyApiKey', + token: 'test_api_token', prefixProperties: true, useNativeSDK: false, }, diff --git a/test/integrations/destinations/mp/processor/data.ts b/test/integrations/destinations/mp/processor/data.ts index 2d70d15384..db5bc840c2 100644 --- a/test/integrations/destinations/mp/processor/data.ts +++ b/test/integrations/destinations/mp/processor/data.ts @@ -12,7 +12,7 @@ export const data = [ request: { body: [ { - destination: overrideDestination(sampleDestination, { token: 'dummyApiKey' }), + destination: overrideDestination(sampleDestination, { token: 'test_api_token' }), message: { anonymousId: 'e6ab2c5e-2cda-44a9-a962-e2f67df78bca', channel: 'web', @@ -87,14 +87,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Loaded a Page","properties":{"ip":"0.0.0.0","campaign_id":"test_name","$user_id":"hjikl","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"dummyApiKey","distinct_id":"hjikl","time":1579847342402,"utm_campaign":"test_name","utm_source":"rudder","utm_medium":"test_medium","utm_term":"test_tem","utm_content":"test_content","utm_test":"test","utm_keyword":"test_keyword","name":"Contact Us","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"Loaded a Page","properties":{"ip":"0.0.0.0","campaign_id":"test_name","$user_id":"hjikl","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"test_api_token","distinct_id":"hjikl","time":1579847342402,"utm_campaign":"test_name","utm_source":"rudder","utm_medium":"test_medium","utm_term":"test_tem","utm_content":"test_content","utm_test":"test","utm_keyword":"test_keyword","name":"Contact Us","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -191,14 +194,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Viewed a Contact Us page","properties":{"ip":"0.0.0.0","$user_id":"hjikl","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"dummyApiKey","distinct_id":"hjikl","time":1579847342402,"name":"Contact Us","category":"Contact","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"Viewed a Contact Us page","properties":{"ip":"0.0.0.0","$user_id":"hjikl","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"test_api_token","distinct_id":"hjikl","time":1579847342402,"name":"Contact Us","category":"Contact","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -272,14 +278,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Loaded a Screen","properties":{"category":"communication","ip":"0.0.0.0","$user_id":"hjikl","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"dummyApiKey","distinct_id":"hjikl","time":1579847342402,"name":"Contact Us"}}]', + '[{"event":"Loaded a Screen","properties":{"category":"communication","ip":"0.0.0.0","$user_id":"hjikl","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"test_api_token","distinct_id":"hjikl","time":1579847342402,"name":"Contact Us"}}]', }, XML: {}, FORM: {}, @@ -360,14 +369,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Loaded a Screen","properties":{"path":"/tests/html/index2.html","referrer":"","search":"","title":"","url":"http://localhost/tests/html/index2.html","ip":"0.0.0.0","$user_id":"hjiklmk","$screen_dpi":2,"mp_lib":"RudderLabs Android SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"dummyApiKey","distinct_id":"hjiklmk","time":1579847342402,"name":"Contact Us","category":"Contact"}}]', + '[{"event":"Loaded a Screen","properties":{"path":"/tests/html/index2.html","referrer":"","search":"","title":"","url":"http://localhost/tests/html/index2.html","ip":"0.0.0.0","$user_id":"hjiklmk","$screen_dpi":2,"mp_lib":"RudderLabs Android SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"test_api_token","distinct_id":"hjiklmk","time":1579847342402,"name":"Contact Us","category":"Contact"}}]', }, XML: {}, FORM: {}, @@ -440,14 +452,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Loaded a Screen","properties":{"ip":"0.0.0.0","$user_id":"hjikl","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"dummyApiKey","distinct_id":"hjikl","time":1579847342402,"name":"Contact Us"}}]', + '[{"event":"Loaded a Screen","properties":{"ip":"0.0.0.0","$user_id":"hjikl","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"test_api_token","distinct_id":"hjikl","time":1579847342402,"name":"Contact Us"}}]', }, XML: {}, FORM: {}, @@ -550,7 +565,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -664,7 +679,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.403Z","$amount":45.89}},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', + '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.403Z","$amount":45.89}},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', }, XML: {}, FORM: {}, @@ -686,7 +701,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$add":{"counter":1,"item_purchased":"2"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', + '[{"$add":{"counter":1,"item_purchased":"2"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', }, XML: {}, FORM: {}, @@ -701,14 +716,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"test revenue MIXPANEL","properties":{"currency":"USD","revenue":45.89,"counter":1,"item_purchased":"2","number_of_logins":"","city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","campaign_id":"test_name","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"a6a0ad5a-bd26-4f19-8f75-38484e580fc7","token":"dummyApiKey","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342403,"utm_campaign":"test_name","utm_source":"rudder","utm_medium":"test_medium","utm_term":"test_tem","utm_content":"test_content","utm_test":"test","utm_keyword":"test_keyword","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"test revenue MIXPANEL","properties":{"currency":"USD","revenue":45.89,"counter":1,"item_purchased":"2","number_of_logins":"","city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","campaign_id":"test_name","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"a6a0ad5a-bd26-4f19-8f75-38484e580fc7","token":"test_api_token","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342403,"utm_campaign":"test_name","utm_source":"rudder","utm_medium":"test_medium","utm_term":"test_tem","utm_content":"test_content","utm_test":"test","utm_keyword":"test_keyword","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -796,14 +814,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"$create_alias","properties":{"distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","alias":"1234abc","token":"dummyApiKey"}}]', + '[{"event":"$create_alias","properties":{"distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","alias":"1234abc","token":"test_api_token"}}]', }, XML: {}, FORM: {}, @@ -933,7 +954,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.402Z","$amount":25}},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', + '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.402Z","$amount":25}},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', }, XML: {}, FORM: {}, @@ -948,14 +969,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"KM Order Completed","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"order_id":"50314b8e9bcf000000000000","products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"revenue":25,"shipping":3,"subtotal":22.5,"tax":2,"total":27.5,"city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"dummyApiKey","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"KM Order Completed","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"order_id":"50314b8e9bcf000000000000","products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"revenue":25,"shipping":3,"subtotal":22.5,"tax":2,"total":27.5,"city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"test_api_token","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -1089,7 +1113,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.402Z","$amount":34}},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', + '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.402Z","$amount":34}},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', }, XML: {}, FORM: {}, @@ -1104,14 +1128,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"KM Order Completed","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"order_id":"50314b8e9bcf000000000000","revenue":34,"key_1":{"child_key1":"child_value1","child_key2":{"child_key21":"child_value21","child_key22":"child_value22"}},"products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"shipping":3,"subtotal":22.5,"tax":2,"total":27.5,"city":"Disney","country":"USA","email":"mickey@disney.com","first_name":"Mickey","lastName":"Mouse","name":"Mickey Mouse","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"dummyApiKey","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"KM Order Completed","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"order_id":"50314b8e9bcf000000000000","revenue":34,"key_1":{"child_key1":"child_value1","child_key2":{"child_key21":"child_value21","child_key22":"child_value22"}},"products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"shipping":3,"subtotal":22.5,"tax":2,"total":27.5,"city":"Disney","country":"USA","email":"mickey@disney.com","first_name":"Mickey","lastName":"Mouse","name":"Mickey Mouse","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"test_api_token","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -1235,14 +1262,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":" new Order Completed totally","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"total":23,"order_id":"50314b8e9bcf000000000000","key_1":{"child_key1":"child_value1","child_key2":{"child_key21":"child_value21","child_key22":"child_value22"}},"products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"shipping":3,"subtotal":22.5,"tax":2,"city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"dummyApiKey","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":" new Order Completed totally","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"total":23,"order_id":"50314b8e9bcf000000000000","key_1":{"child_key1":"child_value1","child_key2":{"child_key21":"child_value21","child_key22":"child_value22"}},"products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"shipping":3,"subtotal":22.5,"tax":2,"city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"test_api_token","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -1366,14 +1396,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":" Order Completed ","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"total":23,"order_id":"50314b8e9bcf000000000000","key_1":{"child_key1":"child_value1","child_key2":{"child_key21":"child_value21","child_key22":"child_value22"}},"products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"shipping":3,"subtotal":22.5,"tax":2,"Billing Amount":"77","city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"dummyApiKey","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":" Order Completed ","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"total":23,"order_id":"50314b8e9bcf000000000000","key_1":{"child_key1":"child_value1","child_key2":{"child_key21":"child_value21","child_key22":"child_value22"}},"products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"shipping":3,"subtotal":22.5,"tax":2,"Billing Amount":"77","city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"test_api_token","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -1541,7 +1574,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -1628,7 +1661,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$distinct_id":"hjikl","$set":{"company":["testComp"]},"$ip":"0.0.0.0"}]', + '[{"$token":"test_api_token","$distinct_id":"hjikl","$set":{"company":["testComp"]},"$ip":"0.0.0.0"}]', }, XML: {}, FORM: {}, @@ -1650,7 +1683,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$group_key":"company","$group_id":"testComp","$set":{"company":"testComp"}}]', + '[{"$token":"test_api_token","$group_key":"company","$group_id":"testComp","$set":{"company":"testComp"}}]', }, XML: {}, FORM: {}, @@ -1737,7 +1770,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$distinct_id":"hjikl","$set":{"company":["testComp","testComp1"]},"$ip":"0.0.0.0"}]', + '[{"$token":"test_api_token","$distinct_id":"hjikl","$set":{"company":["testComp","testComp1"]},"$ip":"0.0.0.0"}]', }, XML: {}, FORM: {}, @@ -1759,7 +1792,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$group_key":"company","$group_id":"testComp","$set":{"company":["testComp","testComp1"]}}]', + '[{"$token":"test_api_token","$group_key":"company","$group_id":"testComp","$set":{"company":["testComp","testComp1"]}}]', }, XML: {}, FORM: {}, @@ -1781,7 +1814,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$group_key":"company","$group_id":"testComp1","$set":{"company":["testComp","testComp1"]}}]', + '[{"$token":"test_api_token","$group_key":"company","$group_id":"testComp1","$set":{"company":["testComp","testComp1"]}}]', }, XML: {}, FORM: {}, @@ -1869,7 +1902,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$distinct_id":"hjikl","$set":{"company":["testComp"]},"$ip":"0.0.0.0"}]', + '[{"$token":"test_api_token","$distinct_id":"hjikl","$set":{"company":["testComp"]},"$ip":"0.0.0.0"}]', }, XML: {}, FORM: {}, @@ -1891,7 +1924,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$group_key":"company","$group_id":"testComp","$set":{"company":"testComp"}}]', + '[{"$token":"test_api_token","$group_key":"company","$group_id":"testComp","$set":{"company":"testComp"}}]', }, XML: {}, FORM: {}, @@ -2019,7 +2052,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.402Z","$amount":25}},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', + '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.402Z","$amount":25}},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca"}]', }, XML: {}, FORM: {}, @@ -2034,14 +2067,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api-eu.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api-eu.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"KM Order Completed","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"order_id":"50314b8e9bcf000000000000","products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"revenue":25,"shipping":3,"subtotal":22.5,"tax":2,"total":27.5,"city":"Disney","country":"USA","email":"mickey@disney.com","firstname":"Mickey","lastname":"Mouse","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"dummyApiKey","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"KM Order Completed","properties":{"affiliation":"Google Store","checkout_id":"fksdjfsdjfisjf9sdfjsd9f","coupon":"hasbros","currency":"USD","discount":2.5,"order_id":"50314b8e9bcf000000000000","products":[{"category":"Games","image_url":"https:///www.example.com/product/path.jpg","name":"Monopoly: 3rd Edition","price":19,"product_id":"507f1f77bcf86cd799439011","quantity":1,"sku":"45790-32","url":"https://www.example.com/product/path"},{"category":"Games","name":"Uno Card Game","price":3,"product_id":"505bd76785ebb509fc183733","quantity":2,"sku":"46493-32"}],"revenue":25,"shipping":3,"subtotal":22.5,"tax":2,"total":27.5,"city":"Disney","country":"USA","email":"mickey@disney.com","firstname":"Mickey","lastname":"Mouse","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a","token":"test_api_token","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -2129,7 +2165,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","$android_devices":["test_device_token"],"$os":"Android","$android_model":"Android SDK built for x86","$android_os_version":"8.1.0","$android_manufacturer":"Google","$android_app_version":"1.0","$android_app_version_code":"1.0","$android_brand":"Google"},"$token":"dummyApiKey","$distinct_id":"5094f5704b9cf2b3","$time":1584003903421}]', + '[{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","$android_devices":["test_device_token"],"$os":"Android","$android_model":"Android SDK built for x86","$android_os_version":"8.1.0","$android_manufacturer":"Google","$android_app_version":"1.0","$android_app_version_code":"1.0","$android_brand":"Google"},"$token":"test_api_token","$distinct_id":"5094f5704b9cf2b3","$time":1584003903421}]', }, XML: {}, FORM: {}, @@ -2216,7 +2252,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","$ios_devices":["test_device_token"],"$os":"iOS","$ios_device_model":"Android SDK built for x86","$ios_version":"8.1.0","$ios_app_release":"1","$ios_app_version":"1.0"},"$token":"dummyApiKey","$distinct_id":"test_user_id","$time":1584003903421}]', + '[{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","$ios_devices":["test_device_token"],"$os":"iOS","$ios_device_model":"Android SDK built for x86","$ios_version":"8.1.0","$ios_app_release":"1","$ios_app_version":"1.0"},"$token":"test_api_token","$distinct_id":"test_user_id","$time":1584003903421}]', }, XML: {}, FORM: {}, @@ -2233,7 +2269,7 @@ export const data = [ method: 'POST', endpoint: 'https://api-eu.mixpanel.com/import/', headers: { - Authorization: 'Basic c29tZV9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', 'Content-Type': 'application/json', }, params: { strict: 0 }, @@ -2241,7 +2277,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"event":"$merge","properties":{"$distinct_ids":["test_user_id","5094f5704b9cf2b3"],"token":"dummyApiKey"}}]', + '[{"event":"$merge","properties":{"$distinct_ids":["test_user_id","5094f5704b9cf2b3"],"token":"test_api_token"}}]', }, XML: {}, FORM: {}, @@ -2328,14 +2364,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Loaded a Page","properties":{"path":"/tests/html/index2.html","referrer":"","search":"","title":"","url":"http://localhost/tests/html/index2.html","category":"communication","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"dummyApiKey","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"name":"Contact Us","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"Loaded a Page","properties":{"path":"/tests/html/index2.html","referrer":"","search":"","title":"","url":"http://localhost/tests/html/index2.html","category":"communication","ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"test_api_token","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1579847342402,"name":"Contact Us","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -2423,14 +2462,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"$create_alias","properties":{"distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","alias":"1234abc","token":"dummyApiKey"}}]', + '[{"event":"$create_alias","properties":{"distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","alias":"1234abc","token":"test_api_token"}}]', }, XML: {}, FORM: {}, @@ -2523,7 +2565,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","createdat":"2020-01-23T08:54:02.362Z","$ios_devices":["test_device_token"],"$ios_device_model":"Android SDK built for x86","$ios_app_release":"1","$ios_app_version":"1.0"},"$token":"dummyApiKey","$distinct_id":"test_user_id","$time":1584003903421}]', + '[{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","createdat":"2020-01-23T08:54:02.362Z","$ios_devices":["test_device_token"],"$ios_device_model":"Android SDK built for x86","$ios_app_release":"1","$ios_app_version":"1.0"},"$token":"test_api_token","$distinct_id":"test_user_id","$time":1584003903421}]', }, XML: {}, FORM: {}, @@ -2540,7 +2582,7 @@ export const data = [ method: 'POST', endpoint: 'https://api-eu.mixpanel.com/import/', headers: { - Authorization: 'Basic c29tZV9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', 'Content-Type': 'application/json', }, params: { strict: 0 }, @@ -2548,7 +2590,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"event":"$merge","properties":{"$distinct_ids":["test_user_id","5094f5704b9cf2b3"],"token":"dummyApiKey"}}]', + '[{"event":"$merge","properties":{"$distinct_ids":["test_user_id","5094f5704b9cf2b3"],"token":"test_api_token"}}]', }, XML: {}, FORM: {}, @@ -2641,7 +2683,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -2733,7 +2775,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -2826,7 +2868,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$name":"Mickey Mouse","$country_code":"USA","$city":"Disney","$region":"US","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$name":"Mickey Mouse","$country_code":"USA","$city":"Disney","$region":"US","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -2924,7 +2966,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -3020,7 +3062,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -3115,7 +3157,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -3209,7 +3251,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$first_name":"Mickey","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$first_name":"Mickey","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -3304,7 +3346,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$name":"Mickey Mouse","$country_code":"USA","$city":"Disney","$region":"US","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$name":"Mickey Mouse","$country_code":"USA","$city":"Disney","$region":"US","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -3405,7 +3447,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -3502,17 +3544,29 @@ export const data = [ status: 200, body: [ { - error: - 'Event timestamp is older than 5 days and no API secret or service account credentials (i.e. username, secret and projectId) are provided in destination configuration', - statTags: { - destType: 'MP', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - feature: 'processor', - implementation: 'native', - module: 'destination', + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"event":"FirstTrackCall12","properties":{"foo":"bar","$deviceId":"nkasdnkasd","anonymousId":"ea776ad0-3136-44fb-9216-5b1578609a2b","userId":"as09sufa09usaf09as0f9uasf","id":"as09sufa09usaf09as0f9uasf","firstName":"Bob","lastName":"Marley","name":"Bob Marley","age":43,"email":"bob@marleymail.com","phone":"+447748544123","birthday":"1987-01-01T20:08:59+0000","createdAt":"2022-01-21T14:10:12+0000","address":"51,B.L.T road, Kolkata-700060","description":"I am great","gender":"male","title":"Founder","username":"bobm","website":"https://bobm.com","randomProperty":"randomValue","$user_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$current_url":"http://127.0.0.1:7307/Testing/App_for_testingTool/","$referrer":"http://127.0.0.1:7307/Testing/","$screen_height":900,"$screen_width":1440,"$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.1.18","$insert_id":"0d5c1a4a-27e4-41da-a246-4d01f44e74bd","token":"test_api_token","distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","time":1632986123523,"$browser":"Chrome","$browser_version":"93.0.4577.82"}}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + userId: 'e6ab2c5e-2cda-44a9-a962-e2f67df78bca', }, - statusCode: 400, + statusCode: 200, }, ], }, @@ -3686,7 +3740,7 @@ export const data = [ method: 'POST', endpoint: 'https://api-eu.mixpanel.com/import/', headers: { - Authorization: 'Basic c29tZV9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', 'Content-Type': 'application/json', }, params: { strict: 0 }, @@ -3694,7 +3748,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"event":"MainActivity","properties":{"name":"MainActivity","automatic":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","$user_id":"test_user_id","$os":"iOS","$screen_height":1794,"$screen_width":1080,"$screen_dpi":420,"$carrier":"Android","$os_version":"8.1.0","$device":"generic_x86","$manufacturer":"Google","$model":"Android SDK built for x86","mp_device_model":"Android SDK built for x86","$wifi":true,"$bluetooth_enabled":false,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"1","$app_version_string":"1.0","$insert_id":"id2","token":"dummyApiKey","distinct_id":"test_user_id","time":1520845503421}}]', + '[{"event":"MainActivity","properties":{"name":"MainActivity","automatic":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","$user_id":"test_user_id","$os":"iOS","$screen_height":1794,"$screen_width":1080,"$screen_dpi":420,"$carrier":"Android","$os_version":"8.1.0","$device":"generic_x86","$manufacturer":"Google","$model":"Android SDK built for x86","mp_device_model":"Android SDK built for x86","$wifi":true,"$bluetooth_enabled":false,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"1","$app_version_string":"1.0","$insert_id":"id2","token":"test_api_token","distinct_id":"test_user_id","time":1520845503421}}]', }, XML: {}, FORM: {}, @@ -3965,7 +4019,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402,"$ignore_time":true}]', + '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402,"$ignore_time":true}]', }, XML: {}, FORM: {}, @@ -4071,7 +4125,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -4276,7 +4330,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"user1234","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$first_name":"Mickey","$last_name":"Mouse","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"user1234","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -4294,18 +4348,14 @@ export const data = [ endpoint: 'https://api.mixpanel.com/import/', headers: { 'Content-Type': 'application/json', - Authorization: - 'Basic cnVkZGVyLmQyYTNmMS5tcC1zZXJ2aWNlLWFjY291bnQ6amF0cFF4Y2pNaDhlZXRrMXhySDNLalFJYnp5NGlYOGI=', - }, - params: { - project_id: '123456', - strict: 0, + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"$merge","properties":{"$distinct_ids":["user1234","e6ab2c5e-2cda-44a9-a962-e2f67df78bca"],"token":"dummyApiKey"}}]', + '[{"event":"$merge","properties":{"$distinct_ids":["user1234","e6ab2c5e-2cda-44a9-a962-e2f67df78bca"],"token":"test_api_token"}}]', }, XML: {}, FORM: {}, @@ -4390,7 +4440,7 @@ export const data = [ method: 'POST', endpoint: 'https://api.mixpanel.com/import/', headers: { - Authorization: 'Basic ZHVtbXlBcGlLZXk6', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', 'Content-Type': 'application/json', }, params: { strict: 0 }, @@ -4398,7 +4448,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Application Installed","properties":{"build":4,"version":"1.0","anonymousId":"39da706ec83d0e90","$os":"Android","$screen_height":2984,"$screen_width":1440,"$screen_dpi":560,"$carrier":"T-Mobile","$os_version":"12","$device":"emu64a","$manufacturer":"Google","$model":"sdk_gphone64_arm64","mp_device_model":"sdk_gphone64_arm64","$wifi":true,"$bluetooth_enabled":true,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"4","$app_version_string":"1.0","$insert_id":"168cf720-6227-4b56-a98e-c49bdc7279e9","$session_id":"1662363980","token":"dummyApiKey","distinct_id":"39da706ec83d0e90","time":1662363980290}}]', + '[{"event":"Application Installed","properties":{"build":4,"version":"1.0","anonymousId":"39da706ec83d0e90","$os":"Android","$screen_height":2984,"$screen_width":1440,"$screen_dpi":560,"$carrier":"T-Mobile","$os_version":"12","$device":"emu64a","$manufacturer":"Google","$model":"sdk_gphone64_arm64","mp_device_model":"sdk_gphone64_arm64","$wifi":true,"$bluetooth_enabled":true,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"4","$app_version_string":"1.0","$insert_id":"168cf720-6227-4b56-a98e-c49bdc7279e9","$session_id":"1662363980","token":"test_api_token","distinct_id":"39da706ec83d0e90","time":1662363980290}}]', }, XML: {}, FORM: {}, @@ -4480,7 +4530,7 @@ export const data = [ method: 'POST', endpoint: 'https://api.mixpanel.com/import/', headers: { - Authorization: 'Basic ZHVtbXlBcGlLZXk6', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', 'Content-Type': 'application/json', }, params: { strict: 0 }, @@ -4488,7 +4538,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Application Opened","properties":{"build":4,"version":"1.0","anonymousId":"39da706ec83d0e90","$os":"Android","$screen_height":2984,"$screen_width":1440,"$screen_dpi":560,"$carrier":"T-Mobile","$os_version":"12","$device":"emu64a","$manufacturer":"Google","$model":"sdk_gphone64_arm64","mp_device_model":"sdk_gphone64_arm64","$wifi":true,"$bluetooth_enabled":true,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"4","$app_version_string":"1.0","$insert_id":"168cf720-6227-4b56-a98e-c49bdc7279e9","$session_id":"1662363980","token":"dummyApiKey","distinct_id":"39da706ec83d0e90","time":1662363980290}}]', + '[{"event":"Application Opened","properties":{"build":4,"version":"1.0","anonymousId":"39da706ec83d0e90","$os":"Android","$screen_height":2984,"$screen_width":1440,"$screen_dpi":560,"$carrier":"T-Mobile","$os_version":"12","$device":"emu64a","$manufacturer":"Google","$model":"sdk_gphone64_arm64","mp_device_model":"sdk_gphone64_arm64","$wifi":true,"$bluetooth_enabled":true,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"4","$app_version_string":"1.0","$insert_id":"168cf720-6227-4b56-a98e-c49bdc7279e9","$session_id":"1662363980","token":"test_api_token","distinct_id":"39da706ec83d0e90","time":1662363980290}}]', }, XML: {}, FORM: {}, @@ -4576,7 +4626,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$distinct_id":"hjikl","$set":{"groupId":["testGroupId"]},"$ip":"0.0.0.0"}]', + '[{"$token":"test_api_token","$distinct_id":"hjikl","$set":{"groupId":["testGroupId"]},"$ip":"0.0.0.0"}]', }, XML: {}, FORM: {}, @@ -4598,7 +4648,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$group_key":"groupId","$group_id":"testGroupId","$set":{"company":"testComp","groupId":"groupIdInTraits"}}]', + '[{"$token":"test_api_token","$group_key":"groupId","$group_id":"testGroupId","$set":{"company":"testComp","groupId":"groupIdInTraits"}}]', }, XML: {}, FORM: {}, @@ -4625,7 +4675,7 @@ export const data = [ description: 'Track: set device id and user id when simplified id merge api is selected', destination: overrideDestination(sampleDestination, { - token: 'dummyApiKey', + token: 'test_api_token', identityMergeApi: 'simplified', }), message: { @@ -4681,14 +4731,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Product Viewed","properties":{"name":"T-Shirt","$user_id":"userId01","$os":"iOS","$screen_height":1794,"$screen_width":1080,"$screen_dpi":420,"$carrier":"Android","$os_version":"8.1.0","$device":"generic_x86","$manufacturer":"Google","$model":"Android SDK built for x86","mp_device_model":"Android SDK built for x86","$wifi":true,"$bluetooth_enabled":false,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"1","$app_version_string":"1.0","$insert_id":"id2","token":"dummyApiKey","distinct_id":"userId01","time":1579847342402,"$device_id":"anonId01"}}]', + '[{"event":"Product Viewed","properties":{"name":"T-Shirt","$user_id":"userId01","$os":"iOS","$screen_height":1794,"$screen_width":1080,"$screen_dpi":420,"$carrier":"Android","$os_version":"8.1.0","$device":"generic_x86","$manufacturer":"Google","$model":"Android SDK built for x86","mp_device_model":"Android SDK built for x86","$wifi":true,"$bluetooth_enabled":false,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"1","$app_version_string":"1.0","$insert_id":"id2","token":"test_api_token","distinct_id":"userId01","time":1579847342402,"$device_id":"anonId01"}}]', }, XML: {}, FORM: {}, @@ -4717,7 +4770,7 @@ export const data = [ { description: 'Identify: skip merge event when simplified id merge api is selected', destination: overrideDestination(sampleDestination, { - token: 'dummyApiKey', + token: 'test_api_token', identityMergeApi: 'simplified', }), message: { @@ -4798,7 +4851,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"userId01","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"userId01","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -4826,7 +4879,7 @@ export const data = [ 'Identify: append $device: to deviceId while creating the user when simplified id merge api is selected', destination: overrideDestination(sampleDestination, { apiKey: 'apiKey123', - token: 'dummyApiKey', + token: 'test_api_token', identityMergeApi: 'simplified', }), message: { @@ -4906,7 +4959,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyApiKey","$distinct_id":"$device:anonId01","$ip":"0.0.0.0","$time":1579847342402}]', + '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"$device:anonId01","$ip":"0.0.0.0","$time":1579847342402}]', }, XML: {}, FORM: {}, @@ -4933,7 +4986,7 @@ export const data = [ description: 'Unsupported alias call when simplified id merge api is selected', destination: overrideDestination(sampleDestination, { apiKey: 'apiKey123', - token: 'dummyApiKey', + token: 'test_api_token', identityMergeApi: 'simplified', }), message: { @@ -5022,7 +5075,7 @@ export const data = [ 'Track revenue event: set device id and user id when simplified id merge api is selected', destination: overrideDestination(sampleDestination, { apiKey: 'apiKey123', - token: 'dummyApiKey', + token: 'test_api_token', identityMergeApi: 'simplified', }), message: { @@ -5093,7 +5146,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.403Z","$amount":18.9}},"$token":"dummyApiKey","$distinct_id":"userId01"}]', + '[{"$append":{"$transactions":{"$time":"2020-01-24T06:29:02.403Z","$amount":18.9}},"$token":"test_api_token","$distinct_id":"userId01"}]', }, XML: {}, FORM: {}, @@ -5108,14 +5161,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"test revenue MIXPANEL","properties":{"currency":"USD","revenue":18.9,"city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","$user_id":"userId01","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"a6a0ad5a-bd26-4f19-8f75-38484e580fc7","token":"dummyApiKey","distinct_id":"userId01","time":1579847342403,"$device_id":"anonId01","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"test revenue MIXPANEL","properties":{"currency":"USD","revenue":18.9,"city":"Disney","country":"USA","email":"mickey@disney.com","firstName":"Mickey","ip":"0.0.0.0","$user_id":"userId01","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"a6a0ad5a-bd26-4f19-8f75-38484e580fc7","token":"test_api_token","distinct_id":"userId01","time":1579847342403,"$device_id":"anonId01","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -5145,7 +5201,7 @@ export const data = [ description: 'Page with anonymous user when simplified api is selected', destination: overrideDestination(sampleDestination, { apiKey: 'apiKey123', - token: 'dummyApiKey', + token: 'test_api_token', identityMergeApi: 'simplified', }), message: { @@ -5212,14 +5268,17 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://api.mixpanel.com/track/', - headers: {}, - params: {}, + endpoint: 'https://api.mixpanel.com/import/', + headers: { + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', + 'Content-Type': 'application/json', + }, + params: { strict: 0 }, body: { JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Loaded a Page","properties":{"ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"dummyApiKey","distinct_id":"$device:anonId01","time":1579847342402,"$device_id":"anonId01","name":"Contact Us","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + '[{"event":"Loaded a Page","properties":{"ip":"0.0.0.0","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"test_api_token","distinct_id":"$device:anonId01","time":1579847342402,"$device_id":"anonId01","name":"Contact Us","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', }, XML: {}, FORM: {}, @@ -5249,7 +5308,7 @@ export const data = [ description: 'Group call with anonymous user when simplified api is selected', destination: overrideDestination(sampleDestination, { apiKey: 'apiKey123', - token: 'dummyApiKey', + token: 'test_api_token', identityMergeApi: 'simplified', groupKeySettings: [{ groupKey: 'company' }], }), @@ -5312,7 +5371,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$distinct_id":"$device:anonId01","$set":{"company":["testComp"]},"$ip":"0.0.0.0"}]', + '[{"$token":"test_api_token","$distinct_id":"$device:anonId01","$set":{"company":["testComp"]},"$ip":"0.0.0.0"}]', }, XML: {}, FORM: {}, @@ -5334,7 +5393,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$token":"dummyApiKey","$group_key":"company","$group_id":"testComp","$set":{"company":"testComp"}}]', + '[{"$token":"test_api_token","$group_key":"company","$group_id":"testComp","$set":{"company":"testComp"}}]', }, XML: {}, FORM: {}, @@ -5360,7 +5419,7 @@ export const data = [ { destination: overrideDestination(sampleDestination, { apiKey: 'apiKey123', - token: 'dummyApiKey', + token: 'test_api_token', identityMergeApi: 'simplified', groupKeySettings: [{ groupKey: 'company' }], }), @@ -5479,7 +5538,7 @@ export const data = [ }, destination: overrideDestination(sampleDestination, { apiKey: 'dummyApiKey', - token: 'dummyApiKey', + token: 'test_api_token', apiSecret: 'dummyApiKey', useNewMapping: true, }), @@ -5505,7 +5564,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$append":{"$transactions":{"$time":"2022-09-05T07:46:20.290Z","$amount":12.13}},"$token":"dummyApiKey","$distinct_id":"39da706ec83d0e90"}]', + '[{"$append":{"$transactions":{"$time":"2022-09-05T07:46:20.290Z","$amount":12.13}},"$token":"test_api_token","$distinct_id":"39da706ec83d0e90"}]', }, XML: {}, FORM: {}, @@ -5522,7 +5581,7 @@ export const data = [ method: 'POST', endpoint: 'https://api.mixpanel.com/import/', headers: { - Authorization: 'Basic ZHVtbXlBcGlLZXk6', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', 'Content-Type': 'application/json', }, params: { strict: 0 }, @@ -5530,7 +5589,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Application Installed","properties":{"build":4,"version":"1.0","revenue":12.13,"anonymousId":"39da706ec83d0e90","$os":"Android","$screen_height":2984,"$screen_width":1440,"$screen_dpi":560,"$carrier":"T-Mobile","$os_version":"12","$device":"emu64a","$manufacturer":"Google","$model":"sdk_gphone64_arm64","mp_device_model":"sdk_gphone64_arm64","$wifi":true,"$bluetooth_enabled":true,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"4","$app_version_string":"1.0","$insert_id":"168cf720-6227-4b56-a98e-c49bdc7279e9","$session_id":"1662363980","token":"dummyApiKey","distinct_id":"39da706ec83d0e90","time":1662363980290}}]', + '[{"event":"Application Installed","properties":{"build":4,"version":"1.0","revenue":12.13,"anonymousId":"39da706ec83d0e90","$os":"Android","$screen_height":2984,"$screen_width":1440,"$screen_dpi":560,"$carrier":"T-Mobile","$os_version":"12","$device":"emu64a","$manufacturer":"Google","$model":"sdk_gphone64_arm64","mp_device_model":"sdk_gphone64_arm64","$wifi":true,"$bluetooth_enabled":true,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"4","$app_version_string":"1.0","$insert_id":"168cf720-6227-4b56-a98e-c49bdc7279e9","$session_id":"1662363980","token":"test_api_token","distinct_id":"39da706ec83d0e90","time":1662363980290}}]', }, XML: {}, FORM: {}, @@ -5594,7 +5653,7 @@ export const data = [ }, destination: overrideDestination(sampleDestination, { apiKey: 'dummyApiKey', - token: 'dummyApiKey', + token: 'test_api_token', apiSecret: 'dummyApiKey', useNewMapping: true, }), @@ -5620,7 +5679,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$append":{"$transactions":{"$time":"2022-09-05T07:46:20.290Z","$amount":23.45}},"$token":"dummyApiKey","$distinct_id":"39da706ec83d0e90"}]', + '[{"$append":{"$transactions":{"$time":"2022-09-05T07:46:20.290Z","$amount":23.45}},"$token":"test_api_token","$distinct_id":"39da706ec83d0e90"}]', }, XML: {}, FORM: {}, @@ -5637,7 +5696,7 @@ export const data = [ method: 'POST', endpoint: 'https://api.mixpanel.com/import/', headers: { - Authorization: 'Basic ZHVtbXlBcGlLZXk6', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', 'Content-Type': 'application/json', }, params: { strict: 0 }, @@ -5645,7 +5704,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"event":"Application Installed","properties":{"build":4,"version":"1.0","revenue":23.45,"anonymousId":"39da706ec83d0e90","$os":"Android","$screen_height":2984,"$screen_width":1440,"$screen_dpi":560,"$carrier":"T-Mobile","$os_version":"12","$device":"emu64a","$manufacturer":"Google","$model":"sdk_gphone64_arm64","mp_device_model":"sdk_gphone64_arm64","$wifi":true,"$bluetooth_enabled":true,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"4","$app_version_string":"1.0","$insert_id":"168cf720-6227-4b56-a98e-c49bdc7279e9","$session_id":"1662363980","token":"dummyApiKey","distinct_id":"39da706ec83d0e90","time":null}}]', + '[{"event":"Application Installed","properties":{"build":4,"version":"1.0","revenue":23.45,"anonymousId":"39da706ec83d0e90","$os":"Android","$screen_height":2984,"$screen_width":1440,"$screen_dpi":560,"$carrier":"T-Mobile","$os_version":"12","$device":"emu64a","$manufacturer":"Google","$model":"sdk_gphone64_arm64","mp_device_model":"sdk_gphone64_arm64","$wifi":true,"$bluetooth_enabled":true,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"4","$app_version_string":"1.0","$insert_id":"168cf720-6227-4b56-a98e-c49bdc7279e9","$session_id":"1662363980","token":"test_api_token","distinct_id":"39da706ec83d0e90","time":null}}]', }, XML: {}, FORM: {}, @@ -5672,7 +5731,7 @@ export const data = [ description: 'Track: with strict mode enabled', destination: overrideDestination(sampleDestination, { apiKey: 'dummyApiKey', - token: 'dummyApiKey', + token: 'test_api_token', apiSecret: 'some_api_secret', dataResidency: 'eu', strictMode: true, @@ -5736,7 +5795,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","$ios_devices":["test_device_token"],"$os":"iOS","$ios_device_model":"Android SDK built for x86","$ios_version":"8.1.0","$ios_app_release":"1","$ios_app_version":"1.0"},"$token":"dummyApiKey","$distinct_id":"test_user_id","$time":1584003903421}]', + '[{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","$ios_devices":["test_device_token"],"$os":"iOS","$ios_device_model":"Android SDK built for x86","$ios_version":"8.1.0","$ios_app_release":"1","$ios_app_version":"1.0"},"$token":"test_api_token","$distinct_id":"test_user_id","$time":1584003903421}]', }, XML: {}, FORM: {}, @@ -5753,7 +5812,7 @@ export const data = [ method: 'POST', endpoint: 'https://api-eu.mixpanel.com/import/', headers: { - Authorization: 'Basic c29tZV9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', 'Content-Type': 'application/json', }, params: { strict: 1 }, @@ -5761,7 +5820,7 @@ export const data = [ JSON: {}, JSON_ARRAY: { batch: - '[{"event":"$merge","properties":{"$distinct_ids":["test_user_id","5094f5704b9cf2b3"],"token":"dummyApiKey"}}]', + '[{"event":"$merge","properties":{"$distinct_ids":["test_user_id","5094f5704b9cf2b3"],"token":"test_api_token"}}]', }, XML: {}, FORM: {}, diff --git a/test/integrations/destinations/mp/router/data.ts b/test/integrations/destinations/mp/router/data.ts index 059e222e92..8716c9daa0 100644 --- a/test/integrations/destinations/mp/router/data.ts +++ b/test/integrations/destinations/mp/router/data.ts @@ -442,7 +442,7 @@ export const data = [ endpoint: 'https://api.mixpanel.com/import/', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', }, params: { strict: 1 }, body: { @@ -509,7 +509,7 @@ export const data = [ endpoint: 'https://api.mixpanel.com/import/', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', }, params: { strict: 1 }, body: { @@ -577,7 +577,7 @@ export const data = [ endpoint: 'https://api.mixpanel.com/import/', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', }, params: { strict: 1 }, body: { @@ -1166,7 +1166,7 @@ export const data = [ endpoint: 'https://api.mixpanel.com/import/', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', }, params: { strict: 1 }, body: { @@ -1232,7 +1232,7 @@ export const data = [ endpoint: 'https://api.mixpanel.com/import/', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', }, params: { strict: 1 }, body: { @@ -1299,7 +1299,7 @@ export const data = [ endpoint: 'https://api.mixpanel.com/import/', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + Authorization: 'Basic dGVzdF9hcGlfdG9rZW46', }, params: { strict: 1 }, body: { diff --git a/test/integrations/destinations/pinterest_tag/processor/data.ts b/test/integrations/destinations/pinterest_tag/processor/data.ts index 65b33e7740..48b624645f 100644 --- a/test/integrations/destinations/pinterest_tag/processor/data.ts +++ b/test/integrations/destinations/pinterest_tag/processor/data.ts @@ -19,8 +19,8 @@ export const data = [ userAgent: 'chrome', traits: { anonymousId: '50be5c78-6c3f-4b60-be84-97805a316fb1', - email: 'abc@gmail.com', - phone: '+1234589947', + email: ' abc@gmail.com', + phone: '+1234589947 ', gender: 'non-binary', db: '19950715', lastname: 'Rudderlabs', diff --git a/test/integrations/destinations/reddit/processor/data.ts b/test/integrations/destinations/reddit/processor/data.ts index a97ae23d2a..e7b36f56ff 100644 --- a/test/integrations/destinations/reddit/processor/data.ts +++ b/test/integrations/destinations/reddit/processor/data.ts @@ -12,13 +12,13 @@ export const data = [ message: { context: { traits: { - email: 'testone@gmail.com', + email: 'testone@gmail.com ', }, 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', - ip: '54.100.200.255', + ip: ' 54.100.200.255', device: { - advertisingId: 'asfds7fdsihf734b34j43f', + advertisingId: ' asfds7fdsihf734b34j43f', }, os: { name: 'android', @@ -29,7 +29,7 @@ export const data = [ originalTimestamp: '2019-10-14T09:03:17.562Z', anonymousId: '123456', event: 'Order Completed', - userId: 'testuserId1', + userId: ' testuserId1', properties: { checkout_id: '12345', order_id: '1234', diff --git a/test/integrations/destinations/redis/processor/data.ts b/test/integrations/destinations/redis/processor/data.ts index 72c78a1ad4..999a954b59 100644 --- a/test/integrations/destinations/redis/processor/data.ts +++ b/test/integrations/destinations/redis/processor/data.ts @@ -1,3 +1,207 @@ +import { RedisTc, SupportedEventTypes, TraitsLocation } from '../types'; + +const getRedisTestCase = (tc: RedisTc) => { + const context = { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.5', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.5', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', + }; + return { + name: 'redis', + description: tc.description, + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + metadata: { + workspaceId: tc.workspaceId || 'wspId', + }, + destination: { + Config: { + address: 'localhost:6379', + database: 'test', + prefix: ' ', + ...tc.destinationConfig, + }, + DestinationDefinition: { + DisplayName: 'Redis', + ID: '1WhbSZ6uA3H5ChVifHpfL2H6sie', + Name: 'REDIS', + }, + Enabled: true, + ID: tc.destId || '1WhcOCGgj9asZu850HvugU2C3Aq', + Name: 'Redis', + + Transformations: [], + }, + message: { + anonymousId: 'e6ab2c5e-2cda-44a9-a962-e2f67df78bca', + channel: 'web', + ...(tc.traitsLocation === TraitsLocation.Traits ? { traits: tc.traits } : {}), + context: { + ...context, + ...(tc.traitsLocation === TraitsLocation.ContextTraits + ? { traits: tc.traits } + : {}), + ...(tc.profilesContext ?? {}), + }, + integrations: { + All: true, + }, + messageId: '2536eda4-d638-4c93-8014-8ffe3f083214', + originalTimestamp: '2020-01-24T06:29:02.362Z', + receivedAt: '2020-01-24T11:59:02.403+05:30', + request_ip: '[::1]:53708', + sentAt: '2020-01-24T06:29:02.363Z', + timestamp: '2020-01-24T11:59:02.402+05:30', + type: tc.eventType, + userId: tc.userId || 'myUserId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + workspaceId: tc.workspaceId || 'wspId', + }, + output: tc.expectedResponse, + statusCode: tc.expectedStatusCode, + }, + ], + }, + }, + }; +}; + +const jsonTestCases: RedisTc[] = [ + { + description: + 'Test 6: [Event-stream] when useJSONModule is enabled with traits in context.traits, should transform successfully', + destinationConfig: { + useJSONModule: true, + }, + traitsLocation: TraitsLocation.ContextTraits, + traits: { + prop1: 'k', + prop2: 2, + prop3: { + p4: 'a', + }, + }, + eventType: SupportedEventTypes.Identify, + userId: 'user-1', + expectedResponse: { + message: { + key: 'user:user-1', + value: { + prop1: 'k', + prop2: 2, + prop3: { + p4: 'a', + }, + }, + }, + userId: 'user-1', + }, + expectedStatusCode: 200, + }, + { + description: + 'Test 7: [Event-stream] when useJSONModule is enabled with traits in traits, should transform successfully', + destinationConfig: { + useJSONModule: true, + }, + traitsLocation: TraitsLocation.Traits, + traits: { + prop1: 'k', + prop2: 2, + prop3: { + p4: 'a', + }, + }, + eventType: SupportedEventTypes.Identify, + userId: 'user-1', + expectedResponse: { + message: { + key: 'user:user-1', + value: { + prop1: 'k', + prop2: 2, + prop3: { + p4: 'a', + }, + }, + }, + userId: 'user-1', + }, + expectedStatusCode: 200, + }, + { + description: + 'Test 8: [Profiles] when useJSONModule is enabled with traits in traits, should transform successfully', + destinationConfig: { + useJSONModule: true, + }, + destId: 'd1', + workspaceId: 'w1', + traitsLocation: TraitsLocation.Traits, + traits: { + field: 'k', + model_name: 'analytics_app', + }, + profilesContext: { + sources: { + profiles_entity: 'e1', + profiles_model: 'model1', + profiles_id_type: 'id-1', + }, + }, + eventType: SupportedEventTypes.Identify, + userId: 'user-2', + expectedResponse: { + message: { + key: 'w1:d1:e1:id-1:user-2', + path: 'model1', + value: { + field: 'k', + model_name: 'analytics_app', + }, + }, + userId: 'user-2', + }, + expectedStatusCode: 200, + }, +]; + +const jsonTcs = jsonTestCases.map((tc) => getRedisTestCase(tc)); + export const data = [ { name: 'redis', @@ -658,4 +862,5 @@ export const data = [ }, }, }, + ...jsonTcs, ]; diff --git a/test/integrations/destinations/redis/types.ts b/test/integrations/destinations/redis/types.ts new file mode 100644 index 0000000000..f4970b3afa --- /dev/null +++ b/test/integrations/destinations/redis/types.ts @@ -0,0 +1,39 @@ +export type RedisConfig = Partial<{ + address: string; + database: string; + prefix: string; + useJSONModule: boolean; +}>; + +type RedisJSONOutput = { + message: Record; + userId: string; +}; + +export enum TraitsLocation { + ContextTraits = 'context.traits', + Traits = 'traits', +} +export enum SupportedEventTypes { + Identify = 'identify', +} + +export type RedisTc = { + description: string; + destId?: string; + workspaceId?: string; + destinationConfig: RedisConfig; + traitsLocation: TraitsLocation; + traits: Record; + eventType: SupportedEventTypes; + userId?: string; + expectedResponse: RedisJSONOutput; + expectedStatusCode: number; + profilesContext?: { + sources: { + profiles_entity: string; + profiles_id_type: string; + profiles_model: string; + }; + }; +}; diff --git a/test/integrations/destinations/tiktok_ads/processor/data.ts b/test/integrations/destinations/tiktok_ads/processor/data.ts index 429024b8a9..af58b66302 100644 --- a/test/integrations/destinations/tiktok_ads/processor/data.ts +++ b/test/integrations/destinations/tiktok_ads/processor/data.ts @@ -5224,7 +5224,6 @@ export const data = [ event_id: '1616318632825_357', event_time: 1600372167, properties: { - content_type: 'product', contents: [ { price: 8, @@ -6872,7 +6871,7 @@ export const data = [ }, { name: 'tiktok_ads', - description: 'Test 46 -> V2 -> Event with no properties', + description: 'Test 46 -> V2 -> Custom Event with no properties', feature: 'processor', module: 'destination', version: 'v0', @@ -6947,7 +6946,6 @@ export const data = [ event: 'customEvent', event_id: '84e26acc-56a5-4835-8233-591137fca468', event_time: 1600372167, - properties: { content_type: 'product' }, user: { locale: 'en-US', email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', diff --git a/test/integrations/destinations/yahoo_dsp/processor/data.ts b/test/integrations/destinations/yahoo_dsp/processor/data.ts index eb607d60fb..3d04f9aa5c 100644 --- a/test/integrations/destinations/yahoo_dsp/processor/data.ts +++ b/test/integrations/destinations/yahoo_dsp/processor/data.ts @@ -51,7 +51,7 @@ export const data = [ }, { ipAddress: 'fdffddf', - email: 'van@abc.com', + email: 'van@abc.com ', deviceId: 'djfdjfkdjf', phone: '@09876543210', firstName: 'test', diff --git a/test/integrations/sources/adjust/data.ts b/test/integrations/sources/adjust/data.ts new file mode 100644 index 0000000000..975543fbec --- /dev/null +++ b/test/integrations/sources/adjust/data.ts @@ -0,0 +1,122 @@ +import utils from '../../../../src/v0/util'; + +const defaultMockFns = () => { + jest.spyOn(utils, 'generateUUID').mockReturnValue('97fcd7b2-cc24-47d7-b776-057b7b199513'); +}; + +export const data = [ + { + name: 'adjust', + description: 'Simple track call', + module: 'source', + version: 'v0', + input: { + request: { + body: [ + { + id: 'adjust', + query_parameters: { + gps_adid: ['38400000-8cf0-11bd-b23e-10b96e40000d'], + adid: ['18546f6171f67e29d1cb983322ad1329'], + tracker_token: ['abc'], + custom: ['custom'], + tracker_name: ['dummy'], + created_at: ['1404214665'], + event_name: ['Click'], + }, + updated_at: '2023-02-10T12:16:07.251Z', + created_at: '2023-02-10T12:05:04.402Z', + }, + ], + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + batch: [ + { + context: { + library: { + name: 'unknown', + version: 'unknown', + }, + integration: { + name: 'Adjust', + }, + device: { + 'id ': '18546f6171f67e29d1cb983322ad1329', + }, + }, + integrations: { + Adjust: false, + }, + type: 'track', + event: 'Click', + originalTimestamp: '2014-07-01T11:37:45.000Z', + timestamp: '2014-07-01T11:37:45.000Z', + properties: { + gps_adid: '38400000-8cf0-11bd-b23e-10b96e40000d', + tracker_token: 'abc', + custom: 'custom', + tracker_name: 'dummy', + }, + anonymousId: '97fcd7b2-cc24-47d7-b776-057b7b199513', + }, + ], + }, + }, + ], + }, + }, + mockFns: () => { + defaultMockFns(); + }, + }, + { + name: 'adjust', + description: 'Simple track call with no query parameters', + module: 'source', + version: 'v0', + input: { + request: { + body: [ + { + id: 'adjust', + updated_at: '2023-02-10T12:16:07.251Z', + created_at: '2023-02-10T12:05:04.402Z', + }, + ], + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + error: 'Query_parameters is missing', + statTags: { + destinationId: 'Non determinable', + errorCategory: 'transformation', + implementation: 'native', + module: 'source', + workspaceId: 'Non determinable', + }, + statusCode: 400, + }, + }, + mockFns: () => { + defaultMockFns(); + }, + }, +]; diff --git a/test/integrations/sources/auth0/data.ts b/test/integrations/sources/auth0/data.ts index 66aab00182..b115f0e05e 100644 --- a/test/integrations/sources/auth0/data.ts +++ b/test/integrations/sources/auth0/data.ts @@ -254,6 +254,7 @@ export const data = [ batch: [ { type: 'identify', + source_type: 'ss', sentAt: '2022-10-31T05:57:06.859Z', traits: { connection: 'Username-Password-Authentication', @@ -304,6 +305,7 @@ export const data = [ batch: [ { type: 'track', + source_type: 'sapi', event: 'Success API Operation', sentAt: '2022-10-31T05:57:06.874Z', userId: 'auth0|dummyPassword', @@ -594,6 +596,7 @@ export const data = [ batch: [ { type: 'group', + source_type: 'sapi', sentAt: '2022-10-31T06:09:59.135Z', userId: 'google-oauth2|123456', anonymousId: '97fcd7b2-cc24-47d7-b776-057b7b199513', @@ -936,6 +939,7 @@ export const data = [ batch: [ { type: 'track', + source_type: 'sapi', event: 'Success API Operation', sentAt: '2022-10-31T06:15:25.201Z', userId: 'google-oauth2|123456', @@ -1157,6 +1161,7 @@ export const data = [ batch: [ { type: 'track', + source_type: 'gd_tenant_update', event: 'Guardian tenant update', sentAt: '2022-10-31T06:15:25.196Z', userId: 'google-oauth2|123456', @@ -1285,6 +1290,7 @@ export const data = [ batch: [ { type: 'identify', + source_type: 'ss', sentAt: '2022-10-31T05:57:06.859Z', traits: { connection: 'Username-Password-Authentication', @@ -1404,6 +1410,7 @@ export const data = [ batch: [ { type: 'identify', + source_type: 'ss', userId: '', anonymousId: '97fcd7b2-cc24-47d7-b776-057b7b199513', sentAt: '2022-10-31T05:57:06.859Z', @@ -1454,6 +1461,7 @@ export const data = [ batch: [ { type: 'track', + source_type: 'sapi', event: 'Success API Operation', sentAt: '2022-10-31T05:57:06.874Z', anonymousId: '97fcd7b2-cc24-47d7-b776-057b7b199513', @@ -1490,4 +1498,29 @@ export const data = [ defaultMockFns(); }, }, + { + name: 'auth0', + description: 'empty batch', + module: 'source', + version: 'v0', + input: { + request: { + body: [], + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [], + }, + }, + mockFns: () => { + defaultMockFns(); + }, + }, ]; diff --git a/test/integrations/testTypes.ts b/test/integrations/testTypes.ts index 1c5a989f44..3df732d84f 100644 --- a/test/integrations/testTypes.ts +++ b/test/integrations/testTypes.ts @@ -78,6 +78,7 @@ export type ProcessorTestData = { body: ProcessorTransformationResponse[]; }; }; + mockFns?: (mockAdapter: MockAdapter) => {}; }; export type RouterTestData = { id: string; diff --git a/test/integrations/testUtils.ts b/test/integrations/testUtils.ts index 0a2727f4d0..694f224859 100644 --- a/test/integrations/testUtils.ts +++ b/test/integrations/testUtils.ts @@ -243,6 +243,7 @@ export const generateSimplifiedTrackPayload: any = (parametersOverride: any) => context: removeUndefinedAndNullValues({ externalId: parametersOverride.context.externalId, traits: parametersOverride.context.traits, + device: parametersOverride.context.device, }), anonymousId: parametersOverride.anonymousId || 'default-anonymousId', originalTimestamp: parametersOverride.originalTimestamp || '2021-01-03T17:02:53.193Z', @@ -286,6 +287,7 @@ export const generatePageOrScreenPayload: any = (parametersOverride: any, eventT screen: { density: 2, }, + page: parametersOverride.context.page, traits: parametersOverride.context.traits, externalId: parametersOverride.externalId, userAgent: @@ -351,8 +353,9 @@ export const generateGroupPayload: any = (parametersOverride: any) => { screen: { density: 2, }, + device: parametersOverride.context.device, traits: parametersOverride.context.traits, - externalId: parametersOverride.externalId, + externalId: parametersOverride.context.externalId, }), messageId: parametersOverride.messageId || generateAlphanumericId(36), session_id: parametersOverride.session_id || generateAlphanumericId(36),