function _callBids(params) { let publisherId; let bidUrl = ''; let i; let referrer; bids = params.bids || []; for (i = 0; i < bids.length; i++) { var requestParams = bids[i].params; requestParams.tagId = bids[i].placementCode; _fixParamNames(requestParams); publisherId = requestParams.pbId; referrer = referrer || requestParams.referrer; bidUrl += _setupPlacementParameters(i, requestParams); } bidUrl = _setupAdCall(publisherId, bids.length, bidUrl, referrer); utils.logMessage('Calling WO: ' + bidUrl); adloader.loadScript(bidUrl); }
utils._each(bids, bidRequest => { const { bidId , params = {} , placementCode } = bidRequest; const timestamp = _getTimeStamp(); const trackingId = params.inScreen; const nativeId = params['native']; const slotId = params.inSlot; const bid = { tmax: $$PREBID_GLOBAL$$.cbTimeout }; /* slot/native ads need the placement id */ switch (true) { case !!(params.inImage): bid.pi = 1; break; case !!(params.inScreen): bid.pi = 2; break; case !!(params.inSlot): bid.pi = 3; break; case !!(params['native']): bid.pi = 5; break; default: return utils.logWarn( `[GumGum] No product selected for the placement ${placementCode}` + ', please check your implementation.' ); } /* throttle based on the latest request for this product */ const productId = bid.pi; const requestKey = productId + '|' + placementCode; const throttle = throttleTable[productId]; const latestRequest = requestCache[requestKey]; if (latestRequest && throttle && (timestamp - latestRequest) < throttle) { return utils.logWarn( `[GumGum] The refreshes for "${placementCode}" with the params ` + `${JSON.stringify(params)} should be at least ${throttle / 1e3}s apart.` ); } /* update the last request */ requestCache[requestKey] = timestamp; /* tracking id is required for in-image and in-screen */ if (trackingId) bid.t = trackingId; /* native ads require a native placement id */ if (nativeId) bid.ni = nativeId; /* slot ads require a slot id */ if (slotId) bid.si = slotId; /* include the pageViewId, if any */ if (pageViewId) bid.pv = pageViewId; const cachedBid = Object.assign({ placementCode, id: bidId }, bid); const callback = { jsonp: `$$PREBID_GLOBAL$$.handleGumGumCB['${bidId}']` }; CALLBACKS[bidId] = _handleGumGumResponse(cachedBid); const query = Object.assign(callback, browserParams, bid, _getDigiTrustQueryParams()); const bidCall = `${bidEndpoint}?${utils.parseQueryStringParameters(query)}`; adloader.loadScript(bidCall); });
function _sendRequest(auids, placementMap) { var query = []; var path = reqPath; query.push('u=' + encodeURIComponent(location.href)); query.push('auids=' + encodeURIComponent(auids.join(','))); query.push('cb=' + _makeHandler(auids, placementMap)); query.push('pt=' + (window.globalPrebidTrustxPriceType === 'net' ? 'net' : 'gross')); adloader.loadScript(reqHost + path + query.join('&')); }
export function Renderer(options) { const { url, config, id, callback } = options; this.url = url; this.config = config; this.callback = callback; this.handlers = {}; this.id = id; // we expect to load a renderer url once only so cache the request to load script loadScript(url, callback, true); }
function _requestBids(bidReqs) { // build bid request object var domain = window.location.host; var page = window.location.pathname + location.search + location.hash; var sovrnImps = []; // build impression array for sovrn utils._each(bidReqs, function (bid) { var tagId = utils.getBidIdParameter('tagid', bid.params); var bidFloor = utils.getBidIdParameter('bidfloor', bid.params); var adW = 0; var adH = 0; // sovrn supports only one size per tagid, so we just take the first size if there are more // if we are a 2 item array of 2 numbers, we must be a SingleSize array var bidSizes = Array.isArray(bid.params.sizes) ? bid.params.sizes : bid.sizes; var sizeArrayLength = bidSizes.length; if (sizeArrayLength === 2 && typeof bidSizes[0] === 'number' && typeof bidSizes[1] === 'number') { adW = bidSizes[0]; adH = bidSizes[1]; } else { adW = bidSizes[0][0]; adH = bidSizes[0][1]; } var imp = { id: bid.bidId, banner: { w: adW, h: adH }, tagid: tagId, bidfloor: bidFloor }; sovrnImps.push(imp); }); // build bid request with impressions var sovrnBidReq = { id: utils.getUniqueIdentifierStr(), imp: sovrnImps, site: { domain: domain, page: page } }; var scriptUrl = '//' + sovrnUrl + '?callback=window.$$PREBID_GLOBAL$$.sovrnResponse' + '&src=' + CONSTANTS.REPO_AND_VERSION + '&br=' + encodeURIComponent(JSON.stringify(sovrnBidReq)); adloader.loadScript(scriptUrl); }
function _requestBids(bid) { var info = { referrer: utils.getTopWindowUrl(), domain: utils.getTopWindowLocation().hostname, ua: window.navigator.userAgent }; var param = Object.assign({}, bid.params, info); param.sizes = JSON.stringify(param.sizes || bid.sizes); param.callback = '$$PREBID_GLOBAL$$.adbundResponse'; $$PREBID_GLOBAL$$.adbundResponse = _createCallback(bid); adloader.loadScript(bidAPI + '?' + _stringify(param)); }
utils._each(bidRequests, function (bidRequest) { adloader.loadScript( utils.tryAppendQueryString( utils.tryAppendQueryString( BASE_URI, 'callback', '$$PREBID_GLOBAL$$.adbladeResponse' ), 'json', JSON.stringify( bidRequest ) ) ); });
baseAdapter.callBids = function (params) { // var bidCode = baseAdapter.getBidderCode(); var anArr = params.bids; // var bidsCount = anArr.length; // set expected bids count for callback execution // bidmanager.setExpectedBidsCount(bidCode, bidsCount); for (var i = 0; i < anArr.length; i++) { var bidRequest = anArr[i]; var callbackId = bidRequest.bidId; adloader.loadScript(buildJPTCall(bidRequest, callbackId)); // store a reference to the bidRequest from the callback id // bidmanager.pbCallbackMap[callbackId] = bidRequest; } };
/** * Send a bid request to the bid server endpoint * * Calls `adLoader.loadScript` * * @memberof module:HiroMediaAdapter~ * @private * * @param {string} url base url, can already contain query parameters * @param {object} requestParams parameters to add to query */ function sendBidRequest(url,requestParams) { if (requestParams) { if (url.indexOf('?') !== -1) { url = url + '&'; } else { url = url + '?'; } Object.keys(requestParams).forEach(function (key) { url = utils.tryAppendQueryString(url, key, requestParams[key]); }); } utils.logMessage('hiromedia.callBids, url:' + url); adloader.loadScript(url); }
function _callBids(params) { var bid, _value, _key, i, j, k, l, reqParams; var bids = params.bids; var request = []; var callbackName = '_adf_' + utils.getUniqueIdentifierStr(); var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], ['fd', 1], [ 'url', null ], [ 'tid', null ], [ 'callback', '$$PREBID_GLOBAL$$.' + callbackName ] ]; for (i = 0, l = bids.length; i < l; i++) { bid = bids[i]; for (j = 0, k = globalParams.length; j < k; j++) { _key = globalParams[j][0]; _value = bid[_key] || bid.params[_key]; if (_value) { bid[_key] = bid.params[_key] = null; globalParams[j][1] = _value; } } reqParams = bid.params; reqParams.transactionId = bid.transactionId; request.push(formRequestUrl(reqParams)); } request.unshift('//' + globalParams[0][1] + '/adx/?rp=4'); for (i = 1, l = globalParams.length; i < l; i++) { _key = globalParams[i][0]; _value = globalParams[i][1]; if (_value) { request.push(globalParams[i][0] + '=' + encodeURIComponent(_value)); } } $$PREBID_GLOBAL$$[callbackName] = handleCallback(bids); adloader.loadScript(request.join('&')); };
$$PREBID_GLOBAL$$.conversantResponse = function (conversantResponseObj, path) { // valid object? if (conversantResponseObj && conversantResponseObj.id) { if (conversantResponseObj.seatbid && conversantResponseObj.seatbid.length > 0 && conversantResponseObj.seatbid[0].bid && conversantResponseObj.seatbid[0].bid.length > 0) { utils._each(conversantResponseObj.seatbid, parseSeatbid); } else { // no response data for any placements addEmptyBidResponses([]); } } else { // no response data for any placements addEmptyBidResponses([]); } // for debugging purposes if (path) { adloader.loadScript(path, function () { var allConversantBidRequests = $$PREBID_GLOBAL$$._bidsRequested.find(bidSet => bidSet.bidderCode === 'conversant'); if ($$PREBID_GLOBAL$$.conversantDebugResponse) { $$PREBID_GLOBAL$$.conversantDebugResponse(allConversantBidRequests); } }); } }; // conversantResponse
// Load the SpotX Direct AdOS SDK onto the page function loadDSDK() { var channelId = bidReq.params.video.channel_id; adLoader.loadScript('//js.spotx.tv/directsdk/v1/' + channelId + '.js', initDSDK, true); }
function sendCygnusRequest(cygnusRequest) { adloader.loadScript(cygnusRequest); }