Skip to content

Commit

Permalink
ucfunnel adapter update request parameter (#5278)
Browse files Browse the repository at this point in the history
* Add a new ucfunnel Adapter and test page

* Add a new ucfunnel Adapter and test page

* 1. Use prebid lib in the repo to keep updated
2. Replace var with let
3. Put JSON.parse(JSON.stringify()) into try catch block

* utils.getTopWindowLocation is a function

* Change to modules from adapters

* Migrate to module design

* [Dev Fix] Remove width and height which can be got from ad unit id

* Update ucfunnelBidAdapter to fit into new spec

* Correct the endpoint. Fix the error of query string

* Add test case for ucfunnelBidAdapter

* Fix lint error

* Update version number

* Combine all checks on bid request

* Add GDPR support for ucfunnel adapter

* Add in-stream video and native support for ucfunnel adapter

* Remove demo page. Add more test cases.

* Change request method from POST to GET

* Remove unnecessary comment

* Support vastXml and vastUrl for video request

* update TTL to 30 mins

* Avoid using arrow function which is not discuraged in mocha

* ucfunnel tdid support

* ucfunnel fix error message in debug mode

* ucfunnel adapter add bidfloor parameter

* ucfunnel adapter support CCPA

* ucfunnel adapter native support clicktrackers

* ucfunnel adapter change cookie sync setting

* ucfunnel adapter update request parameter

Co-authored-by: root <root@ubuntu.members.linode.com>
Co-authored-by: Ryan Chou <ryanchou0210@gmail.com>
Co-authored-by: jack.hsieh <moonnight8520@gmail.com>
  • Loading branch information
4 people authored Jun 2, 2020
1 parent 83f19f4 commit cd40194
Show file tree
Hide file tree
Showing 2 changed files with 48 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
18 changes: 18 additions & 0 deletions test/spec/modules/ucfunnelBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,22 @@ describe('ucfunnel Adapter', function () {
});
});
});

describe('cookie sync', function () {
describe('cookie sync iframe', function () {
const result = spec.getUserSyncs({'iframeEnabled': true});

it('should return cookie sync iframe info', function () {
expect(result[0].type).to.equal('iframe');
expect(result[0].url).to.equal('https://cdn.aralego.net/ucfad/cookie/sync.html');
});
});
describe('cookie sync image', function () {
const result = spec.getUserSyncs({'pixelEnabled': true});
it('should return cookie sync image info', function () {
expect(result[0].type).to.equal('image');
expect(result[0].url).to.equal('https://sync.aralego.com/idSync');
});
});
});
});

0 comments on commit cd40194

Please sign in to comment.