-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(destination): onboard campaign manager (#1580)
* feat(destination): onboard campaign manager * feat(destination): onboard campaign manager * feat: added profileId in dest config campaign manager * feat: addressed comments
- Loading branch information
1 parent
f641cc0
commit b823a53
Showing
12 changed files
with
1,363 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const integration = "campaign_manager"; | ||
const name = "campaign_manager"; | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
const version = "v0"; | ||
const transformer = require(`../${version}/destinations/${integration}/transform`); | ||
|
||
// Processor Test Data | ||
const testDataFile = fs.readFileSync( | ||
path.resolve(__dirname, `./data/${integration}.json`) | ||
); | ||
const testData = JSON.parse(testDataFile); | ||
|
||
// Router Test files | ||
const inputRouterDataFile = fs.readFileSync( | ||
path.resolve(__dirname, `./data/${integration}_router_input.json`) | ||
); | ||
const outputRouterDataFile = fs.readFileSync( | ||
path.resolve(__dirname, `./data/${integration}_router_output.json`) | ||
); | ||
const inputRouterData = JSON.parse(inputRouterDataFile); | ||
const expectedRouterData = JSON.parse(outputRouterDataFile); | ||
|
||
describe(`${name} Tests`, () => { | ||
describe("Processor", () => { | ||
testData.forEach((dataPoint, index) => { | ||
it(`${index}. ${integration} - ${dataPoint.description}`, async () => { | ||
try { | ||
let output = await transformer.process(dataPoint.input); | ||
delete output.body.JSON.idempotency; | ||
expect(output).toEqual(dataPoint.output); | ||
} catch (error) { | ||
expect(error.message).toEqual(dataPoint.output.error); | ||
} | ||
}); | ||
}); | ||
}); | ||
|
||
describe("Router Tests", () => { | ||
it("Payload", async () => { | ||
const routerOutput = await transformer.processRouterDest(inputRouterData); | ||
expect(routerOutput).toEqual(expectedRouterData); | ||
}); | ||
}); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,308 @@ | ||
[ | ||
{ | ||
"description": "Track - batch insert Call", | ||
"input": { | ||
"message": { | ||
"channel": "web", | ||
"context": { | ||
"app": { | ||
"build": "1.0.0", | ||
"name": "RudderLabs JavaScript SDK", | ||
"namespace": "com.rudderlabs.javascript", | ||
"version": "1.0.0" | ||
}, | ||
"device": { | ||
"id": "0572f78fa49c648e", | ||
"name": "generic_x86_arm", | ||
"type": "Android", | ||
"model": "AOSP on IA Emulator", | ||
"manufacturer": "Google", | ||
"adTrackingEnabled": true, | ||
"advertisingId": "44c97318-9040-4361-8bc7-4eb30f665ca8" | ||
}, | ||
"traits": { | ||
"email": "alex@example.com", | ||
"phone": "+1-202-555-0146", | ||
"firstName": "John", | ||
"lastName": "Gomes", | ||
"city": "London", | ||
"state": "England", | ||
"countryCode": "GB", | ||
"postalCode": "EC3M", | ||
"streetAddress": "71 Cherry Court SOUTHAMPTON SO53 5PD UK" | ||
}, | ||
"library": { | ||
"name": "RudderLabs JavaScript SDK", | ||
"version": "1.0.0" | ||
}, | ||
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36", | ||
"locale": "en-US", | ||
"ip": "0.0.0.0", | ||
"os": { | ||
"name": "", | ||
"version": "" | ||
}, | ||
"screen": { | ||
"density": 2 | ||
} | ||
}, | ||
"event": "Promotion Clicked", | ||
"type": "track", | ||
"originalTimestamp": "2022-11-17T00:22:02.903+05:30", | ||
"properties": { | ||
"profileId": "34245", | ||
"floodlightConfigurationId": "213123123", | ||
"ordinal": "string", | ||
"floodlightActivityId": "456543345245", | ||
"mobileDeviceId": "string", | ||
"value": "756", | ||
"encryptedUserIdCandidates": [ | ||
"dfghjbnm" | ||
], | ||
"quantity": "455678", | ||
"gclid": "string", | ||
"matchId": "string", | ||
"dclid": "string", | ||
"impressionId": "string", | ||
"limitAdTracking": true, | ||
"childDirectedTreatment": true, | ||
"encryptionInfo": { | ||
"kind": "dfareporting#encryptionInfo", | ||
"encryptionSource": "AD_SERVING", | ||
"encryptionEntityId": "3564523", | ||
"encryptionEntityType": "DCM_ACCOUNT" | ||
}, | ||
"requestType": "batchupdate" | ||
}, | ||
"type": "track", | ||
"event": "event test", | ||
"anonymousId": "randomId", | ||
"integrations": { | ||
"All": true | ||
}, | ||
"name": "ApplicationLoaded", | ||
"sentAt": "2019-10-14T11:15:53.296Z" | ||
|
||
}, | ||
"metadata": { | ||
"secret": { | ||
"access_token": "abcd1234", | ||
"refresh_token": "efgh5678", | ||
"developer_token": "ijkl91011" | ||
} | ||
}, | ||
"destination": { | ||
"Config": { | ||
"profileId": "5343234", | ||
"treatmentForUnderage": false, | ||
"limitAdTracking": false, | ||
"childDirectedTreatment": false, | ||
"nonPersonalizedAd": false, | ||
"rudderAccountId": "2EOknn1JNH7WK1MfNku4fGYKkRK" | ||
} | ||
} | ||
}, | ||
"output": | ||
{ | ||
"version": "1", | ||
"type": "REST", | ||
"method": "POST", | ||
"endpoint": "https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/34245/conversions/batchupdate", | ||
"headers": { | ||
"Authorization": "Bearer abcd1234", | ||
"Content-Type": "application/json" | ||
}, | ||
"params": {}, | ||
"body": { | ||
"JSON": { | ||
"kind": "dfareporting#conversionsBatchUpdateRequest", | ||
"encryptionInfo": { | ||
"kind": "dfareporting#encryptionInfo", | ||
"encryptionSource": "AD_SERVING", | ||
"encryptionEntityId": "3564523", | ||
"encryptionEntityType": "DCM_ACCOUNT" | ||
}, | ||
"conversions": [ | ||
{ | ||
"floodlightConfigurationId": "213123123", | ||
"ordinal": "string", | ||
"timestampMicros": "1668624722000000", | ||
"floodlightActivityId": "456543345245", | ||
"mobileDeviceId": "string", | ||
"quantity": "455678", | ||
"value": 756, | ||
"encryptedUserIdCandidates": [ | ||
"dfghjbnm" | ||
], | ||
"gclid": "string", | ||
"matchId": "string", | ||
"dclid": "string", | ||
"impressionId": "string", | ||
"limitAdTracking": true, | ||
"childDirectedTreatment": true, | ||
"treatmentForUnderage": false, | ||
"nonPersonalizedAd": false | ||
} | ||
] | ||
}, | ||
"JSON_ARRAY": {}, | ||
"XML": {}, | ||
"FORM": {} | ||
}, | ||
"files": {} | ||
} | ||
}, | ||
{ | ||
"description": "Track - batch update Call", | ||
"input": { | ||
"message": { | ||
"channel": "web", | ||
"context": { | ||
"app": { | ||
"build": "1.0.0", | ||
"name": "RudderLabs JavaScript SDK", | ||
"namespace": "com.rudderlabs.javascript", | ||
"version": "1.0.0" | ||
}, | ||
"device": { | ||
"id": "0572f78fa49c648e", | ||
"name": "generic_x86_arm", | ||
"type": "Android", | ||
"model": "AOSP on IA Emulator", | ||
"manufacturer": "Google", | ||
"adTrackingEnabled": true, | ||
"advertisingId": "44c97318-9040-4361-8bc7-4eb30f665ca8" | ||
}, | ||
"traits": { | ||
"email": "alex@example.com", | ||
"phone": "+1-202-555-0146", | ||
"firstName": "John", | ||
"lastName": "Gomes", | ||
"city": "London", | ||
"state": "England", | ||
"countryCode": "GB", | ||
"postalCode": "EC3M", | ||
"streetAddress": "71 Cherry Court SOUTHAMPTON SO53 5PD UK" | ||
}, | ||
"library": { | ||
"name": "RudderLabs JavaScript SDK", | ||
"version": "1.0.0" | ||
}, | ||
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36", | ||
"locale": "en-US", | ||
"ip": "0.0.0.0", | ||
"os": { | ||
"name": "", | ||
"version": "" | ||
}, | ||
"screen": { | ||
"density": 2 | ||
} | ||
}, | ||
"event": "Promotion Clicked", | ||
"type": "track", | ||
"originalTimestamp": "2022-11-17T00:22:02.903+05:30", | ||
"properties": { | ||
"profileId": "34245", | ||
"floodlightConfigurationId": "213123123", | ||
"ordinal": "string", | ||
"floodlightActivityId": "456543345245", | ||
"mobileDeviceId": "string", | ||
"value": "756", | ||
"encryptedUserIdCandidates": [ | ||
"dfghjbnm" | ||
], | ||
"quantity": "455678", | ||
"gclid": "string", | ||
"matchId": "string", | ||
"dclid": "string", | ||
"impressionId": "string", | ||
"limitAdTracking": true, | ||
"childDirectedTreatment": true, | ||
"encryptionInfo": { | ||
"kind": "dfareporting#encryptionInfo", | ||
"encryptionSource": "AD_SERVING", | ||
"encryptionEntityId": "3564523", | ||
"encryptionEntityType": "DCM_ACCOUNT" | ||
}, | ||
"requestType": "batchupdate" | ||
}, | ||
"type": "track", | ||
"event": "event test", | ||
"anonymousId": "randomId", | ||
"integrations": { | ||
"All": true | ||
}, | ||
"name": "ApplicationLoaded", | ||
"sentAt": "2019-10-14T11:15:53.296Z" | ||
|
||
}, | ||
"metadata": { | ||
"secret": { | ||
"access_token": "abcd1234", | ||
"refresh_token": "efgh5678", | ||
"developer_token": "ijkl91011" | ||
} | ||
}, | ||
"destination": { | ||
"Config": { | ||
"profileId": "5343234", | ||
"treatmentForUnderage": false, | ||
"limitAdTracking": false, | ||
"childDirectedTreatment": false, | ||
"nonPersonalizedAd": false, | ||
"rudderAccountId": "2EOknn1JNH7WK1MfNku4fGYKkRK" | ||
} | ||
} | ||
}, | ||
"output": | ||
{ | ||
"version": "1", | ||
"type": "REST", | ||
"method": "POST", | ||
"endpoint": "https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/34245/conversions/batchupdate", | ||
"headers": { | ||
"Authorization": "Bearer abcd1234", | ||
"Content-Type": "application/json" | ||
}, | ||
"params": {}, | ||
"body": { | ||
"JSON": { | ||
"kind": "dfareporting#conversionsBatchUpdateRequest", | ||
"encryptionInfo": { | ||
"kind": "dfareporting#encryptionInfo", | ||
"encryptionSource": "AD_SERVING", | ||
"encryptionEntityId": "3564523", | ||
"encryptionEntityType": "DCM_ACCOUNT" | ||
}, | ||
"conversions": [ | ||
{ | ||
"floodlightConfigurationId": "213123123", | ||
"ordinal": "string", | ||
"timestampMicros": "1668624722000000", | ||
"floodlightActivityId": "456543345245", | ||
"mobileDeviceId": "string", | ||
"quantity": "455678", | ||
"value": 756, | ||
"encryptedUserIdCandidates": [ | ||
"dfghjbnm" | ||
], | ||
"gclid": "string", | ||
"matchId": "string", | ||
"dclid": "string", | ||
"impressionId": "string", | ||
"limitAdTracking": true, | ||
"childDirectedTreatment": true, | ||
"treatmentForUnderage": false, | ||
"nonPersonalizedAd": false | ||
} | ||
] | ||
}, | ||
"JSON_ARRAY": {}, | ||
"XML": {}, | ||
"FORM": {} | ||
}, | ||
"files": {} | ||
} | ||
} | ||
] |
Oops, something went wrong.