Skip to content

Commit

Permalink
convert bidders: deltaprojects
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 20, 2022
1 parent ce45157 commit 7f5c15a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
3 changes: 1 addition & 2 deletions modules/cwireBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {getRefererInfo} from '../src/refererDetection.js';
import {getStorageManager} from '../src/storageManager.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {OUTSTREAM} from '../src/video.js';
Expand Down Expand Up @@ -170,7 +169,7 @@ export const spec = {
let slots = [];
let referer;
try {
referer = getRefererInfo().referer;
referer = bidderRequest?.refererInfo?.page;
slots = mapSlotsData(validBidRequests);
} catch (e) {
logWarn(e);
Expand Down
2 changes: 1 addition & 1 deletion modules/dailyhuntBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const flatten = (arr) => {
const createOrtbRequest = (validBidRequests, bidderRequest) => {
let device = createOrtbDeviceObj(validBidRequests);
let user = createOrtbUserObj(validBidRequests)
let site = createOrtbSiteObj(validBidRequests, bidderRequest.refererInfo.referer)
let site = createOrtbSiteObj(validBidRequests, bidderRequest.refererInfo.page)
return {
id: bidderRequest.auctionId,
imp: [],
Expand Down
5 changes: 3 additions & 2 deletions modules/datablocksBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,11 @@ export const spec = {
// GENERATE SITE OBJECT
let site = {
domain: window.location.host,
page: bidderRequest.refererInfo.referer,
// TODO: is 'page' the right value here?
page: bidderRequest.refererInfo.page,
schain: validRequests[0].schain || {},
ext: {
p_domain: config.getConfig('publisherDomain'),
p_domain: bidderRequest.refererInfo.domain,
rt: bidderRequest.refererInfo.reachedTop,
frames: bidderRequest.refererInfo.numIframes,
stack: bidderRequest.refererInfo.stack,
Expand Down
14 changes: 3 additions & 11 deletions modules/deepintentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,13 @@ function buildBanner(bid) {

function buildSite(bidderRequest) {
let site = {};
if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
site.page = bidderRequest.refererInfo.referer;
site.domain = getDomain(bidderRequest.refererInfo.referer);
if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
site.page = bidderRequest.refererInfo.page;
site.domain = bidderRequest.refererInfo.domain;
}
return site;
}

function getDomain(referer) {
if (referer) {
let domainA = document.createElement('a');
domainA.href = referer;
return domainA.hostname;
}
}

function buildDevice() {
return {
ua: navigator.userAgent,
Expand Down
7 changes: 3 additions & 4 deletions modules/deltaprojectsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ function buildRequests(validBidRequests, bidderRequest) {
const id = bidderRequest.auctionId;

// -- build site
const loc = parseUrl(bidderRequest.refererInfo.referer);
const publisherId = setOnAny(validBidRequests, 'params.publisherId');
const siteId = setOnAny(validBidRequests, 'params.siteId');
const site = {
id: siteId,
domain: loc.hostname,
page: loc.href,
ref: loc.href,
domain: bidderRequest.refererInfo.domain,
page: bidderRequest.refererInfo.page,
ref: bidderRequest.refererInfo.ref,
publisher: { id: publisherId },
};

Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/deltaprojectsBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from 'modules/deltaprojectsBidAdapter.js';

const BID_REQ_REFER = 'http://example.com/page?param=val';
const BID_REQ_DOMAIN = 'example.com'

describe('deltaprojectsBidAdapter', function() {
describe('isBidRequestValid', function () {
Expand Down Expand Up @@ -62,7 +63,7 @@ describe('deltaprojectsBidAdapter', function() {
auctionId: '1d1a030790a475',
}
const bidRequests = [BIDREQ];
const bannerRequest = spec.buildRequests(bidRequests, {refererInfo: { referer: BID_REQ_REFER }})[0];
const bannerRequest = spec.buildRequests(bidRequests, {refererInfo: { page: BID_REQ_REFER, domain: BID_REQ_DOMAIN }})[0];
const bannerRequestBody = bannerRequest.data;

it('send bid request with test tag if it is set in the param', function () {
Expand Down

0 comments on commit 7f5c15a

Please sign in to comment.