Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SymitriDap RTD Module : segment taxonomy values changed to Symitri registered values #12311

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/symitriDapRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
dapRetryTokenize = 0;
var jsonData = null;
if (rtdConfig && isPlainObject(rtdConfig.params)) {
if (rtdConfig.params.segtax == 504) {
if (rtdConfig.params.segtax == 710) {
let encMembership = dapUtils.dapGetEncryptedMembershipFromLocalStorage();
if (encMembership) {
jsonData = dapUtils.dapGetEncryptedRtdObj(encMembership, rtdConfig.params.segtax)
Expand Down Expand Up @@ -191,7 +191,7 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
const ortb2 = bidConfig.ortb2Fragments.global;
logMessage('token is: ', token);
if (token !== null) { // If token is not null then check the membership in storage and add the RTD object
if (config.segtax == 504) { // Follow the encrypted membership path
if (config.segtax == 710) { // Follow the encrypted membership path
dapUtils.dapRefreshEncryptedMembership(ortb2, config, token, onDone) // Get the encrypted membership from server
refreshMembership = false;
} else {
Expand Down Expand Up @@ -248,7 +248,7 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
dapUtils.dapLog('Successfully stored DAP 100 Device ID: ' + deviceId100);
}
if (refreshMembership) {
if (config.segtax == 504) {
if (config.segtax == 710) {
dapUtils.dapRefreshEncryptedMembership(ortb2, config, token, onDone);
} else {
dapUtils.dapRefreshMembership(ortb2, config, token, onDone);
Expand Down Expand Up @@ -449,7 +449,7 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {

checkAndAddRealtimeData: function(ortb2, data, segtax) {
if (data.rtd) {
if (segtax == 504 && dapUtils.checkIfSegmentsAlreadyExist(ortb2, data.rtd, 504)) {
if (segtax == 710 && dapUtils.checkIfSegmentsAlreadyExist(ortb2, data.rtd, 710)) {
logMessage('DEBUG(handleInit): rtb Object already added');
} else {
addRealTimeData(ortb2, data.rtd);
Expand Down
4 changes: 2 additions & 2 deletions modules/symitriDapRtdProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pbjs.setConfig({
domain: 'your-domain.com',
identityType: 'simpleid'|'compositeid'|'hashedid'|'dap-signature:1.0.0',
identityValue: '<user hid>',
segtax: 501,
segtax: 708,
dapEntropyUrl: 'https://sym-dist.symitri.net/dapentropy.js',
dapEntropyTimeout: 1500,
pixelUrl: '<see your Symitri account rep>',
Expand Down Expand Up @@ -80,7 +80,7 @@ Use 'hashedid' to pass in single already hashed id. Use 'compositeid' to pass in
}
|
| identityValue | String | This is optional field to pass user hid. Will be used only if identityType is hid | |
| segtax | Integer | The taxonomy for Symitri | The value should be 501 |
| segtax | Integer | The taxonomy for Symitri | The value should be 708 |
| dapEntropyUrl | String | URL to dap entropy script | Optional if the script is directly included on the webpage. Contact your Symitri account rep for more details |
| dapEntropyTimeout | Integer | Maximum time allotted for the entropy calculation to happen | |
| pixelUrl | String | Pixel URL provided by Symitri which will be triggered when bid matching with Symitri dealid wins and creative gets rendered | |
Expand Down
32 changes: 16 additions & 16 deletions test/spec/modules/symitriDapRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('symitriDapRtdProvider', function() {
'apiAuthToken': 'Token 1234',
'domain': 'prebid.org',
'identityType': 'dap-signature:1.0.0',
'segtax': 503
'segtax': 708
}
}

Expand All @@ -61,7 +61,7 @@ describe('symitriDapRtdProvider', function() {
'apiVersion': 'x1',
'domain': 'prebid.org',
'identityType': 'dap-signature:1.0.0',
'segtax': 504,
'segtax': 710,
'pixelUrl': 'https://www.test.com/pixel'
}
}
Expand All @@ -70,15 +70,15 @@ describe('symitriDapRtdProvider', function() {
'api_hostname': 'prebid.dap.akadns.net',
'api_version': 'x1',
'domain': 'prebid.org',
'segtax': 503,
'segtax': 708,
'identity': sampleIdentity
}

const esampleConfig = {
'api_hostname': 'prebid.dap.akadns.net',
'api_version': 'x1',
'domain': 'prebid.org',
'segtax': 504,
'segtax': 710,
'identity': sampleIdentity
}
let cacheExpiry = Math.round(Date.now() / 1000.0) + 300; // in seconds
Expand All @@ -104,7 +104,7 @@ describe('symitriDapRtdProvider', function() {
const encRtdUserObj = {
name: 'www.dataprovider3.com',
ext: {
segtax: 504,
segtax: 710,
taxonomyname: 'iab_audience_taxonomy'
},
segment: []
Expand Down Expand Up @@ -269,13 +269,13 @@ describe('symitriDapRtdProvider', function() {
'api_hostname': 'prebid.dap.akadns.net',
'api_version': 1,
'domain': '',
'segtax': 503
'segtax': 708
};
const encConfig = {
'api_hostname': 'prebid.dap.akadns.net',
'api_version': 1,
'domain': '',
'segtax': 504
'segtax': 710
};
let identity = {
type: 'dap-signature:1.0.0'
Expand Down Expand Up @@ -403,7 +403,7 @@ describe('symitriDapRtdProvider', function() {
apiHostname: 'prebid.dap.akadns.net',
apiVersion: 'x1',
domain: 'prebid.org',
segtax: 503
segtax: 708
};
expect(dapUtils.dapRefreshMembership(ortb2, config, 'token', onDone)).to.equal(undefined)
const membership = {cohorts: ['1', '5', '7']}
Expand All @@ -412,11 +412,11 @@ describe('symitriDapRtdProvider', function() {
});

describe('checkAndAddRealtimeData test', function () {
it('add realtime data for segtax 503 and 504', function () {
dapUtils.checkAndAddRealtimeData(ortb2, cachedEncRtd, 504);
dapUtils.checkAndAddRealtimeData(ortb2, cachedEncRtd, 504);
it('add realtime data for segtax 708 and 710', function () {
dapUtils.checkAndAddRealtimeData(ortb2, cachedEncRtd, 710);
dapUtils.checkAndAddRealtimeData(ortb2, cachedEncRtd, 710);
expect(ortb2.user.data).to.deep.include.members([encRtdUserObj]);
dapUtils.checkAndAddRealtimeData(ortb2, cachedRtd, 503);
dapUtils.checkAndAddRealtimeData(ortb2, cachedRtd, 708);
expect(ortb2.user.data).to.deep.include.members([rtdUserObj]);
});
});
Expand Down Expand Up @@ -473,7 +473,7 @@ describe('symitriDapRtdProvider', function() {
let request = server.requests[0];
responseHeader['Symitri-DAP-Token'] = encMembership;
request.respond(200, responseHeader, encMembership);
let rtdObj = dapUtils.dapGetEncryptedRtdObj({'encryptedSegments': encMembership}, 504)
let rtdObj = dapUtils.dapGetEncryptedRtdObj({'encryptedSegments': encMembership}, 710)
expect(ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
expect(JSON.parse(storage.getDataFromLocalStorage(DAP_ENCRYPTED_MEMBERSHIP)).expires_at).to.equal(expiry);
});
Expand All @@ -484,7 +484,7 @@ describe('symitriDapRtdProvider', function() {
let request = server.requests[0];
responseHeader['Symitri-DAP-Token'] = encMembership;
request.respond(200, responseHeader, encMembership);
let rtdObj = dapUtils.dapGetEncryptedRtdObj({'encryptedSegments': encMembership}, 504)
let rtdObj = dapUtils.dapGetEncryptedRtdObj({'encryptedSegments': encMembership}, 710)
expect(ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
expect(JSON.parse(storage.getDataFromLocalStorage(DAP_ENCRYPTED_MEMBERSHIP)).expires_at).to.equal(1643830630);
});
Expand Down Expand Up @@ -515,7 +515,7 @@ describe('symitriDapRtdProvider', function() {
dapUtils.dapRefreshMembership(ortb2, sampleConfig, sampleCachedToken.token, onDone);
let request = server.requests[0];
request.respond(200, responseHeader, JSON.stringify(membership));
let rtdObj = dapUtils.dapGetRtdObj(membership, 503);
let rtdObj = dapUtils.dapGetRtdObj(membership, 708);
expect(ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
});

Expand All @@ -524,7 +524,7 @@ describe('symitriDapRtdProvider', function() {
dapUtils.dapRefreshMembership(ortb2, sampleConfig, sampleCachedToken.token, onDone);
let request = server.requests[0];
request.respond(200, responseHeader, JSON.stringify(membership));
let rtdObj = dapUtils.dapGetRtdObj(membership, 503)
let rtdObj = dapUtils.dapGetRtdObj(membership, 708)
expect(ortb2.user.data).to.deep.include.members(rtdObj.rtd.ortb2.user.data);
expect(JSON.parse(storage.getDataFromLocalStorage(DAP_MEMBERSHIP)).expires_at).to.be.equal(1647971548);
});
Expand Down