Skip to content

Commit

Permalink
ucfunnel adapter update request paramter
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhsiehucf committed May 21, 2020
1 parent 3004ad9 commit def4ed2
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions modules/ucfunnelBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO, NATIVE} from '../src/mediaTypes.js';

import { getStorageManager } from '../src/storageManager.js';
import * as utils from '../src/utils.js';
const storage = getStorageManager();
const COOKIE_NAME = 'ucf_uid';
const VER = 'ADGENT_PREBID-2018011501';
const BIDDER_CODE = 'ucfunnel';

Expand Down Expand Up @@ -183,9 +186,6 @@ function getSupplyChain(schain) {

function getRequestData(bid, bidderRequest) {
const size = parseSizes(bid);
const loc = window.location;
const host = loc.host;
const page = loc.href;
const language = navigator.language;
const dnt = (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0;
const userIdTdid = (bid.userId && bid.userId.tdid) ? bid.userId.tdid : '';
Expand All @@ -197,14 +197,36 @@ function getRequestData(bid, bidderRequest) {
bl: language,
je: 1,
dnt: dnt,
host: host,
u: page,
adid: bid.params.adid,
tdid: userIdTdid,
schain: supplyChain,
fp: bid.params.bidfloor
};

try {
bidData.host = window.top.location.hostname;
bidData.u = window.top.location.href;
bidData.xr = 0;
} catch (e) {
bidData.host = window.location.hostname;
bidData.u = document.referrer || window.location.href;
bidData.xr = 1;
}

if (window.location.ancestorOrigins && window.location.ancestorOrigins.length > 0)
bidData.ao = window.location.ancestorOrigins[window.location.ancestorOrigins.length - 1];

if (storage.cookiesAreEnabled()) {
if (storage.getCookie(COOKIE_NAME) != undefined) {
var id = storage.getCookie(COOKIE_NAME);
bidData.ucfUid = id;
} else {
var id = utils.generateUUID();
bidData.ucfUid = id;
storage.setCookie(COOKIE_NAME, id);
}
}

if (size != undefined && size.length == 2) {
bidData.w = size[0];
bidData.h = size[1];
Expand Down

0 comments on commit def4ed2

Please sign in to comment.