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

Multiple Bid/Analytics Adapters: import utils functions as needed and not the whole module #7471

Merged
merged 81 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
33762d1
added support for pubcommon, digitrust, id5id
pm-harshad-mane Sep 12, 2019
0722354
added support for IdentityLink
pm-harshad-mane Sep 13, 2019
f2c32c0
changed the source for id5
pm-harshad-mane Sep 13, 2019
37163d1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 13, 2019
eaed987
added unit test cases
pm-harshad-mane Sep 13, 2019
602ee7e
changed source param for identityLink
pm-harshad-mane Sep 16, 2019
b6fcd36
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2019
58381f3
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 26, 2019
c9fb11b
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 10, 2019
8ece7fd
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 16, 2019
28d12a0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 16, 2019
05a55e1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 31, 2019
e8b10d5
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 5, 2019
870085f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 12, 2019
844ce4e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 12, 2019
704eca3
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 13, 2019
2565cb9
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 4, 2019
1d75bd4
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 4, 2019
6adde1e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 6, 2019
477c98a
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 9, 2019
cef5422
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 10, 2019
c110a7d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 9, 2020
e8fb062
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 5, 2020
d77cd71
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 17, 2020
817ce3f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 24, 2020
cda825e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 26, 2020
f34a3ec
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 27, 2020
f106dc8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 4, 2020
1f6937e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
06ffe84
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
5448ceb
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
e9b90fe
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 11, 2020
a7a1d12
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 11, 2020
30b72df
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 26, 2020
76adbc9
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
50e13bc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
a1c7ca1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
96fbadc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 1, 2020
4b026e2
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 9, 2020
38740bc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 10, 2020
9daf778
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 20, 2020
eff8828
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 21, 2020
ede95de
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 21, 2020
c98f1a1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 23, 2020
312da6d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane May 18, 2020
d92972c
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 1, 2020
fd4fb2e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 26, 2020
e551136
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 30, 2020
cfdca3c
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jul 7, 2020
22505ff
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jul 28, 2020
795a54a
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 10, 2020
433c98b
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 3, 2020
a0521ac
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 24, 2020
635fe74
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 25, 2020
2759212
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 12, 2020
84737d8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
df5fada
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
9ab7840
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
ed4b566
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 8, 2021
f57d220
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 20, 2021
6a6d1f4
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 9, 2021
3650c9d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 10, 2021
85c9d49
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 18, 2021
ca82340
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 23, 2021
12e8f47
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 8, 2021
5d024e7
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 15, 2021
4c87d00
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 22, 2021
93ea6ca
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane May 6, 2021
1eaefc8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 2, 2021
cd4a279
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 7, 2021
4e9ff9f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 6, 2021
f971232
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 11, 2021
24b2cd0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 6, 2021
6d3d8a1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 10, 2021
ae6dbb2
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 21, 2021
a691bc0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2021
bb3ceb1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2021
05b7793
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 24, 2021
b5a4fec
import utils as needed; dont import all
pm-harshad-mane Sep 24, 2021
25f83f5
import utils as needed; dont import all
pm-harshad-mane Sep 24, 2021
de343db
Import utils functions as needed; do not import whole module
pm-harshad-mane Sep 24, 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
89 changes: 46 additions & 43 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import * as utils from '../src/utils.js';
import {
isStr, isArray, isPlainObject, deepSetValue, isNumber, deepAccess, getAdUnitSizes, parseGPTSingleSizeArrayToRtbSize,
cleanObj, contains, getDNT, parseUrl, createTrackPixelHtml, _each, isArrayOfNums
} from '../src/utils.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import find from 'core-js-pure/features/array/find.js';
Expand Down Expand Up @@ -154,24 +157,24 @@ export const spec = {
prBid.mediaType = NATIVE;
prBid.native = buildNativeAd(JSON.parse(rtbBid.adm));
}
if (utils.isStr(rtbBid.dealid)) {
if (isStr(rtbBid.dealid)) {
prBid.dealId = rtbBid.dealid;
}
if (utils.isArray(rtbBid.adomain)) {
utils.deepSetValue(prBid, 'meta.advertiserDomains', rtbBid.adomain);
if (isArray(rtbBid.adomain)) {
deepSetValue(prBid, 'meta.advertiserDomains', rtbBid.adomain);
}
if (utils.isArray(rtbBid.cat)) {
utils.deepSetValue(prBid, 'meta.secondaryCatIds', rtbBid.cat);
if (isArray(rtbBid.cat)) {
deepSetValue(prBid, 'meta.secondaryCatIds', rtbBid.cat);
}
if (utils.isPlainObject(rtbBid.ext)) {
if (utils.isNumber(rtbBid.ext.advertiser_id)) {
utils.deepSetValue(prBid, 'meta.advertiserId', rtbBid.ext.advertiser_id);
if (isPlainObject(rtbBid.ext)) {
if (isNumber(rtbBid.ext.advertiser_id)) {
deepSetValue(prBid, 'meta.advertiserId', rtbBid.ext.advertiser_id);
}
if (utils.isStr(rtbBid.ext.advertiser_name)) {
utils.deepSetValue(prBid, 'meta.advertiserName', rtbBid.ext.advertiser_name);
if (isStr(rtbBid.ext.advertiser_name)) {
deepSetValue(prBid, 'meta.advertiserName', rtbBid.ext.advertiser_name);
}
if (utils.isStr(rtbBid.ext.agency_name)) {
utils.deepSetValue(prBid, 'meta.agencyName', rtbBid.ext.agency_name);
if (isStr(rtbBid.ext.agency_name)) {
deepSetValue(prBid, 'meta.agencyName', rtbBid.ext.agency_name);
}
}

Expand Down Expand Up @@ -241,27 +244,27 @@ function buildImp(bidRequest, secure) {
var mediaType;
var sizes = [];

if (utils.deepAccess(bidRequest, 'mediaTypes.banner')) {
sizes = utils.getAdUnitSizes(bidRequest);
if (deepAccess(bidRequest, 'mediaTypes.banner')) {
sizes = getAdUnitSizes(bidRequest);
imp.banner = {
format: sizes.map(wh => utils.parseGPTSingleSizeArrayToRtbSize(wh)),
format: sizes.map(wh => parseGPTSingleSizeArrayToRtbSize(wh)),
topframe: 0
};
mediaType = BANNER;
} else if (utils.deepAccess(bidRequest, 'mediaTypes.video')) {
let video = utils.deepAccess(bidRequest, 'mediaTypes.video');
} else if (deepAccess(bidRequest, 'mediaTypes.video')) {
let video = deepAccess(bidRequest, 'mediaTypes.video');
imp.video = {};
if (video.playerSize) {
sizes = video.playerSize[0];
imp.video = Object.assign(imp.video, utils.parseGPTSingleSizeArrayToRtbSize(sizes) || {});
imp.video = Object.assign(imp.video, parseGPTSingleSizeArrayToRtbSize(sizes) || {});
}
if (bidRequest.params.video) {
Object.keys(bidRequest.params.video)
.filter(key => includes(VIDEO_TARGETING, key))
.forEach(key => imp.video[key] = bidRequest.params.video[key]);
}
mediaType = VIDEO;
} else if (utils.deepAccess(bidRequest, 'mediaTypes.native')) {
} else if (deepAccess(bidRequest, 'mediaTypes.native')) {
let nativeRequest = buildNativeRequest(bidRequest.mediaTypes.native);
imp.native = {
ver: '1.1',
Expand Down Expand Up @@ -299,7 +302,7 @@ function buildNativeRequest(nativeReq) {
if (desc.assetType === 'img') {
assetRoot[desc.assetType] = buildImageAsset(desc, v);
} else if (desc.assetType === 'data') {
assetRoot.data = utils.cleanObj({type: desc.type, len: v.len});
assetRoot.data = cleanObj({type: desc.type, len: v.len});
} else if (desc.assetType === 'title') {
assetRoot.title = {len: v.len || 90};
} else {
Expand All @@ -323,7 +326,7 @@ function buildImageAsset(desc, val) {
img.wmin = val.aspect_ratios[0].min_width;
img.hmin = val.aspect_ratios[0].min_height;
}
return utils.cleanObj(img);
return cleanObj(img);
}

/**
Expand All @@ -336,9 +339,9 @@ function isSyncMethodAllowed(syncRule, bidderCode) {
if (!syncRule) {
return false;
}
let bidders = utils.isArray(syncRule.bidders) ? syncRule.bidders : [bidderCode];
let bidders = isArray(syncRule.bidders) ? syncRule.bidders : [bidderCode];
let rule = syncRule.filter === 'include';
return utils.contains(bidders, bidderCode) === rule;
return contains(bidders, bidderCode) === rule;
}

/**
Expand Down Expand Up @@ -382,33 +385,33 @@ function buildRtbRequest(imps, bidderRequest, schain) {
},
'tmax': parseInt(timeout)
};
if (utils.getDNT()) {
if (getDNT()) {
req.device.dnt = 1;
}
if (gdprConsent) {
if (gdprConsent.gdprApplies !== undefined) {
utils.deepSetValue(req, 'regs.ext.gdpr', ~~gdprConsent.gdprApplies);
deepSetValue(req, 'regs.ext.gdpr', ~~gdprConsent.gdprApplies);
}
if (gdprConsent.consentString !== undefined) {
utils.deepSetValue(req, 'user.ext.consent', gdprConsent.consentString);
deepSetValue(req, 'user.ext.consent', gdprConsent.consentString);
}
}
if (uspConsent) {
utils.deepSetValue(req, 'regs.ext.us_privacy', uspConsent);
deepSetValue(req, 'regs.ext.us_privacy', uspConsent);
}
if (coppa) {
utils.deepSetValue(req, 'regs.coppa', 1);
deepSetValue(req, 'regs.coppa', 1);
}
let syncMethod = getAllowedSyncMethod(bidderCode);
if (syncMethod) {
utils.deepSetValue(req, 'ext.adk_usersync', syncMethod);
deepSetValue(req, 'ext.adk_usersync', syncMethod);
}
if (schain) {
utils.deepSetValue(req, 'source.ext.schain', schain);
deepSetValue(req, 'source.ext.schain', schain);
}
let eids = getExtendedUserIds(bidderRequest);
if (eids) {
utils.deepSetValue(req, 'user.ext.eids', eids);
deepSetValue(req, 'user.ext.eids', eids);
}
return req;
}
Expand All @@ -426,7 +429,7 @@ function getLanguage() {
* Creates site description object
*/
function createSite(refInfo) {
let url = utils.parseUrl(refInfo.referer);
let url = parseUrl(refInfo.referer);
let site = {
'domain': url.hostname,
'page': `${url.protocol}://${url.hostname}${url.pathname}`
Expand All @@ -442,8 +445,8 @@ function createSite(refInfo) {
}

function getExtendedUserIds(bidderRequest) {
let eids = utils.deepAccess(bidderRequest, 'bids.0.userIdAsEids');
if (utils.isArray(eids)) {
let eids = deepAccess(bidderRequest, 'bids.0.userIdAsEids');
if (isArray(eids)) {
return eids;
}
}
Expand All @@ -455,7 +458,7 @@ function getExtendedUserIds(bidderRequest) {
function formatAdMarkup(bid) {
let adm = bid.adm;
if ('nurl' in bid) {
adm += utils.createTrackPixelHtml(`${bid.nurl}&px=1`);
adm += createTrackPixelHtml(`${bid.nurl}&px=1`);
}
return adm;
}
Expand All @@ -465,8 +468,8 @@ function formatAdMarkup(bid) {
*/
function validateNativeAdUnit(adUnit) {
return validateNativeImageSize(adUnit.image) && validateNativeImageSize(adUnit.icon) &&
!utils.deepAccess(adUnit, 'privacyLink.required') && // not supported yet
!utils.deepAccess(adUnit, 'privacyIcon.required'); // not supported yet
!deepAccess(adUnit, 'privacyLink.required') && // not supported yet
!deepAccess(adUnit, 'privacyIcon.required'); // not supported yet
}

/**
Expand All @@ -477,9 +480,9 @@ function validateNativeImageSize(img) {
return true;
}
if (img.sizes) {
return utils.isArrayOfNums(img.sizes, 2);
return isArrayOfNums(img.sizes, 2);
}
if (utils.isArray(img.aspect_ratios)) {
if (isArray(img.aspect_ratios)) {
return img.aspect_ratios.length > 0 && img.aspect_ratios[0].min_height && img.aspect_ratios[0].min_width;
}
return true;
Expand All @@ -496,14 +499,14 @@ function buildNativeAd(nativeResp) {
javascriptTrackers: jstracker ? [jstracker] : undefined,
privacyLink: privacy,
};
utils._each(assets, asset => {
_each(assets, asset => {
let assetName = NATIVE_MODEL[asset.id].name;
let assetType = NATIVE_MODEL[asset.id].assetType;
nativeAd[assetName] = asset[assetType].text || asset[assetType].value || utils.cleanObj({
nativeAd[assetName] = asset[assetType].text || asset[assetType].value || cleanObj({
url: asset[assetType].url,
width: asset[assetType].w,
height: asset[assetType].h
});
});
return utils.cleanObj(nativeAd);
return cleanObj(nativeAd);
}
52 changes: 26 additions & 26 deletions modules/adlooxAdServerVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,48 @@ import { command as analyticsCommand, COMMAND } from './adlooxAnalyticsAdapter.j
import { ajax } from '../src/ajax.js';
import { EVENTS } from '../src/constants.json';
import { targeting } from '../src/targeting.js';
import * as utils from '../src/utils.js';
import { logInfo, isFn, logError, isPlainObject, isStr, isBoolean, deepSetValue, deepClone, timestamp, logWarn } from '../src/utils.js';

const MODULE = 'adlooxAdserverVideo';

const URL_VAST = 'https://j.adlooxtracking.com/ads/vast/tag.php';

export function buildVideoUrl(options, callback) {
utils.logInfo(MODULE, 'buildVideoUrl', options);
logInfo(MODULE, 'buildVideoUrl', options);

if (!utils.isFn(callback)) {
utils.logError(MODULE, 'invalid callback');
if (!isFn(callback)) {
logError(MODULE, 'invalid callback');
return false;
}
if (!utils.isPlainObject(options)) {
utils.logError(MODULE, 'missing options');
if (!isPlainObject(options)) {
logError(MODULE, 'missing options');
return false;
}
if (!(options.url_vast === undefined || utils.isStr(options.url_vast))) {
utils.logError(MODULE, 'invalid url_vast options value');
if (!(options.url_vast === undefined || isStr(options.url_vast))) {
logError(MODULE, 'invalid url_vast options value');
return false;
}
if (!(utils.isPlainObject(options.adUnit) || utils.isPlainObject(options.bid))) {
utils.logError(MODULE, "requires either 'adUnit' or 'bid' options value");
if (!(isPlainObject(options.adUnit) || isPlainObject(options.bid))) {
logError(MODULE, "requires either 'adUnit' or 'bid' options value");
return false;
}
if (!utils.isStr(options.url)) {
utils.logError(MODULE, 'invalid url options value');
if (!isStr(options.url)) {
logError(MODULE, 'invalid url options value');
return false;
}
if (!(options.wrap === undefined || utils.isBoolean(options.wrap))) {
utils.logError(MODULE, 'invalid wrap options value');
if (!(options.wrap === undefined || isBoolean(options.wrap))) {
logError(MODULE, 'invalid wrap options value');
return false;
}
if (!(options.blob === undefined || utils.isBoolean(options.blob))) {
utils.logError(MODULE, 'invalid blob options value');
if (!(options.blob === undefined || isBoolean(options.blob))) {
logError(MODULE, 'invalid blob options value');
return false;
}

// same logic used in modules/dfpAdServerVideo.js
options.bid = options.bid || targeting.getWinningBids(options.adUnit.code)[0];

utils.deepSetValue(options.bid, 'ext.adloox.video.adserver', true);
deepSetValue(options.bid, 'ext.adloox.video.adserver', true);

if (options.wrap !== false) {
VASTWrapper(options, callback);
Expand All @@ -70,7 +70,7 @@ registerVideoSupport('adloox', {
function track(options, callback) {
callback(options.url);

const bid = utils.deepClone(options.bid);
const bid = deepClone(options.bid);
bid.ext.adloox.video.adserver = false;

analyticsCommand(COMMAND.TRACK, {
Expand All @@ -85,13 +85,13 @@ function VASTWrapper(options, callback) {
function process(result) {
function getAd(xml) {
if (!xml || xml.documentElement.tagName != 'VAST') {
utils.logError(MODULE, 'not a VAST tag, using non-wrapped tracking');
logError(MODULE, 'not a VAST tag, using non-wrapped tracking');
return;
}

const ads = xml.querySelectorAll('Ad');
if (!ads.length) {
utils.logError(MODULE, 'no VAST ads, using non-wrapped tracking');
logError(MODULE, 'no VAST ads, using non-wrapped tracking');
return;
}

Expand Down Expand Up @@ -132,7 +132,7 @@ function VASTWrapper(options, callback) {

options.url = toBlob(chain[0]);

const epoch = utils.timestamp() - new Date().getTimezoneOffset() * 60 * 1000;
const epoch = timestamp() - new Date().getTimezoneOffset() * 60 * 1000;
const expires0 = options.bid.ttl * 1000 - (epoch - options.bid.responseTimestamp);
const expires = Math.max(30 * 1000, expires0);
setTimeout(function() { urls.forEach(u => URL.revokeObjectURL(u)) }, expires);
Expand All @@ -154,7 +154,7 @@ function VASTWrapper(options, callback) {
const wrapper = getWrapper(ad);
if (wrapper) {
if (chain.length > 5) {
utils.logWarn(MODULE, `got wrapped tag at depth ${chain.length}, not continuing`);
logWarn(MODULE, `got wrapped tag at depth ${chain.length}, not continuing`);
blobify();
return track(options, callback);
}
Expand Down Expand Up @@ -191,7 +191,7 @@ function VASTWrapper(options, callback) {
if (duration != 15) args.push([ 'duration', duration ]);
if (skip) args.push([ 'skip', skip ]);

utils.logInfo(MODULE, `processed VAST tag chain of depth ${chain.depth}, running callback`);
logInfo(MODULE, `processed VAST tag chain of depth ${chain.depth}, running callback`);

analyticsCommand(COMMAND.URL, {
url: (options.url_vast || URL_VAST) + '?',
Expand All @@ -202,18 +202,18 @@ function VASTWrapper(options, callback) {
}

function fetch(url, withoutcredentials) {
utils.logInfo(MODULE, `fetching VAST ${url}`);
logInfo(MODULE, `fetching VAST ${url}`);

ajax(url, {
success: function(responseText, q) {
process({ type: q.getResponseHeader('content-type'), xml: q.responseXML });
},
error: function(statusText, q) {
if (!withoutcredentials) {
utils.logWarn(MODULE, `unable to download (${statusText}), suspected CORS withCredentials problem, retrying without`);
logWarn(MODULE, `unable to download (${statusText}), suspected CORS withCredentials problem, retrying without`);
return fetch(url, true);
}
utils.logError(MODULE, `failed to fetch (${statusText}), using non-wrapped tracking`);
logError(MODULE, `failed to fetch (${statusText}), using non-wrapped tracking`);
process();
}
}, undefined, { withCredentials: !withoutcredentials });
Expand Down
Loading