Skip to content

Commit

Permalink
jixie Bid Adapter : adding handling of userSync urls sent from server…
Browse files Browse the repository at this point in the history
… side (#11217)

* 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

* added the code to get the keywords from the meta tags if available.

* WIP

* cleaned up

* correcting formatting errors from circleci

* sending floor to our backend for each bid, when available, changed one of the 1st party cookies that we want to send to backend

* fixed spacing issues in code

* 1/ provide the possibility of using the jixie section of the config object to determine what ids to read from cookie and to send
2/ removed ontimeout handling
3/ bidwon just ping the trackingUrl, if any
4/ misc: sending aid (from jixie config if any), prebid version etc

* corrected formatting mistakes

* adding support of handling usersync array from the server side

* add back registerBidder line dropped accidentally

* fixed some formatting flaws

* correcting more formatting issues

* more formatting corrections
  • Loading branch information
jxdeveloper1 committed Mar 15, 2024
1 parent a7a8f74 commit d17c44b
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/jixieBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,21 @@ export const spec = {
}
return bidResponses;
} else { return []; }
},

getUserSyncs: function(syncOptions, serverResponses) {
if (!serverResponses.length || !serverResponses[0].body || !serverResponses[0].body.userSyncs) {
return false;
}
let syncs = [];
serverResponses[0].body.userSyncs.forEach(function(sync) {
if (syncOptions.iframeEnabled) {
syncs.push(sync.uf ? { url: sync.uf, type: 'iframe' } : { url: sync.up, type: 'image' });
} else if (syncOptions.pixelEnabled && sync.up) {
syncs.push({url: sync.up, type: 'image'})
}
})
return syncs;
}
}

Expand Down
63 changes: 63 additions & 0 deletions test/spec/modules/jixieBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,4 +707,67 @@ describe('jixie Adapter', function () {
expect(jixieaux.ajax.calledWith(TRACKINGURL_)).to.equal(true);
})
}); // describe

describe('getUserSyncs', function () {
it('it should favour iframe over pixel if publisher allows iframe usersync', function () {
const syncOptions = {
'iframeEnabled': true,
'pixelEnabled': true,
}
const response = {
'userSyncs': [
{
'uf': 'https://syncstuff.jixie.io/',
'up': 'https://syncstuff.jixie.io/image.gif'
},
{
'up': 'https://syncstuff.jixie.io/image1.gif'
}
]
}
let result = spec.getUserSyncs(syncOptions, [{ body: response }]);
expect(result[0].type).to.equal('iframe')
expect(result[1].type).to.equal('image')
})

it('it should pick pixel if publisher not allow iframe', function () {
const syncOptions = {
'iframeEnabled': false,
'pixelEnabled': true,
}
const response = {
'userSyncs': [
{
'uf': 'https://syncstuff.jixie.io/',
'up': 'https://syncstuff.jixie.io/image.gif'
},
{
'up': 'https://syncstuff.jixie.io/image1.gif'
}
]
}
let result = spec.getUserSyncs(syncOptions, [{ body: response }]);
expect(result[0].type).to.equal('image')
expect(result[1].type).to.equal('image')
})

it('it should return nothing if pub only allow pixel but all usersyncs are iframe only', function () {
const syncOptions = {
'iframeEnabled': false,
'pixelEnabled': true,
}
const response = {
'userSyncs': [
{
'uf': 'https://syncstuff.jixie.io/',
},
{
'uf': 'https://syncstuff2.jixie.io/',
}
]
}
let result = spec.getUserSyncs(syncOptions, [{ body: response }]);
expect(result.length).to.equal(0)
})
})
});

0 comments on commit d17c44b

Please sign in to comment.