diff --git a/test/integrations/destinations/ga4/mocks.ts b/test/integrations/destinations/ga4/mocks.ts index 7b47fe9f44..38b2e70075 100644 --- a/test/integrations/destinations/ga4/mocks.ts +++ b/test/integrations/destinations/ga4/mocks.ts @@ -1,3 +1,3 @@ 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 f96ca9e74a..ba5b53c7d2 100644 --- a/test/integrations/destinations/ga4/processor/data.ts +++ b/test/integrations/destinations/ga4/processor/data.ts @@ -1,14903 +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, - }, + ...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..266fd0cf9d --- /dev/null +++ b/test/integrations/destinations/ga4/processor/trackTestData.ts @@ -0,0 +1,2792 @@ +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, + }, +]; 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/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 13a76702f9..76499d7259 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: @@ -350,8 +352,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),