Skip to content

Commit f5d6439

Browse files
AcuityAdsIntegrationsKanceliarenko
andauthored
Acuity Bid Adapter : handle publisher id (prebid#13508)
* add prebid.js adapter * changes * changes * changes * changes * fix downolad * add gpp * Merge remote-tracking branch 'prebid/master' * add gvlid * add endpointId param * add publisherId to placement * fix import issue --------- Co-authored-by: Kanceliarenko <kostiantyn.k@teqblaze.com>
1 parent 6c605b8 commit f5d6439

3 files changed

Lines changed: 75 additions & 4 deletions

File tree

modules/acuityadsBidAdapter.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
11
import { registerBidder } from '../src/adapters/bidderFactory.js';
22
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
3-
import { isBidRequestValid, buildRequests, interpretResponse, getUserSyncs } from '../libraries/teqblazeUtils/bidderUtils.js';
3+
import {
4+
isBidRequestValid,
5+
buildRequestsBase,
6+
interpretResponse,
7+
getUserSyncs,
8+
buildPlacementProcessingFunction
9+
} from '../libraries/teqblazeUtils/bidderUtils.js';
410

511
const BIDDER_CODE = 'acuityads';
612
const GVLID = 231;
713
const AD_URL = 'https://prebid.admanmedia.com/pbjs';
814
const SYNC_URL = 'https://cs.admanmedia.com';
915

16+
const addCustomFieldsToPlacement = (bid, bidderRequest, placement) => {
17+
placement.publisherId = bid.params.publisherId || '';
18+
};
19+
20+
const placementProcessingFunction = buildPlacementProcessingFunction({ addCustomFieldsToPlacement });
21+
22+
const buildRequests = (validBidRequests = [], bidderRequest = {}) => {
23+
return buildRequestsBase({ adUrl: AD_URL, validBidRequests, bidderRequest, placementProcessingFunction });
24+
};
25+
1026
export const spec = {
1127
code: BIDDER_CODE,
1228
gvlid: GVLID,
1329
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
1430

1531
isBidRequestValid: isBidRequestValid(),
16-
buildRequests: buildRequests(AD_URL),
32+
buildRequests,
1733
interpretResponse,
1834
getUserSyncs: getUserSyncs(SYNC_URL)
1935
};

modules/acuityadsBidAdapter.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ AcuityAds bid adapter supports Banner, Video (instream and outstream) and Native
2727
bidder: 'acuityads',
2828
params: {
2929
placementId: 'testBanner',
30-
}
30+
endpointId: 'testBanner',
31+
publisherId: 'testBanner',
3132
}
3233
]
3334
},
@@ -46,6 +47,8 @@ AcuityAds bid adapter supports Banner, Video (instream and outstream) and Native
4647
bidder: 'acuityads',
4748
params: {
4849
placementId: 'testVideo',
50+
endpointId: 'testVideo',
51+
publisherId: 'testVideo',
4952
}
5053
}
5154
]
@@ -71,9 +74,11 @@ AcuityAds bid adapter supports Banner, Video (instream and outstream) and Native
7174
bidder: 'acuityads',
7275
params: {
7376
placementId: 'testNative',
77+
endpointId: 'testNative',
78+
publisherId: 'testNative',
7479
}
7580
}
7681
]
7782
}
7883
];
79-
```
84+
```

test/spec/modules/acuityadsBidAdapter_spec.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,56 @@ describe('AcuityAdsBidAdapter', function () {
175175
expect(placement.bidfloor).to.exist.and.to.equal(0);
176176
expect(placement.type).to.exist.and.to.equal('publisher');
177177
expect(placement.eids).to.exist.and.to.be.deep.equal(userIdAsEids);
178+
expect(placement.publisherId).to.exist.and.to.be.a('string');
179+
180+
if (placement.adFormat === BANNER) {
181+
expect(placement.sizes).to.be.an('array');
182+
}
183+
switch (placement.adFormat) {
184+
case BANNER:
185+
expect(placement.sizes).to.be.an('array');
186+
break;
187+
case VIDEO:
188+
expect(placement.playerSize).to.be.an('array');
189+
expect(placement.minduration).to.be.an('number');
190+
expect(placement.maxduration).to.be.an('number');
191+
break;
192+
case NATIVE:
193+
expect(placement.native).to.be.an('object');
194+
break;
195+
}
196+
}
197+
});
198+
199+
it('Returns valid endpoints', function () {
200+
const bids = [
201+
{
202+
bidId: getUniqueIdentifierStr(),
203+
bidder: bidder,
204+
mediaTypes: {
205+
[BANNER]: {
206+
sizes: [[300, 250]]
207+
}
208+
},
209+
params: {
210+
endpointId: 'testBanner',
211+
},
212+
userIdAsEids
213+
}
214+
];
215+
216+
let serverRequest = spec.buildRequests(bids, bidderRequest);
217+
218+
const { placements } = serverRequest.data;
219+
for (let i = 0, len = placements.length; i < len; i++) {
220+
const placement = placements[i];
221+
expect(placement.endpointId).to.be.oneOf(['testBanner', 'testVideo', 'testNative']);
222+
expect(placement.adFormat).to.be.oneOf([BANNER, VIDEO, NATIVE]);
223+
expect(placement.bidId).to.be.a('string');
224+
expect(placement.schain).to.be.an('object');
225+
expect(placement.bidfloor).to.exist.and.to.equal(0);
226+
expect(placement.type).to.exist.and.to.equal('network');
227+
expect(placement.eids).to.exist.and.to.be.deep.equal(userIdAsEids);
178228

179229
if (placement.adFormat === BANNER) {
180230
expect(placement.sizes).to.be.an('array');

0 commit comments

Comments
 (0)