Skip to content

Commit 20d2c93

Browse files
authored
Oubtrain Bid Adapter : netRevenue simplification (prebid#12888)
* netrevenue simplification * calculate NATIVE_ASSET_IDS instrad of hardcoding * char to int * fix test
1 parent 50fafb9 commit 20d2c93

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

modules/outbrainBidAdapter.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {Renderer} from '../src/Renderer.js';
1414
const BIDDER_CODE = 'outbrain';
1515
const GVLID = 164;
1616
const CURRENCY = 'USD';
17-
const NATIVE_ASSET_IDS = { 0: 'title', 2: 'icon', 3: 'image', 5: 'sponsoredBy', 4: 'body', 1: 'cta' };
1817
const NATIVE_PARAMS = {
1918
title: { id: 0, name: 'title' },
2019
icon: { id: 2, type: 1, name: 'img' },
@@ -23,6 +22,10 @@ const NATIVE_PARAMS = {
2322
body: { id: 4, name: 'data', type: 2 },
2423
cta: { id: 1, type: 12, name: 'data' }
2524
};
25+
const NATIVE_ASSET_IDS = Object.entries(NATIVE_PARAMS).reduce((acc, [key, value]) => {
26+
acc[value.id] = key;
27+
return acc;
28+
}, {});
2629
const OUTSTREAM_RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';
2730
const OB_USER_TOKEN_KEY = 'OB-USER-TOKEN';
2831

@@ -75,7 +78,6 @@ export const spec = {
7578
const timeout = bidderRequest.timeout;
7679

7780
const imps = validBidRequests.map((bid, id) => {
78-
bid.netRevenue = 'net';
7981
const imp = {
8082
id: id + 1 + ''
8183
}
@@ -193,7 +195,7 @@ export const spec = {
193195
cpm: bidResponse.price,
194196
creativeId: bidResponse.crid,
195197
ttl: 360,
196-
netRevenue: bid.netRevenue === 'net',
198+
netRevenue: true,
197199
currency: cur,
198200
mediaType: type,
199201
nurl: bidResponse.nurl,

test/spec/modules/outbrainBidAdapter_spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ describe('Outbrain Adapter', function () {
703703
cpm: 1.1,
704704
creativeId: '28023739',
705705
ttl: 360,
706-
netRevenue: false,
706+
netRevenue: true,
707707
currency: 'USD',
708708
mediaType: 'native',
709709
nurl: 'http://example.com/win/${AUCTION_PRICE}',
@@ -780,7 +780,7 @@ describe('Outbrain Adapter', function () {
780780
cpm: 1.1,
781781
creativeId: '29998660',
782782
ttl: 360,
783-
netRevenue: false,
783+
netRevenue: true,
784784
currency: 'USD',
785785
mediaType: 'banner',
786786
nurl: 'http://example.com/win/${AUCTION_PRICE}',
@@ -843,7 +843,7 @@ describe('Outbrain Adapter', function () {
843843
cpm: 1.1,
844844
creativeId: '29998660',
845845
ttl: 360,
846-
netRevenue: false,
846+
netRevenue: true,
847847
currency: 'USD',
848848
mediaType: 'video',
849849
nurl: 'http://example.com/win/${AUCTION_PRICE}',

0 commit comments

Comments
 (0)