Skip to content

Commit

Permalink
Freewheel SSP Bid Adapter : support userIdAsEids (#9655)
Browse files Browse the repository at this point in the history
* FreeWheel add floor price

* FreeWheel code update

* FreeWheel-SSP-Adapter: Update to use Vast 4.2 by default

* FreeWheel-SSP-Adapter add userIdAsEids support

* Freewheel-SSP-Adapter add test for eids
  • Loading branch information
xwang202 authored Mar 14, 2023
1 parent 8adbfcd commit 69ca2a1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/freewheel-sspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,14 @@ export const spec = {
}
}

if (currentBidRequest.userIdAsEids && currentBidRequest.userIdAsEids.length > 0) {
try {
requestParams._fw_prebid_3p_UID = JSON.stringify(currentBidRequest.userIdAsEids);
} catch (error) {
logWarn('PREBID - ' + BIDDER_CODE + ': Unable to stringify the userIdAsEids: ' + error);
}
}

var vastParams = currentBidRequest.params.vastUrlParams;
if (typeof vastParams === 'object') {
for (var key in vastParams) {
Expand Down
17 changes: 17 additions & 0 deletions test/spec/modules/freewheel-sspBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from 'chai';
import { spec } from 'modules/freewheel-sspBidAdapter.js';
import { newBidder } from 'src/adapters/bidderFactory.js';
import { createEidsArray } from 'modules/userId/eids.js';

const ENDPOINT = '//ads.stickyadstv.com/www/delivery/swfIndex.php';

Expand Down Expand Up @@ -131,6 +132,22 @@ describe('freewheelSSP BidAdapter Test', () => {
expect(payload._fw_bidfloorcur).to.deep.equal('USD');
});

it('should pass 3rd party IDs with the request when present', function () {
const bidRequest = bidRequests[0];
bidRequest.userIdAsEids = createEidsArray({
tdid: 'TTD_ID_FROM_USER_ID_MODULE',
admixerId: 'admixerId_FROM_USER_ID_MODULE',
adtelligentId: 'adtelligentId_FROM_USER_ID_MODULE'
});
const request = spec.buildRequests(bidRequests);
const payload = request[0].data;
expect(payload._fw_prebid_3p_UID).to.deep.equal(JSON.stringify([
{source: 'adserver.org', uids: [{id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: {rtiPartner: 'TDID'}}]},
{source: 'admixer.net', uids: [{id: 'admixerId_FROM_USER_ID_MODULE', atype: 3}]},
{source: 'adtelligent.com', uids: [{id: 'adtelligentId_FROM_USER_ID_MODULE', atype: 3}]},
]));
});

it('should return empty bidFloorCurrency when bidfloor <= 0', () => {
const bidRequest = bidRequests[0];
bidRequest.getFloor = () => ({ currency: 'USD', floor: -1 });
Expand Down

0 comments on commit 69ca2a1

Please sign in to comment.