Skip to content

Commit

Permalink
Jixie Bid Adapter: add support for advertiserDomains (#6898)
Browse files Browse the repository at this point in the history
* Adapter does not seem capable of supporting advertiserDomains #6650
added response comment and some trivial code.

* removed a blank line at the end of file
added a space behind the // in comments

* in response to comment from reviewer. add the aspect of advertiserdomain in unit tests
  • Loading branch information
jxdeveloper1 authored Jun 2, 2021
1 parent a259700 commit 481b94f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions modules/jixieBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,16 @@ export const spec = {
let rendererScript = (oneBid.osparams.script ? oneBid.osparams.script : JX_OUTSTREAM_RENDERER_URL);
bnd.renderer = createRenderer_(oneBid, rendererScript, jxOutstreamRender_);
}
// a note on advertiserDomains: our adserver is not responding in
// openRTB-type json. so there is no need to copy from 'adomain' over
// to meta: advertiserDomains
// However, we will just make sure the property is there.
if (!bnd.meta) {
bnd.meta = {};
}
if (!bnd.meta.advertiserDomains) {
bnd.meta.advertiserDomains = [];
}
bidResponses.push(bnd);
});
if (response.body.setids) {
Expand Down
9 changes: 8 additions & 1 deletion test/spec/modules/jixieBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ describe('jixie Adapter', function () {
},
'vastUrl': 'https://ad.jixie.io/v1/video?creativeid=522'
},
// display ad returned here:
// display ad returned here: This one there is advertiserDomains
// in the response . Will be checked in the unit tests below
{
'trackingUrlBase': 'https://tr.jixie.io/sync/ad?',
'jxBidId': '600c9ae6fda1acb-028d5dee-2c83-44e3-bed1-b75002475cdf',
Expand Down Expand Up @@ -411,6 +412,9 @@ describe('jixie Adapter', function () {
expect(result[0].ttl).to.equal(300)
expect(result[0].vastUrl).to.include('https://ad.jixie.io/v1/video?creativeid=')
expect(result[0].trackingUrlBase).to.include('sync')
// We will always make sure the meta->advertiserDomains property is there
// If no info it is an empty array.
expect(result[0].meta.advertiserDomains.length).to.equal(0)

// display ad
expect(result[1].requestId).to.equal('600c9ae6fda1acb')
Expand All @@ -422,6 +426,7 @@ describe('jixie Adapter', function () {
expect(result[1].netRevenue).to.equal(true)
expect(result[1].ttl).to.equal(300)
expect(result[1].ad).to.include('jxoutstream')
expect(result[1].meta.advertiserDomains.length).to.equal(3)
expect(result[1].trackingUrlBase).to.include('sync')

// should pick up about using alternative outstream renderer
Expand All @@ -436,6 +441,7 @@ describe('jixie Adapter', function () {
expect(result[2].vastXml).to.include('<?xml version="1.0" encoding="UTF-8"?>')
expect(result[2].trackingUrlBase).to.include('sync');
expect(result[2].renderer.id).to.equal('demoslot4-div')
expect(result[2].meta.advertiserDomains.length).to.equal(0)
expect(result[2].renderer.url).to.equal(JX_OTHER_OUTSTREAM_RENDERER_URL);

// should know to use default outstream renderer
Expand All @@ -450,6 +456,7 @@ describe('jixie Adapter', function () {
expect(result[3].vastXml).to.include('<?xml version="1.0" encoding="UTF-8"?>')
expect(result[3].trackingUrlBase).to.include('sync');
expect(result[3].renderer.id).to.equal('demoslot2-div')
expect(result[3].meta.advertiserDomains.length).to.equal(0)
expect(result[3].renderer.url).to.equal(JX_OUTSTREAM_RENDERER_URL)

setLocalStorageSpy.restore();
Expand Down

0 comments on commit 481b94f

Please sign in to comment.