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

Serverbid Bid Adapter: getUserSyncs and new adsizes #2106

Merged
merged 2 commits into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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);
});
});
});