Skip to content

Commit

Permalink
Admaru Bid Adapter: Add user sync (prebid#9444)
Browse files Browse the repository at this point in the history
* AdmaruBidAdapter: add user sync

* AdmaruBidAdapter: Use https in user sync
  • Loading branch information
kdesput authored and jorgeluisrocha committed May 18, 2023
1 parent d33dd82 commit 466f144
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
20 changes: 19 additions & 1 deletion modules/admaruBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const ADMARU_ENDPOINT = 'https://p1.admaru.net/AdCall';
const BIDDER_CODE = 'admaru';

const DEFAULT_BID_TTL = 360;
const SYNC_URL = 'https://p2.admaru.net/UserSync/sync'

function parseBid(rawBid, currency) {
const bid = {};
Expand Down Expand Up @@ -75,7 +76,24 @@ export const spec = {
}

return bidResponses;
}
},

getUserSyncs: function (syncOptions, responses) {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: SYNC_URL
}];
}
if (syncOptions.pixelEnabled) {
return [{
type: 'image',
url: SYNC_URL
}];
}

return [];
},
}

registerBidder(spec);
48 changes: 48 additions & 0 deletions test/spec/modules/admaruBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,52 @@ describe('Admaru Adapter', function () {
expect(result.length).to.equal(0);
});
});

describe('getUserSyncs()', () => {
it('should return iframe user sync if iframe sync is enabled', () => {
const syncs = spec.getUserSyncs(
{
pixelEnabled: true,
iframeEnabled: true,
},
null
);

expect(syncs).to.deep.equal([
{
type: 'iframe',
url: 'https://p2.admaru.net/UserSync/sync',
},
]);
});

it('should return image syncs if they are enabled and iframe is disabled', () => {
const syncs = spec.getUserSyncs(
{
pixelEnabled: true,
iframeEnabled: false,
},
null
);

expect(syncs).to.deep.equal([
{
type: 'image',
url: 'https://p2.admaru.net/UserSync/sync',
},
]);
});

it('should not return user syncs if syncs are disabled', () => {
const syncs = spec.getUserSyncs(
{
pixelEnabled: false,
iframeEnabled: false,
},
null
);

expect(syncs).to.deep.equal([]);
});
});
});

0 comments on commit 466f144

Please sign in to comment.