Skip to content

Commit

Permalink
Add user sync (prebid#6244)
Browse files Browse the repository at this point in the history
* initial

* fix

* remove redundant language mod, use player sizes in video traff

* test modify

* fix

* Adding Tests

* add keywords param

* log

* log

* log

* fix

* add idl

* add idl

* fix test

* lint

* lint

* fix

* lint

* lint

* lint

* lint

* add sync

* fix

Co-authored-by: Aigolkin1991 <[email protected]>
Co-authored-by: Aiholkin <[email protected]>
  • Loading branch information
3 people authored and icflournoy committed Feb 5, 2021
1 parent 4ba4a29 commit e5bcea4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
20 changes: 20 additions & 0 deletions modules/adprimeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as utils from '../src/utils.js';

const BIDDER_CODE = 'adprime';
const AD_URL = 'https://delta.adprime.com/?c=o&m=multi';
const SYNC_URL = 'https://delta.adprime.com/?c=rtb&m=sync';

function isBidResponseValid(bid) {
if (!bid.requestId || !bid.cpm || !bid.creativeId ||
Expand Down Expand Up @@ -104,6 +105,25 @@ export const spec = {
}
return response;
},

getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent) => {
let syncUrl = SYNC_URL
if (gdprConsent && gdprConsent.consentString) {
if (typeof gdprConsent.gdprApplies === 'boolean') {
syncUrl += `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
} else {
syncUrl += `&gdpr=0&gdpr_consent=${gdprConsent.consentString}`;
}
}
if (uspConsent && uspConsent.consentString) {
syncUrl += `&ccpa_consent=${uspConsent.consentString}`;
}
return [{
type: 'image',
url: syncUrl
}];
}

};

registerBidder(spec);
10 changes: 10 additions & 0 deletions test/spec/modules/adprimeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,14 @@ describe('AdprimebBidAdapter', function () {
expect(serverResponses).to.be.an('array').that.is.empty;
});
});
describe('getUserSyncs', function () {
let userSync = spec.getUserSyncs();
it('Returns valid URL and type', function () {
expect(userSync).to.be.an('array').with.lengthOf(1);
expect(userSync[0].type).to.exist;
expect(userSync[0].url).to.exist;
expect(userSync[0].type).to.be.equal('image');
expect(userSync[0].url).to.be.equal('https://delta.adprime.com/?c=rtb&m=sync');
});
});
});

0 comments on commit e5bcea4

Please sign in to comment.