Skip to content

Commit

Permalink
ucfunnel adapter update request parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhsiehucf committed May 21, 2020
1 parent 3004ad9 commit e65ba4c
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 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,38 @@ 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()) {
let ucfUid = '';
if (storage.getCookie(COOKIE_NAME) != undefined) {
ucfUid = storage.getCookie(COOKIE_NAME);
bidData.ucfUid = ucfUid;
} else {
ucfUid = utils.generateUUID();
bidData.ucfUid = ucfUid;
storage.setCookie(COOKIE_NAME, ucfUid);
}
}

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

0 comments on commit e65ba4c

Please sign in to comment.