Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit efbeaf0

Browse files
jbartek25faisalvssamiul-shanto
authored
Improve Digital adapter: custom creative renderer (prebid#7975)
* Feature Prebid First Party Data (#2) * HBT-166: Added PageCategory and Genre to request object from First-Party-Data * HBT-166: Added PageCategory and Genre to request object from First-Party-Data and Rewrite Test Cases * Update improvedigitalBidAdapter.js Version increased * Improve Digital COPPA support * Feature/razr integration (#3) Integrated RAZR rich creative renderer * Use renderer interface for Razr Co-authored-by: Faisal Islam <[email protected]> Co-authored-by: Samiul Amin Shanto <[email protected]> Co-authored-by: Faisal Islam <[email protected]>
1 parent 69de981 commit efbeaf0

File tree

2 files changed

+80
-2
lines changed

2 files changed

+80
-2
lines changed

modules/improvedigitalBidAdapter.js

+43-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { deepSetValue, logError, _each, getBidRequest, isNumber, isArray, deepAccess, isFn, isPlainObject, logWarn, getBidIdParameter, getUniqueIdentifierStr, isEmpty, isInteger, isStr } from '../src/utils.js';
1+
import { deepSetValue, logError, _each, getBidRequest, isNumber, isArray, deepAccess, isFn, isPlainObject, logWarn, getBidIdParameter, getUniqueIdentifierStr, isEmpty, isInteger, isStr, mergeDeep } from '../src/utils.js';
22
import { registerBidder } from '../src/adapters/bidderFactory.js';
33
import { config } from '../src/config.js';
44
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
@@ -10,8 +10,44 @@ const BIDDER_CODE = 'improvedigital';
1010
const RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';
1111
const VIDEO_TARGETING = ['skip', 'skipmin', 'skipafter'];
1212

13+
const ID_RAZR = {
14+
RENDERER_URL: 'https://razr.improvedigital.com/renderer.js',
15+
addBidData({bid, bidRequest}) {
16+
if (this.isValidBid(bid)) {
17+
bid.renderer = Renderer.install({
18+
url: this.RENDERER_URL,
19+
config: {bidRequest}
20+
});
21+
bid.renderer.setRender(this.render);
22+
}
23+
},
24+
25+
isValidBid(bid) {
26+
return bid && /razr:\\?\/\\?\//.test(bid.ad);
27+
},
28+
29+
render(bid) {
30+
const {bidRequest} = bid.renderer.getConfig();
31+
32+
const payload = {
33+
type: 'prebid',
34+
bidRequest,
35+
bid,
36+
config: mergeDeep(
37+
{},
38+
config.getConfig('improvedigital.rendererConfig'),
39+
deepAccess(bidRequest, 'params.rendererConfig')
40+
)
41+
};
42+
43+
const razr = window.razr = window.razr || {};
44+
razr.queue = razr.queue || [];
45+
razr.queue.push(payload);
46+
}
47+
};
48+
1349
export const spec = {
14-
version: '7.6.0',
50+
version: '7.7.0',
1551
code: BIDDER_CODE,
1652
gvlid: 253,
1753
aliases: ['id'],
@@ -197,6 +233,11 @@ export const spec = {
197233
};
198234
}
199235

236+
ID_RAZR.addBidData({
237+
bidRequest,
238+
bid
239+
});
240+
200241
bids.push(bid);
201242
});
202243
return bids;

test/spec/modules/improvedigitalBidAdapter_spec.js

+37
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,33 @@ describe('Improve Digital Adapter Tests', function () {
605605
}
606606
};
607607

608+
const serverResponseRazr = {
609+
'body': {
610+
'id': '687a06c541d8d1',
611+
'site_id': 191642,
612+
'bid': [
613+
{
614+
'isNet': false,
615+
'id': '33e9500b21129f',
616+
'advid': '5279',
617+
'price': 1.45888594164456,
618+
'nurl': 'https://ice.360yield.com/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=',
619+
'h': 290,
620+
'pid': 1053688,
621+
'sync': [
622+
'https://link1',
623+
'https://link2'
624+
],
625+
'crid': '422031',
626+
'w': 600,
627+
'cid': '99006',
628+
'adm': 'document.writeln("<script async src=\"https:\/\/cdn.inskinad.com\/isfe\/tags\/dsp.js\"><\/script>\n<script type=\"text\/javascript\">\n (function() {\n var ns = window.inskin = window.inskin || {};\n ns.dsp = ns.dsp || [];\n ns.dsp.push({\n uri: \"razr:\/\/provider\/format\"\n });\n })();\n<\/script>");document.writeln("<improvedigital_ad_output_information tp_id=\"\" buyer_id=\"0\" rtb_advertiser=\"\" campaign_id=\"123456\" line_item_id=\"123456\" creative_id=\"123456\" crid=\"0\" placement_id=\"123456\"><\/improvedigital_ad_output_information>");'
629+
}
630+
],
631+
'debug': ''
632+
}
633+
};
634+
608635
const serverResponseTwoBids = {
609636
'body': {
610637
'id': '687a06c541d8d1',
@@ -1072,6 +1099,16 @@ describe('Improve Digital Adapter Tests', function () {
10721099
delete (bids[0].renderer);
10731100
expect(bids).to.deep.equal(expectedBidOutstreamVideo);
10741101
});
1102+
1103+
it('should not affect non-RAZR bids', function () {
1104+
const bids = spec.interpretResponse(serverResponse, {bidderRequest});
1105+
expect(bids[0].renderer).to.not.exist;
1106+
});
1107+
1108+
it('should detect RAZR bids', function () {
1109+
const bids = spec.interpretResponse(serverResponseRazr, {bidderRequest});
1110+
expect(bids[0].renderer).to.exist;
1111+
});
10751112
});
10761113

10771114
describe('getUserSyncs', function () {

0 commit comments

Comments
 (0)