diff --git a/modules/consumableBidAdapter.js b/modules/consumableBidAdapter.js
index 9374be62452..d462acaee59 100644
--- a/modules/consumableBidAdapter.js
+++ b/modules/consumableBidAdapter.js
@@ -28,10 +28,7 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
- buildRequests: function(validBidRequests) {
- // Do we need to group by bidder? i.e. to make multiple requests for
- // different endpoints.
-
+ buildRequests: function(validBidRequests, bidderRequest) {
let ret = {
method: 'POST',
url: '',
@@ -50,14 +47,21 @@ export const spec = {
const data = Object.assign({
placements: [],
time: Date.now(),
- user: {},
url: utils.getTopWindowUrl(),
referrer: document.referrer,
- enableBotFiltering: true,
- includePricingData: true,
- parallel: true
+ source: [{
+ 'name': 'prebidjs',
+ 'version': '$prebid.version$'
+ }]
}, validBidRequests[0].params);
+ if (bidderRequest && bidderRequest.gdprConsent) {
+ data.gdpr = {
+ consent: bidderRequest.gdprConsent.consentString,
+ applies: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true
+ };
+ }
+
validBidRequests.map(bid => {
const placement = Object.assign({
divName: bid.bidId,
@@ -123,12 +127,16 @@ export const spec = {
return bidResponses;
},
- getUserSyncs: function(syncOptions) {
+ getUserSyncs: function(syncOptions, serverResponses) {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: '//sync.serverbid.com/ss/' + siteId + '.html'
}];
+ }
+
+ if (syncOptions.pixelEnabled && serverResponses.length > 0) {
+ return serverResponses[0].body.pixels;
} else {
utils.logWarn(bidder + ': Please enable iframe based user syncing.');
}
@@ -192,12 +200,7 @@ function getSize(sizes) {
}
function retrieveAd(decision, unitId, unitName) {
- let oad = decision.contents && decision.contents[0] && decision.contents[0].body + utils.createTrackPixelHtml(decision.impressionUrl);
- let cb = Math.round(new Date().getTime());
- let ad = '' + oad;
- ad += '';
- ad += '';
- ad += ''
+ let ad = decision.contents && decision.contents[0] && decision.contents[0].body + utils.createTrackPixelHtml(decision.impressionUrl);
return ad;
}
diff --git a/test/spec/modules/consumableBidAdapter_spec.js b/test/spec/modules/consumableBidAdapter_spec.js
index 832706b2b95..fc5e1d1b45a 100644
--- a/test/spec/modules/consumableBidAdapter_spec.js
+++ b/test/spec/modules/consumableBidAdapter_spec.js
@@ -43,6 +43,10 @@ const REQUEST = {
'bidderRequestId': '109f2a181342a9',
'auctionId': 'a4713c32-3762-4798-b342-4ab810ca770d'
}],
+ 'gdprConsent': {
+ 'consentString': 'consent-test',
+ 'gdprApplies': true
+ },
'start': 1487883186070,
'auctionStart': 1487883186069,
'timeout': 3000
@@ -52,6 +56,7 @@ const RESPONSE = {
'headers': null,
'body': {
'user': { 'key': 'ue1-2d33e91b71e74929b4aeecc23f4376f1' },
+ 'pixels': [{ 'type': 'image', 'url': '//sync.serverbid.com/ss/' }],
'decisions': {
'2b0f82502298c9': {
'adId': 2364764,
@@ -206,7 +211,7 @@ describe('Consumable BidAdapter', function () {
});
describe('interpretResponse validation', function () {
it('response should have valid bidderCode', function () {
- let bidRequest = spec.buildRequests(REQUEST.bidRequest);
+ let bidRequest = spec.buildRequests(REQUEST.bidRequest, REQUEST);
let bid = createBid(1, bidRequest.bidRequest[0]);
expect(bid.bidderCode).to.equal('consumable');
@@ -264,5 +269,12 @@ describe('Consumable BidAdapter', function () {
expect(opts.length).to.equal(1);
});
+
+ it('should return a sync url if pixel syncs are enabled and some are returned from the server', function () {
+ let syncOptions = {'pixelEnabled': true};
+ let opts = spec.getUserSyncs(syncOptions, [RESPONSE]);
+
+ expect(opts.length).to.equal(1);
+ });
});
});