Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jixie Bid Adapter : pass bid floor to backend and change 1st party cookie #10496

Merged
merged 26 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
642803b
Adapter does not seem capable of supporting advertiserDomains #6650
jxdeveloper1 Jun 1, 2021
103b8ae
removed a blank line at the end of file
jxdeveloper1 Jun 1, 2021
704e974
in response to comment from reviewer. add the aspect of advertiserdom…
jxdeveloper1 Jun 2, 2021
0d26af8
Merge branch 'prebid:master' into master
jxdeveloper1 Jun 2, 2021
b23b95b
Merge branch 'prebid:master' into master
jxdeveloper1 Oct 18, 2021
7886688
added the code to get the keywords from the meta tags if available.
jxdeveloper1 Oct 18, 2021
b2f8f76
Merge branch 'jixie_add_keyword_frompage'
jxdeveloper1 Oct 18, 2021
49f1eca
Merge branch 'prebid:master' into master
jxdeveloper1 Apr 25, 2022
f5abaab
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 Apr 26, 2022
4389ce4
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 Apr 27, 2022
c358138
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 May 10, 2022
e1622a4
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 May 12, 2022
d11372c
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 May 20, 2022
3d57c8b
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 Jul 16, 2022
4e254b4
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 Dec 13, 2022
63b7cc0
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 Jul 19, 2023
4807683
WIP
jxdeveloper1 Aug 18, 2023
e2eb4c3
cleaned up
jxdeveloper1 Aug 18, 2023
efc9524
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 Aug 18, 2023
5ef588b
Merge branch 'master' into rw-jixie-pass-gpid-etc
jxdeveloper1 Aug 18, 2023
1df612b
Merge branch 'rw-jixie-pass-gpid-etc'
jxdeveloper1 Aug 18, 2023
034b1fe
correcting formatting errors from circleci
jxdeveloper1 Aug 18, 2023
ad74bce
Merge remote-tracking branch 'upstream/master'
jxdeveloper1 Sep 15, 2023
7208851
sending floor to our backend for each bid, when available, changed on…
jxdeveloper1 Sep 15, 2023
f91704a
Merge branch 'rw-jixie-get-floor-etc'
jxdeveloper1 Sep 15, 2023
7574d30
fixed spacing issues in code
jxdeveloper1 Sep 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions modules/jixieBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {deepAccess, getDNT, isArray, logWarn} from '../src/utils.js';
import {deepAccess, getDNT, isArray, logWarn, isFn, isPlainObject} from '../src/utils.js';
import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {getStorageManager} from '../src/storageManager.js';
Expand All @@ -14,6 +14,27 @@ const JX_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.media/jxhbrenderer.1.1.
const REQUESTS_URL = 'https://hb.jixie.io/v2/hbpost';
const sidTTLMins_ = 30;

/**
* Get bid floor from Price Floors Module
*
* @param {Object} bid
* @returns {float||null}
*/
function getBidFloor(bid) {
if (!isFn(bid.getFloor)) {
return null;
}
let floor = bid.getFloor({
currency: 'USD',
mediaType: '*',
size: '*'
});
if (isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'USD') {
return floor.floor;
}
return null;
}

/**
* Own miscellaneous support functions:
*/
Expand Down Expand Up @@ -56,7 +77,7 @@ function fetchIds_() {
if (tmp) ret.client_id_ls = tmp;
tmp = storage.getDataFromLocalStorage('_jxxs');
if (tmp) ret.session_id_ls = tmp;
['_jxtoko', '_jxifo', '_jxtdid', '__uid2_advertising_token'].forEach(function(n) {
['_jxtoko', '_jxifo', '_jxtdid', '_jxcomp'].forEach(function(n) {
tmp = storage.getCookie(n);
if (tmp) ret.jxeids[n] = tmp;
});
Expand Down Expand Up @@ -171,9 +192,12 @@ export const spec = {
params: one.params,
gpid: gpid
};
let bidFloor = getBidFloor(one);
if (bidFloor) {
tmp.bidFloor = bidFloor;
}
bids.push(tmp);
});

let jixieCfgBlob = config.getConfig('jixie');
if (!jixieCfgBlob) {
jixieCfgBlob = {};
Expand Down
25 changes: 21 additions & 4 deletions test/spec/modules/jixieBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai';
import { spec, internal as jixieaux, storage } from 'modules/jixieBidAdapter.js';
import { newBidder } from 'src/adapters/bidderFactory.js';
import { config } from 'src/config.js';
import { deepClone } from 'src/utils.js';

describe('jixie Adapter', function () {
const pageurl_ = 'https://testdomain.com/testpage.html';
Expand Down Expand Up @@ -74,13 +75,13 @@ describe('jixie Adapter', function () {
const jxtokoTest1_ = 'eyJJRCI6ImFiYyJ9';
const jxifoTest1_ = 'fffffbbbbbcccccaaaaae890606aaaaa';
const jxtdidTest1_ = '222223d1-1111-2222-3333-b9f129299999';
const __uid2_advertising_token_Test1 = 'AAAAABBBBBCCCCCDDDDDEEEEEUkkZPQfifpkPnnlJhtsa4o+gf4nfqgN5qHiTVX73ymTSbLT9jz1nf+Q7QdxNh9nTad9UaN5pzfHMt/rs1woQw72c1ip+8heZXPfKGZtZP7ldJesYhlo3/0FVcL/wl9ZlAo1jYOEfHo7Y9zFzNXABbbbbb==';
const jxcompTest1_ = 'AAAAABBBBBCCCCCDDDDDEEEEEUkkZPQfifpkPnnlJhtsa4o+gf4nfqgN5qHiTVX73ymTSbLT9jz1nf+Q7QdxNh9nTad9UaN5pzfHMt/rs1woQw72c1ip+8heZXPfKGZtZP7ldJesYhlo3/0FVcL/wl9ZlAo1jYOEfHo7Y9zFzNXABbbbbb==';

const refJxEids_ = {
'_jxtoko': jxtokoTest1_,
'_jxifo': jxifoTest1_,
'_jxtdid': jxtdidTest1_,
'__uid2_advertising_token': __uid2_advertising_token_Test1
'_jxcomp': jxcompTest1_
};

// to serve as the object that prebid will call jixie buildRequest with: (param2)
Expand Down Expand Up @@ -237,8 +238,8 @@ describe('jixie Adapter', function () {
.withArgs('_jxtdid')
.returns(jxtdidTest1_);
getCookieStub
.withArgs('__uid2_advertising_token')
.returns(__uid2_advertising_token_Test1);
.withArgs('_jxcomp')
.returns(jxcompTest1_);
getCookieStub
.withArgs('_jxx')
.returns(clientIdTest1_);
Expand Down Expand Up @@ -345,6 +346,22 @@ describe('jixie Adapter', function () {
expect(payload.schain).to.deep.include(schain);
});

it('it should populate the floor info when available', function () {
let oneSpecialBidReq = deepClone(bidRequests_[0]);
let request, payload = null;
// 1 floor is not set
request = spec.buildRequests([oneSpecialBidReq], bidderRequest_);
payload = JSON.parse(request.data);
expect(payload.bids[0].bidFloor).to.not.exist;

// 2 floor is set
let getFloorResponse = { currency: 'USD', floor: 2.1 };
oneSpecialBidReq.getFloor = () => getFloorResponse;
request = spec.buildRequests([oneSpecialBidReq], bidderRequest_);
payload = JSON.parse(request.data);
expect(payload.bids[0].bidFloor).to.exist.and.to.equal(2.1);
});

it('should populate eids when supported userIds are available', function () {
const oneSpecialBidReq = Object.assign({}, bidRequests_[0], {
userIdAsEids: [
Expand Down