Skip to content

Commit

Permalink
convert bidders: adloox
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 18, 2022
1 parent 43327a9 commit c614eca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ registerBidder(spec);
* @param refererInfo {refererInfo}
*/
function groupImpressionsByHostZone(bidRequests, refererInfo) {
let secure = (refererInfo && refererInfo.referer.indexOf('https:') === 0);
let secure = (refererInfo && refererInfo.page?.indexOf('https:') === 0);
return Object.values(
bidRequests.map(bidRequest => buildImp(bidRequest, secure))
.reduce((acc, curr, index) => {
Expand Down Expand Up @@ -535,14 +535,13 @@ function getLanguage() {
* Creates site description object
*/
function createSite(refInfo, fpd) {
let url = parseUrl(refInfo.referer);
let site = {
'domain': url.hostname,
'page': `${url.protocol}://${url.hostname}${url.pathname}`
'domain': refInfo.domain,
'page': refInfo.page
};
mergeDeep(site, fpd.site);
if (!inIframe() && document.referrer) {
site.ref = document.referrer;
if (refInfo.ref != null) {
site.ref = refInfo.ref;
} else {
delete site.ref;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/adlooxAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ MACRO['creatype'] = function(b, c) {
};
MACRO['pageurl'] = function(b, c) {
const refererInfo = getRefererInfo();
return (refererInfo.canonicalUrl || refererInfo.referer || '').substr(0, 300).split(/[?#]/)[0];
return (refererInfo.page || '').substr(0, 300).split(/[?#]/)[0];
};
MACRO['pbadslot'] = function(b, c) {
const adUnit = find(auctionManager.getAdUnits(), a => b.adUnitCode === a.code);
Expand Down
2 changes: 1 addition & 1 deletion modules/adlooxRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function getBidRequestData(reqBidsConfigObj, callback, config, userConsent) {
[ 'imp', config.params.imps ],
[ 'fc_ip', config.params.freqcap_ip ],
[ 'fc_ipua', config.params.freqcap_ipua ],
[ 'pn', (refererInfo.canonicalUrl || refererInfo.referer || '').substr(0, 300).split(/[?#]/)[0] ]
[ 'pn', (refererInfo.page || '').substr(0, 300).split(/[?#]/)[0] ]
];

if (!adUnits.length) {
Expand Down
3 changes: 1 addition & 2 deletions src/refererDetection.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ export function detectReferer(win) {
* @property {string|null} page the best candidate for the current page URL: `canonicalUrl`, falling back to `location`
* @property {string|null} domain the domain portion of `page`
* @property {string|null} the referrer (document.referrer) to the current page, or null if not available (due to cross-origin restricitons)
* @property {string} topmostLocation of the top-most frame for which we could guess the location. Outside of cross-origin scenarios, this is
* equivalent to `location`.
* @property {string} topmostLocation of the top-most frame for which we could guess the location. Outside of cross-origin scenarios, this is equivalent to `location`.
* @property {number} numIframes number of steps between window.self and window.top
* @property {Array[string|null]} stack our best guess at the location for each frame, in the direction top -> self.
*/
Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/adkernelBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {spec} from 'modules/adkernelBidAdapter';
import * as utils from 'src/utils';
import {NATIVE, BANNER, VIDEO} from 'src/mediaTypes';
import {config} from 'src/config';
import {parseDomain} from '../../../src/refererDetection.js';

describe('Adkernel adapter', function () {
const bid1_zone1 = {
Expand Down Expand Up @@ -253,7 +254,7 @@ describe('Adkernel adapter', function () {
});

function buildBidderRequest(url = 'https://example.com/index.html', params = {}) {
return Object.assign({}, params, {refererInfo: {referer: url, reachedTop: true}, timeout: 3000, bidderCode: 'adkernel'});
return Object.assign({}, params, {refererInfo: {page: url, domain: parseDomain(url), reachedTop: true}, timeout: 3000, bidderCode: 'adkernel'});
}
const DEFAULT_BIDDER_REQUEST = buildBidderRequest();

Expand Down

0 comments on commit c614eca

Please sign in to comment.