Skip to content

Commit

Permalink
Vidazoo Bid Adapter: change max chunkSize to 20 & remove auctionId fr…
Browse files Browse the repository at this point in the history
…om payload (#10212)

* feat(module): multi size request

* fix getUserSyncs
added tests

* update(module): package-lock.json from master

* feat(module): VidazooBidAdapter - send top query params to server

* multi poc

* feat: added support for single request.

* feat: change to bids.

* change to if else

* Fixed test

* feat: change max chunkSize to 20.

* remove auctionId from payload.

---------

Co-authored-by: Udi Talias <[email protected]>
Co-authored-by: roman <[email protected]>
  • Loading branch information
3 people authored Jul 12, 2023
1 parent 361cf62 commit f606397
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
12 changes: 5 additions & 7 deletions modules/vidazooBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout
adUnitCode,
schain,
mediaTypes,
auctionId,
ortb2Imp,
bidderRequestId,
bidRequestsCount,
Expand Down Expand Up @@ -112,8 +111,6 @@ function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout
gpid: gpid,
cat: cat,
pagecat: pagecat,
// TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
auctionId: auctionId,
transactionId: ortb2Imp?.ext?.tid,
bidderRequestId: bidderRequestId,
bidRequestsCount: bidRequestsCount,
Expand Down Expand Up @@ -179,9 +176,9 @@ function buildSingleRequest(bidRequests, bidderRequest, topWindowUrl, bidderTime
const sizes = parseSizesInput(bid.sizes);
return buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout)
});
const CHUNK_SIZE = Math.min(10, config.getConfig('vidazoo.chunkSize') || 10);
const chunkSize = Math.min(20, config.getConfig('vidazoo.chunkSize') || 10);

const chunkedData = chunk(data, CHUNK_SIZE);
const chunkedData = chunk(data, chunkSize);
return chunkedData.map(chunk => {
return {
method: 'POST',
Expand Down Expand Up @@ -226,14 +223,15 @@ function buildRequests(validBidRequests, bidderRequest) {
const requests = [];

if (singleRequestMode) {
// We need to split the requests into banner and video requests
// banner bids are sent as a single request
const bannerBidRequests = validBidRequests.filter(bid => isArray(bid.mediaTypes) ? bid.mediaTypes.includes(BANNER) : bid.mediaTypes[BANNER] !== undefined);
if (bannerBidRequests.length > 0) {
const singleRequests = buildSingleRequest(bannerBidRequests, bidderRequest, topWindowUrl, bidderTimeout);
requests.push(...singleRequests);
}

// Video Logic
// video bids are sent as a single request for each bid

const videoBidRequests = validBidRequests.filter(bid => bid.mediaTypes[VIDEO] !== undefined);
videoBidRequests.forEach(validBidRequest => {
const sizes = parseSizesInput(validBidRequest.sizes);
Expand Down
5 changes: 0 additions & 5 deletions test/spec/modules/vidazooBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const BID = {
'placementCode': 'div-gpt-ad-1460505748561-0',
'sizes': [[300, 250], [300, 600]],
'bidderRequestId': '1fdb5ff1b6eaa7',
'auctionId': 'auction_id',
'bidRequestsCount': 4,
'bidderRequestsCount': 3,
'bidderWinsCount': 1,
Expand All @@ -64,7 +63,6 @@ const VIDEO_BID = {
tid: '56e184c6-bde9-497b-b9b9-cf47a61381ee',
}
},
'auctionId': 'auction_id',
'bidRequestsCount': 4,
'bidderRequestsCount': 3,
'bidderWinsCount': 1,
Expand Down Expand Up @@ -288,7 +286,6 @@ describe('VidazooBidAdapter', function () {
usPrivacy: 'consent_string',
gppString: 'gpp_string',
gppSid: [7],
auctionId: 'auction_id',
bidRequestsCount: 4,
bidderRequestsCount: 3,
bidderWinsCount: 1,
Expand Down Expand Up @@ -362,7 +359,6 @@ describe('VidazooBidAdapter', function () {
usPrivacy: 'consent_string',
gppString: 'gpp_string',
gppSid: [7],
auctionId: 'auction_id',
bidRequestsCount: 4,
bidderRequestsCount: 3,
bidderWinsCount: 1,
Expand Down Expand Up @@ -436,7 +432,6 @@ describe('VidazooBidAdapter', function () {
usPrivacy: 'consent_string',
gppString: 'gpp_string',
gppSid: [7],
auctionId: 'auction_id',
bidRequestsCount: 4,
bidderRequestsCount: 3,
bidderWinsCount: 1,
Expand Down

0 comments on commit f606397

Please sign in to comment.