// TODO: potential 0 values for browserParams sent to ad server
function _getBrowserParams() {
  let topWindow
  let topScreen
  let topUrl
  let ggad
  if (browserParams.vw) {
    // we've already initialized browserParams, just return it.
    return browserParams
  }

  try {
    topWindow = global.top;
    topScreen = topWindow.screen;
    topUrl = utils.getTopWindowUrl()
  } catch (error) {
    utils.logError(error);
    return browserParams
  }

  browserParams = {
    vw: topWindow.innerWidth,
    vh: topWindow.innerHeight,
    sw: topScreen.width,
    sh: topScreen.height,
    pu: topUrl,
    ce: utils.cookiesAreEnabled(),
    dpr: topWindow.devicePixelRatio || 1
  }
  ggad = (topUrl.match(/#ggad=(\w+)$/) || [0, 0])[1]
  if (ggad) {
    browserParams[isNaN(ggad) ? 'eAdBuyId' : 'adBuyId'] = ggad
  }
  return browserParams
}
Пример #2
0
export function initPubcid() {
  config.getConfig('pubcid', config => setConfig(config.pubcid));

  if (utils.cookiesAreEnabled()) {
    if (!getCookie('_pubcid_optout')) {
      $$PREBID_GLOBAL$$.requestBids.addHook(requestBidHook);
    }
  }
}
Пример #3
0
  buildRequests: function (validBidRequests, bidderRequest) {
    const body = document.getElementsByTagName('body')[0];
    const refInfo = bidderRequest.refererInfo;
    const gdpr = bidderRequest.gdprConsent;
    const vpW = Math.max(window.innerWidth || body.clientWidth || 0) + 2;
    const vpH = Math.max(window.innerHeight || body.clientHeight || 0) + 2;
    const sr = screen.height > screen.width ? screen.height + 'x' + screen.width + 'x' + screen.colorDepth : screen.width + 'x' + screen.height + 'x' + screen.colorDepth;

    var payload = {
      v: '2.0',
      azr: true,
      ck: utils.cookiesAreEnabled(),
      re: refInfo ? refInfo.referer : '',
      st: refInfo ? refInfo.stack : [],
      tz: getBdfTz(new Date()),
      sr: sr,
      tm: bidderRequest.timeout,
      vp: vpW + 'x' + vpH,
      sdt: getUTCDate(),
      top: refInfo ? refInfo.reachedTop : false,
      gdpr: gdpr ? gdpr.gdprApplies : false,
      gdprc: gdpr ? gdpr.consentString : '',
      bids: []
    };

    utils._each(validBidRequests, function (bidRequest) {
      var params = bidRequest.params;
      var sizes = utils.parseSizesInput(bidRequest.sizes)[0];
      var width = sizes.split('x')[0];
      var height = sizes.split('x')[1];

      var currentBidPayload = {
        bid: bidRequest.bidId,
        tid: params.placementId,
        pid: params.publisherId,
        rp: params.reservePrice || 0,
        w: width,
        h: height
      };

      payload.bids.push(currentBidPayload);
    });

    const payloadString = JSON.stringify(payload);
    return {
      method: 'POST',
      url: `//bdf${payload.bids[0].pid}.bidfluence.com/Prebid`,
      data: payloadString,
      options: { contentType: 'text/plain' }
    };
  },
Пример #4
0
    return validBidRequests.map(bidRequest => {
      const params = bidRequest.params;
      const sizes = utils.parseSizesInput(bidRequest.sizes)[0];
      const width = sizes.split('x')[0];
      const height = sizes.split('x')[1];
      const refInfo = bidderRequest.refererInfo;
      const gdpr = bidderRequest.gdprConsent;
      const body = document.getElementsByTagName('body')[0];
      const vpW = Math.max(window.innerWidth || body.clientWidth || 0) + 2;
      const vpH = Math.max(window.innerHeight || body.clientHeight || 0) + 2;
      const sr = screen.height > screen.width ? screen.height + 'x' + screen.width + 'x' + screen.colorDepth : screen.width + 'x' + screen.height + 'x' + screen.colorDepth;

      const payload = {
        bid: bidRequest.bidId,
        v: '1.0',
        azr: true,
        ck: utils.cookiesAreEnabled(),
        tid: params.placementId,
        pid: params.publisherId,
        rp: params.reservePrice || 0,
        re: refInfo ? refInfo.referer : '',
        st: refInfo ? refInfo.stack : [],
        tz: getBdfTz(new Date()),
        sr: sr,
        tm: bidderRequest.timeout,
        vp: vpW + 'x' + vpH,
        sdt: getUTCDate(),
        w: width,
        h: height,
        gdpr: gdpr ? gdpr.gdprApplies : false,
        gdprc: gdpr ? gdpr.consentString : ''
      };
      const payloadString = JSON.stringify(payload);
      return {
        method: 'POST',
        url: `//${payload.pid}.bidfluence.com/Hb`,
        data: payloadString,
        options: { contentType: 'text/plain' }
      };
    });