Skip to content
Open
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
22 changes: 20 additions & 2 deletions modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const TIME_TO_LIVE = 300;
const NET_REVENUE = true;
const BANNER_SERVER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebid';
const VIDEO_SERVER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebidvideo';
const PB_COOKIE_ASSIST_SYNC_ENDPOINT = `https://ads.yieldmo.com/pbcas`;
const OUTSTREAM_VIDEO_PLAYER_URL = 'https://prebid-outstream.yieldmo.com/bundle.js';
const OPENRTB_VIDEO_BIDPARAMS = ['mimes', 'startdelay', 'placement', 'startdelay', 'skipafter', 'protocols', 'api',
'playbackmethod', 'maxduration', 'minduration', 'pos', 'skip', 'skippable'];
Expand Down Expand Up @@ -176,8 +177,25 @@ export const spec = {
return bids;
},

getUserSyncs: function () {
return [];
getUserSyncs: function(syncOptions, serverResponses, gdprConsent = {}, uspConsent = '') {
const syncs = [];
const gdprFlag = `&gdpr=${gdprConsent.gdprApplies ? 1 : 0}`;
const gdprString = `&gdpr_consent=${encodeURIComponent((gdprConsent.consentString || ''))}`;
const usPrivacy = `us_privacy=${encodeURIComponent(uspConsent)}`;
const pbCookieAssistSyncUrl = `${PB_COOKIE_ASSIST_SYNC_ENDPOINT}?${usPrivacy}${gdprFlag}${gdprString}`;

if (syncOptions.iframeEnabled) {
syncs.push({
type: 'iframe',
url: pbCookieAssistSyncUrl + '&type=iframe'
});
} else if (syncOptions.pixelEnabled) {
syncs.push({
type: 'image',
url: pbCookieAssistSyncUrl + '&type=image'
});
}
return syncs;
}
};
registerBidder(spec);
Expand Down
17 changes: 15 additions & 2 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as utils from 'src/utils.js';
describe('YieldmoAdapter', function () {
const BANNER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebid';
const VIDEO_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebidvideo';
const PB_COOKIE_ASSIST_SYNC_ENDPOINT = `https://ads.yieldmo.com/pbcas`;

const mockBannerBid = (rootParams = {}, params = {}) => ({
bidder: 'yieldmo',
Expand Down Expand Up @@ -606,8 +607,20 @@ describe('YieldmoAdapter', function () {
});

describe('getUserSync', function () {
it('should return a tracker with type and url as parameters', function () {
expect(spec.getUserSyncs()).to.deep.equal([]);
const gdprFlag = `&gdpr=0`;
const usPrivacy = `us_privacy=`;
const gdprString = `&gdpr_consent=`;
const pbCookieAssistSyncUrl = `${PB_COOKIE_ASSIST_SYNC_ENDPOINT}?${usPrivacy}${gdprFlag}${gdprString}`;
it('should use type iframe when iframeEnabled', function() {
const syncs = spec.getUserSyncs({iframeEnabled: true});
expect(syncs).to.deep.equal([{type: 'iframe', url: pbCookieAssistSyncUrl + '&type=iframe'}])
});
it('should use type image when pixelEnabled', function() {
const syncs = spec.getUserSyncs({pixelEnabled: true});
expect(syncs).to.deep.equal([{type: 'image', url: pbCookieAssistSyncUrl + '&type=image'}])
});
it('should register no syncs', function () {
expect(spec.getUserSyncs({})).to.deep.equal([]);
});
});
});