diff --git a/modules/smartyadsBidAdapter.js b/modules/smartyadsBidAdapter.js index 610617155ed..9c38cb89492 100644 --- a/modules/smartyadsBidAdapter.js +++ b/modules/smartyadsBidAdapter.js @@ -4,8 +4,8 @@ import { config } from '../src/config.js'; import * as utils from '../src/utils.js'; const BIDDER_CODE = 'smartyads'; -const AD_URL = 'https://ssp-nj.webtradehub.com/?c=o&m=multi'; -const URL_SYNC = 'https://ssp-nj.webtradehub.com/?c=o&m=cookie'; +const AD_URL = 'https://n1.smartyads.com/?c=o&m=prebid&secret_key=prebid_js'; +const URL_SYNC = 'https://as.ck-ie.com/prebidjs?p=7c47322e527cf8bdeb7facc1bb03387a'; function isBidResponseValid(bid) { if (!bid.requestId || !bid.cpm || !bid.creativeId || @@ -29,7 +29,7 @@ export const spec = { supportedMediaTypes: [BANNER, VIDEO, NATIVE], isBidRequestValid: (bid) => { - return Boolean(bid.bidId && bid.params && !isNaN(bid.params.placementId)); + return Boolean(bid.bidId && bid.params && !isNaN(bid.params.sourceid) && !isNaN(bid.params.accountid) && bid.params.host == 'prebid'); }, buildRequests: (validBidRequests = [], bidderRequest) => { @@ -68,10 +68,11 @@ export const spec = { let bid = validBidRequests[i]; let traff = bid.params.traffic || BANNER placements.push({ - placementId: bid.params.placementId, + placementId: bid.params.sourceid, bidId: bid.bidId, sizes: bid.mediaTypes && bid.mediaTypes[traff] && bid.mediaTypes[traff].sizes ? bid.mediaTypes[traff].sizes : [], - traffic: traff + traffic: traff, + publisherId: bid.params.accountid }); if (bid.schain) { placements.schain = bid.schain; @@ -96,11 +97,23 @@ export const spec = { return response; }, - getUserSyncs: (syncOptions, serverResponses) => { - return [{ - type: 'image', - url: URL_SYNC - }]; + getUserSyncs: (syncOptions, serverResponses = [], gdprConsent = {}, uspConsent = '') => { + let syncs = []; + let { gdprApplies, consentString = '' } = gdprConsent; + + if (syncOptions.iframeEnabled) { + syncs.push({ + type: 'iframe', + url: `${URL_SYNC}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}&type=iframe&us_privacy=${uspConsent}` + }); + } else { + syncs.push({ + type: 'image', + url: `${URL_SYNC}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}&type=image&us_privacy=${uspConsent}` + }); + } + + return syncs } }; diff --git a/modules/smartyadsBidAdapter.md b/modules/smartyadsBidAdapter.md index 4fe4d51a2e6..f078d905e62 100644 --- a/modules/smartyadsBidAdapter.md +++ b/modules/smartyadsBidAdapter.md @@ -23,7 +23,9 @@ Module that connects to SmartyAds' demand sources { bidder: 'smartyads', params: { - placementId: 0, + host: 'prebid', + sourceid: '0', + accountid: '0', traffic: 'native' } } @@ -41,7 +43,9 @@ Module that connects to SmartyAds' demand sources { bidder: 'smartyads', params: { - placementId: 0, + host: 'prebid', + sourceid: '0', + accountid: '0', traffic: 'banner' } } @@ -60,7 +64,9 @@ Module that connects to SmartyAds' demand sources { bidder: 'smartyads', params: { - placementId: 0, + host: 'prebid', + sourceid: '0', + accountid: '0', traffic: 'video' } } diff --git a/test/spec/modules/smartyadsBidAdapter_spec.js b/test/spec/modules/smartyadsBidAdapter_spec.js index 14363329a9e..3474753c838 100644 --- a/test/spec/modules/smartyadsBidAdapter_spec.js +++ b/test/spec/modules/smartyadsBidAdapter_spec.js @@ -7,17 +7,19 @@ describe('SmartyadsAdapter', function () { bidId: '23fhj33i987f', bidder: 'smartyads', params: { - placementId: 0, + host: 'prebid', + sourceid: '0', + accountid: '0', traffic: 'banner' } }; describe('isBidRequestValid', function () { - it('Should return true if there are bidId, params and placementId parameters present', function () { + it('Should return true if there are bidId, params and sourceid parameters present', function () { expect(spec.isBidRequestValid(bid)).to.be.true; }); it('Should return false if at least one of parameters is not present', function () { - delete bid.params.placementId; + delete bid.params.sourceid; expect(spec.isBidRequestValid(bid)).to.be.false; }); }); @@ -34,7 +36,7 @@ describe('SmartyadsAdapter', function () { expect(serverRequest.method).to.equal('POST'); }); it('Returns valid URL', function () { - expect(serverRequest.url).to.equal('https://ssp-nj.webtradehub.com/?c=o&m=multi'); + expect(serverRequest.url).to.equal('https://n1.smartyads.com/?c=o&m=prebid&secret_key=prebid_js'); }); it('Returns valid data if array of bids is valid', function () { let data = serverRequest.data; @@ -48,8 +50,8 @@ describe('SmartyadsAdapter', function () { expect(data.host).to.be.a('string'); expect(data.page).to.be.a('string'); let placement = data['placements'][0]; - expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'sizes'); - expect(placement.placementId).to.equal(0); + expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'sizes', 'publisherId'); + expect(placement.placementId).to.equal('0'); expect(placement.bidId).to.equal('23fhj33i987f'); expect(placement.traffic).to.equal('banner'); }); @@ -241,13 +243,18 @@ describe('SmartyadsAdapter', function () { }); }); describe('getUserSyncs', function () { - let userSync = spec.getUserSyncs(); + const syncUrl = 'https://as.ck-ie.com/prebidjs?p=7c47322e527cf8bdeb7facc1bb03387a&gdpr=0&gdpr_consent=&type=iframe&us_privacy='; + const syncOptions = { + iframeEnabled: true + }; + let userSync = spec.getUserSyncs(syncOptions); it('Returns valid URL and type', function () { expect(userSync).to.be.an('array').with.lengthOf(1); expect(userSync[0].type).to.exist; expect(userSync[0].url).to.exist; - expect(userSync[0].type).to.be.equal('image'); - expect(userSync[0].url).to.be.equal('https://ssp-nj.webtradehub.com/?c=o&m=cookie'); + expect(userSync).to.deep.equal([ + { type: 'iframe', url: syncUrl } + ]); }); }); });