Skip to content

Commit

Permalink
Vidazoo Bid Adapter : more ortb2 data and fledge support (prebid#11182)
Browse files Browse the repository at this point in the history
* Pass ortb2 content data and user data to server.

* Pass ortb2 content data and user data to server.

* added fledge flag to to request
  • Loading branch information
saar120 authored Mar 7, 2024
1 parent 0bb0df1 commit 48e88f3
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 2 deletions.
11 changes: 11 additions & 0 deletions modules/vidazooBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout
const gpid = deepAccess(bid, 'ortb2Imp.ext.gpid', deepAccess(bid, 'ortb2Imp.ext.data.pbadslot', ''));
const cat = deepAccess(bidderRequest, 'ortb2.site.cat', []);
const pagecat = deepAccess(bidderRequest, 'ortb2.site.pagecat', []);
const contentData = deepAccess(bidderRequest, 'ortb2.site.content.data', []);
const userData = deepAccess(bidderRequest, 'ortb2.user.data', []);

if (isFn(bid.getFloor)) {
const floorInfo = bid.getFloor({
Expand Down Expand Up @@ -121,6 +123,8 @@ function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout
isStorageAllowed: isStorageAllowed,
gpid: gpid,
cat: cat,
contentData,
userData: userData,
pagecat: pagecat,
transactionId: ortb2Imp?.ext?.tid,
bidderRequestId: bidderRequestId,
Expand Down Expand Up @@ -159,6 +163,13 @@ function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout
data.gppSid = bidderRequest.ortb2.regs.gpp_sid;
}

if (bidderRequest.fledgeEnabled) {
const fledge = deepAccess(bidderRequest, 'ortb2Imp.ext.ae');
if (fledge) {
data.fledge = fledge;
}
}

_each(ext, (value, key) => {
data['ext.' + key] = value;
});
Expand Down
87 changes: 85 additions & 2 deletions test/spec/modules/vidazooBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {version} from 'package.json';
import {useFakeTimers} from 'sinon';
import {BANNER, VIDEO} from '../../../src/mediaTypes';
import {config} from '../../../src/config';
import {deepSetValue} from 'src/utils.js';

export const TEST_ID_SYSTEMS = ['britepoolid', 'criteoId', 'id5id', 'idl_env', 'lipb', 'netId', 'parrableId', 'pubcid', 'tdid', 'pubProvidedId'];

Expand Down Expand Up @@ -108,7 +109,19 @@ const BIDDER_REQUEST = {
'ortb2': {
'site': {
'cat': ['IAB2'],
'pagecat': ['IAB2-2']
'pagecat': ['IAB2-2'],
'content': {
'data': [{
'name': 'example.com',
'ext': {
'segtax': 7
},
'segments': [
{'id': 'segId1'},
{'id': 'segId2'}
]
}]
}
},
'regs': {
'gpp': 'gpp_string',
Expand All @@ -131,6 +144,15 @@ const BIDDER_REQUEST = {
'bitness': '64',
'architecture': ''
}
},
user: {
data: [
{
ext: {segtax: 600, segclass: '1'},
name: 'example.com',
segment: [{id: '243'}],
},
],
}
},
};
Expand Down Expand Up @@ -318,6 +340,23 @@ describe('VidazooBidAdapter', function () {
'bitness': '64',
'architecture': ''
},
contentData: [{
'name': 'example.com',
'ext': {
'segtax': 7
},
'segments': [
{'id': 'segId1'},
{'id': 'segId2'}
]
}],
userData: [
{
ext: {segtax: 600, segclass: '1'},
name: 'example.com',
segment: [{id: '243'}],
},
],
uniqueDealId: `${hashUrl}_${Date.now().toString()}`,
uqs: getTopWindowQueryParams(),
isStorageAllowed: true,
Expand All @@ -340,7 +379,8 @@ describe('VidazooBidAdapter', function () {
}
}
}
});
})
;
});

it('should build banner request for each size', function () {
Expand Down Expand Up @@ -405,6 +445,23 @@ describe('VidazooBidAdapter', function () {
gpid: '1234567890',
cat: ['IAB2'],
pagecat: ['IAB2-2'],
contentData: [{
'name': 'example.com',
'ext': {
'segtax': 7
},
'segments': [
{'id': 'segId1'},
{'id': 'segId2'}
]
}],
userData: [
{
ext: {segtax: 600, segclass: '1'},
name: 'example.com',
segment: [{id: '243'}],
},
],
webSessionId: webSessionId
}
});
Expand Down Expand Up @@ -478,6 +535,23 @@ describe('VidazooBidAdapter', function () {
gpid: '1234567890',
cat: ['IAB2'],
pagecat: ['IAB2-2'],
contentData: [{
'name': 'example.com',
'ext': {
'segtax': 7
},
'segments': [
{'id': 'segId1'},
{'id': 'segId2'}
]
}],
userData: [
{
ext: {segtax: 600, segclass: '1'},
name: 'example.com',
segment: [{id: '243'}],
},
],
webSessionId: webSessionId
};

Expand Down Expand Up @@ -523,6 +597,15 @@ describe('VidazooBidAdapter', function () {
expect(requests).to.have.length(2);
});

it('should set fledge correctly if enabled', function () {
config.resetConfig();
const bidderRequest = utils.deepClone(BIDDER_REQUEST);
bidderRequest.fledgeEnabled = true;
deepSetValue(bidderRequest, 'ortb2Imp.ext.ae', 1);
const requests = adapter.buildRequests([BID], bidderRequest);
expect(requests[0].data.fledge).to.equal(1);
});

after(function () {
$$PREBID_GLOBAL$$.bidderSettings = {};
config.resetConfig();
Expand Down

0 comments on commit 48e88f3

Please sign in to comment.