Skip to content

Commit

Permalink
Serverbid Bid Adapter: getUserSyncs and new adsizes (#2106)
Browse files Browse the repository at this point in the history
* serverbid sync wip

* Serverbid Bid Adapter: enable getUserSyncs, new ad sizes
  • Loading branch information
jgrimes authored and jaiminpanchal27 committed Feb 6, 2018
1 parent d48d7dd commit 16c9403
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
26 changes: 25 additions & 1 deletion modules/serverbidBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const CONFIG = {
}
};

let siteId = 0;
let bidder = 'serverbid';

export const spec = {
code: BIDDER_CODE,
aliases: ['connectad', 'onefiftytwo', 'insticator', 'adsparc', 'automatad'],
Expand Down Expand Up @@ -62,6 +65,10 @@ export const spec = {

let ENDPOINT_URL;

// These variables are used in creating the user sync URL.
siteId = validBidRequests[0].params.siteId;
bidder = validBidRequests[0].params.bidder;

const data = Object.assign({
placements: [],
time: Date.now(),
Expand Down Expand Up @@ -140,7 +147,21 @@ export const spec = {
},

getUserSyncs: function(syncOptions) {
return [];
if (syncOptions.iframeEnabled) {
if (bidder === 'connectad') {
return [{
type: 'iframe',
url: '//cdn.connectad.io/connectmyusers.php'
}];
} else {
return [{
type: 'iframe',
url: '//s.zkcdn.net/ss/' + siteId + '.html'
}];
}
} else {
utils.logWarn(bidder + ': Please enable iframe based user syncing.');
}
}
};

Expand Down Expand Up @@ -185,6 +206,9 @@ sizeMap[429] = '486x60';
sizeMap[374] = '700x500';
sizeMap[934] = '300x1050';
sizeMap[1578] = '320x100';
sizeMap[331] = '320x250';
sizeMap[3301] = '320x267';
sizeMap[2730] = '728x250';

function getSize(sizes) {
const result = [];
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/serverbidBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ describe('Serverbid BidAdapter', () => {
expect(opts).to.be.empty;
});

it('should always return empty array', () => {
it('should return a sync url if iframe syncs are enabled', () => {
let opts = spec.getUserSyncs(syncOptions);

expect(opts).to.be.empty;
expect(opts.length).to.equal(1);
});
});
});

0 comments on commit 16c9403

Please sign in to comment.