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

Admaru Bid Adapter: Add user sync #9444

Merged
merged 3 commits into from
Feb 8, 2023
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
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([]);
});
});
});