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

Support for ID5 #5345

Merged
merged 21 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a1391f1
Add support for bidderRequest.refererInfo in Adhese Adapter.
mefjush Apr 8, 2019
bde66ca
Merge remote-tracking branch 'origin/mastermastermaster'
Apr 11, 2019
c72f234
Add support for bidderRequest.refererInfo in Adhese Adapter.
mefjush Apr 8, 2019
6611cff
Merge branch 'master' of github.com:adhese/Prebid.js
mefjush Apr 30, 2019
d7e9483
Jira AD-2462 / add tlall is consent string is present
Oct 22, 2019
0da5c59
Added 'adhese' attribute to bid that contains meta data - Jira AD-2642
Oct 23, 2019
3045d68
added DALE to adhese determination
Oct 23, 2019
e0a6d7c
extra config option: no format, but use size array as format string
Oct 23, 2019
57f0033
Added more values to originData
Apr 20, 2020
1c367df
Revert "Added more values to originData"
Apr 20, 2020
7b8db87
Pulled Sander's changes & added more data to originData
Apr 20, 2020
5a32f50
Merge remote-tracking branch 'prebid/master'
sander-adhese Apr 21, 2020
1134474
Adhese bid adapter - final version
Apr 22, 2020
38f5ec7
add origin and originInstance
westerschmal Apr 29, 2020
bbbe7e2
add id5 id to request as x5
Jun 3, 2020
726eeb9
Merge branch 'westerschmal-patch-1' of https://github.com/adhese/Preb…
Jun 3, 2020
a9dfd28
Add support for bidderRequest.refererInfo in Adhese Adapter.
mefjush Apr 8, 2019
f4d491c
added DALE to adhese determination
Oct 23, 2019
464e6cc
Merge branch 'master' of https://github.com/adhese/Prebid.js
Jun 5, 2020
699f758
updated tests to include new fields
Jun 5, 2020
2a6e9ca
Added test for ID5 id
Jun 12, 2020
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
21 changes: 17 additions & 4 deletions modules/adheseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export const spec = {
const targets = validBidRequests.map(bid => bid.params.data).reduce(mergeTargets, {});
const gdprParams = (gdprConsent && gdprConsent.consentString) ? [`xt${gdprConsent.consentString}`] : [];
const refererParams = (refererInfo && refererInfo.referer) ? [`xf${base64urlEncode(refererInfo.referer)}`] : [];
const id5Params = (getId5Id(validBidRequests)) ? [`x5${getId5Id(validBidRequests)}`] : [];
const targetsParams = Object.keys(targets).map(targetCode => targetCode + targets[targetCode].join(';'));
const slotsParams = validBidRequests.map(bid => 'sl' + bidToSlotName(bid));
const params = [...slotsParams, ...targetsParams, ...gdprParams, ...refererParams].map(s => `/${s}`).join('');
const params = [...slotsParams, ...targetsParams, ...gdprParams, ...refererParams, ...id5Params].map(s => `/${s}`).join('');
const cacheBuster = '?t=' + new Date().getTime();
const uri = 'https://ads-' + account + '.adhese.com/json' + params + cacheBuster;

Expand Down Expand Up @@ -85,7 +86,9 @@ function adResponse(bid, ad) {
creativeId: adDetails.creativeId,
dealId: adDetails.dealId,
adhese: {
originData: adDetails.originData
originData: adDetails.originData,
origin: adDetails.origin,
originInstance: adDetails.originInstance
}
});

Expand Down Expand Up @@ -134,12 +137,18 @@ function getAccount(validBidRequests) {
return validBidRequests[0].params.account;
}

function getId5Id(validBidRequests) {
if (validBidRequests[0] && validBidRequests[0].userId && validBidRequests[0].userId.id5id) {
return validBidRequests[0].userId.id5id;
}
}

function getbaseAdResponse(response) {
return Object.assign({ netRevenue: true, ttl: 360 }, response);
}

function isAdheseAd(ad) {
return !ad.origin || ad.origin === 'JERLICIA';
return !ad.origin || ad.origin === 'JERLICIA' || ad.origin === 'DALE';
}

function getMediaType(markup) {
Expand All @@ -166,6 +175,8 @@ function getAdDetails(ad) {
let creativeId = '';
let dealId = '';
let originData = {};
let origin = '';
let originInstance = '';

if (isAdheseAd(ad)) {
creativeId = ad.id;
Expand All @@ -188,8 +199,10 @@ function getAdDetails(ad) {
}
}
}
if (ad.originInstance) originInstance = ad.originInstance;
if (ad.origin) origin = ad.origin;
}
return { creativeId: creativeId, dealId: dealId, originData: originData };
return { creativeId: creativeId, dealId: dealId, originData: originData, origin: origin, originInstance: originInstance };
}

function base64urlEncode(s) {
Expand Down
20 changes: 18 additions & 2 deletions test/spec/modules/adheseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ let minimalBid = function() {
}
};

let bidWithParams = function(data) {
let bidWithParams = function(data, userId) {
let bid = minimalBid();
bid.params.data = data;
bid.userId = userId;
return bid;
};

Expand Down Expand Up @@ -100,6 +101,12 @@ describe('AdheseAdapter', function () {
expect(req.url).to.contain('/xfaHR0cDovL3ByZWJpZC5vcmcvZGV2LWRvY3Mvc3ViamVjdHM_X2Q9MQ');
});

it('should include id5 id as /x5 param', function () {
let req = spec.buildRequests([ bidWithParams({}, {'id5id': 'ID5-1234567890'}) ], bidderRequest);

expect(req.url).to.contain('/x5ID5-1234567890');
});

it('should include bids', function () {
let bid = minimalBid();
let req = spec.buildRequests([ bid ], bidderRequest);
Expand Down Expand Up @@ -155,6 +162,8 @@ describe('AdheseAdapter', function () {
netRevenue: NET_REVENUE,
ttl: TTL,
adhese: {
origin: 'APPNEXUS',
originInstance: '',
originData: {
adType: 'leaderboard',
seatbid: [
Expand Down Expand Up @@ -199,7 +208,10 @@ describe('AdheseAdapter', function () {
mediaType: 'video',
netRevenue: NET_REVENUE,
ttl: TTL,
adhese: { originData: {} }
adhese: {
origin: 'RUBICON',
originInstance: '',
originData: {} }
}];
expect(spec.interpretResponse(sspVideoResponse, bidRequest)).to.deep.equal(expectedResponse);
});
Expand Down Expand Up @@ -251,6 +263,8 @@ describe('AdheseAdapter', function () {
requestId: BID_ID,
ad: '<script id="body" type="text/javascript"></script><img src=\'https://hosts-demo.adhese.com/track/742898\' style=\'height:1px; width:1px; margin: -1px -1px; display:none;\'/>',
adhese: {
origin: '',
originInstance: '',
originData: {
adFormat: 'largeleaderboard',
adId: '742898',
Expand Down Expand Up @@ -310,6 +324,8 @@ describe('AdheseAdapter', function () {
requestId: BID_ID,
vastXml: '<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'no\'?><VAST version=\'2.0\' xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\' xsi:noNamespaceSchemaLocation=\'vast.xsd\'></VAST>',
adhese: {
origin: '',
originInstance: '',
originData: {
adFormat: '',
adId: '742470',
Expand Down