Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoBid Bid Adapter: add support for config.ortb2 #7503

Merged
merged 25 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0eba11e
Enable supplyChain support
redaguermas Mar 4, 2020
c0fb8ee
Added support for COPPA
redaguermas Mar 5, 2020
36fab76
Merge branch 'master' of https://github.com/prebid/Prebid.js
redaguermas Mar 13, 2020
51525d7
Merge branch 'master' of https://github.com/prebid/Prebid.js
redaguermas Apr 13, 2020
c473780
Merge remote-tracking branch 'upstream/master'
Jun 1, 2020
33757b8
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jun 4, 2020
9e1758b
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jun 19, 2020
1d7db5d
Merge branch 'master' of https://github.com/prebid/Prebid.js
Aug 18, 2020
8fca715
Merge branch 'master' of https://github.com/prebid/Prebid.js
Aug 26, 2020
c11a5b3
rebuilt
Sep 27, 2020
c44bd3f
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 27, 2020
9c8440c
Added support for Extended User IDs.
Sep 28, 2020
ec5cde7
Merge branch 'master' of https://github.com/prebid/Prebid.js
May 28, 2021
ff10bbe
Added support for the "meta" attribute in bid response.
May 28, 2021
4a4c253
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jul 13, 2021
01a2d94
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 27, 2021
beda7fd
Added support for config.ortb2.
Sep 28, 2021
bd62795
Delete nobidBidAdapter.js.orig
redaguermas Sep 30, 2021
cd1877b
Delete .project
redaguermas Sep 30, 2021
4a61d38
Delete .jsdtscope
redaguermas Sep 30, 2021
10cb527
Delete org.eclipse.wst.jsdt.ui.superType.container
redaguermas Sep 30, 2021
4e1af5e
Delete org.eclipse.wst.jsdt.ui.superType.name
redaguermas Sep 30, 2021
5f4db0b
Delete a
redaguermas Sep 30, 2021
1397422
Tests for "ortb2" support.
Oct 5, 2021
d9c2990
Merge branch 'NoBid-version-1.3.2' of https://github.com/redaguermas/…
Oct 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/nobidBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getStorageManager } from '../src/storageManager.js';
const GVLID = 816;
const BIDDER_CODE = 'nobid';
const storage = getStorageManager(GVLID, BIDDER_CODE);
window.nobidVersion = '1.3.1';
window.nobidVersion = '1.3.2';
window.nobid = window.nobid || {};
window.nobid.bidResponses = window.nobid.bidResponses || {};
window.nobid.timeoutTotal = 0;
Expand Down Expand Up @@ -152,6 +152,7 @@ function nobidBuildRequests(bids, bidderRequest) {
if (cop) state['coppa'] = cop;
const eids = getEIDs(utils.deepAccess(bids, '0.userIdAsEids'));
if (eids && eids.length > 0) state['eids'] = eids;
if (config && config.getConfig('ortb2')) state['ortb2'] = config.getConfig('ortb2');
return state;
}
function newAdunit(adunitObject, adunits) {
Expand Down
66 changes: 65 additions & 1 deletion test/spec/modules/nobidBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai';
import * as utils from 'src/utils.js';
import { spec } from 'modules/nobidBidAdapter.js';
import { newBidder } from 'src/adapters/bidderFactory.js';
import { config } from 'src/config.js';
import * as bidderFactory from 'src/adapters/bidderFactory.js';

describe('Nobid Adapter', function () {
Expand Down Expand Up @@ -50,6 +51,70 @@ describe('Nobid Adapter', function () {
});
});

describe('Request with ORTB2', function () {
const SITE_ID = 2;
const REFERER = 'https://www.examplereferer.com';
const BIDDER_CODE = 'duration';
let bidRequests = [
{
'bidder': BIDDER_CODE,
'params': {
'siteId': SITE_ID
},
'adUnitCode': 'adunit-code',
'sizes': [[300, 250]],
'bidId': '30b31c1838de1e',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
}
];

let bidderRequest = {
refererInfo: {referer: REFERER}, bidderCode: BIDDER_CODE
}

const siteName = 'example';
const siteDomain = 'page.example.com';
const sitePage = 'https://page.example.com/here.html';
const siteRef = 'https://ref.example.com';
const siteKeywords = 'power tools, drills';
const siteSearch = 'drill';
const siteCat = 'IAB2';
const siteSectionCat = 'IAB2-2';
const sitePageCat = 'IAB2-12';

it('ortb2 should exist', function () {
config.setConfig({
ortb2: {
site: {
name: siteName,
domain: siteDomain,
cat: [ siteCat ],
sectioncat: [ siteSectionCat ],
pagecat: [ sitePageCat ],
page: sitePage,
ref: siteRef,
keywords: siteKeywords,
search: siteSearch
}
}
});
const request = spec.buildRequests(bidRequests, bidderRequest);
let payload = JSON.parse(request.data);
payload = JSON.parse(JSON.stringify(payload));
expect(payload.sid).to.equal(SITE_ID);
expect(payload.ortb2.site.name).to.equal(siteName);
expect(payload.ortb2.site.domain).to.equal(siteDomain);
expect(payload.ortb2.site.page).to.equal(sitePage);
expect(payload.ortb2.site.ref).to.equal(siteRef);
expect(payload.ortb2.site.keywords).to.equal(siteKeywords);
expect(payload.ortb2.site.search).to.equal(siteSearch);
expect(payload.ortb2.site.cat[0]).to.equal(siteCat);
expect(payload.ortb2.site.sectioncat[0]).to.equal(siteSectionCat);
expect(payload.ortb2.site.pagecat[0]).to.equal(sitePageCat);
});
});

describe('isDurationBidRequestValid', function () {
const SITE_ID = 2;
const REFERER = 'https://www.examplereferer.com';
Expand Down Expand Up @@ -255,7 +320,6 @@ describe('Nobid Adapter', function () {
expect(payload.a).to.exist;
expect(payload.t).to.exist;
expect(payload.tz).to.exist;
expect(payload.r).to.exist.and.to.equal('100x100');
expect(payload.lang).to.exist;
expect(payload.ref).to.exist;
expect(payload.a[0].d).to.exist.and.to.equal('adunit-code');
Expand Down