diff --git a/modules/adheseBidAdapter.js b/modules/adheseBidAdapter.js
index 96a2b52fb9c..3c129d1bee1 100644
--- a/modules/adheseBidAdapter.js
+++ b/modules/adheseBidAdapter.js
@@ -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;
@@ -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
}
});
@@ -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) {
@@ -166,6 +175,8 @@ function getAdDetails(ad) {
let creativeId = '';
let dealId = '';
let originData = {};
+ let origin = '';
+ let originInstance = '';
if (isAdheseAd(ad)) {
creativeId = ad.id;
@@ -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) {
diff --git a/test/spec/modules/adheseBidAdapter_spec.js b/test/spec/modules/adheseBidAdapter_spec.js
index 7392ecd8f4e..def504b0424 100644
--- a/test/spec/modules/adheseBidAdapter_spec.js
+++ b/test/spec/modules/adheseBidAdapter_spec.js
@@ -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;
};
@@ -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);
@@ -155,6 +162,8 @@ describe('AdheseAdapter', function () {
netRevenue: NET_REVENUE,
ttl: TTL,
adhese: {
+ origin: 'APPNEXUS',
+ originInstance: '',
originData: {
adType: 'leaderboard',
seatbid: [
@@ -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);
});
@@ -251,6 +263,8 @@ describe('AdheseAdapter', function () {
requestId: BID_ID,
ad: '',
adhese: {
+ origin: '',
+ originInstance: '',
originData: {
adFormat: 'largeleaderboard',
adId: '742898',
@@ -310,6 +324,8 @@ describe('AdheseAdapter', function () {
requestId: BID_ID,
vastXml: '',
adhese: {
+ origin: '',
+ originInstance: '',
originData: {
adFormat: '',
adId: '742470',