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

Adquery Bid Adapter : changes in adqueryIdSystem, fix auctionId leak #10128

Merged
merged 31 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d7b9e7c
added referrer to bid request
adquery May 15, 2023
9c94a25
Merge branch 'orgin/master'
adquery May 16, 2023
2165b5e
added referrer to bid request - tests
adquery May 22, 2023
9fbea74
Merge branch 'orgin/master'
adquery May 26, 2023
1d70d9c
adquery/prebid_qid_work1
adquery May 26, 2023
bafd222
adquery/prebid_qid_work1
adquery Jun 7, 2023
a7b2bf7
adquery/prebid_qid_work1
adquery Jun 12, 2023
6953a10
Merge branch 'orgin/master' into adquery/prebid_qid_work1
adquery Jun 21, 2023
8275876
adquery/prebid_qid_work1
adquery Jun 21, 2023
1834f4a
adquery/prebid_qid_work1
adquery Jun 21, 2023
5718b6d
adquery/prebid_qid_work1
adquery Jun 22, 2023
39f3f6a
adquery/prebid_qid_work1
adquery Jun 22, 2023
fea9b79
adquery/prebid_qid_work1
adquery Jun 26, 2023
7e02932
adquery/prebid_qid_work1
adquery Jun 26, 2023
1c03b22
adquery/prebid_qid_work1
adquery Jun 26, 2023
597d624
adquery/prebid_qid_work1
adquery Jun 26, 2023
6d29198
adquery/prebid_qid_work1
adquery Jun 26, 2023
7250954
adquery/prebid_qid_work1
adquery Jun 26, 2023
69212d0
adquery/prebid_qid_work1
adquery Jun 26, 2023
10ada84
adquery/prebid_qid_work1
adquery Jun 26, 2023
f193d78
adquery/prebid_qid_work1
adquery Jun 26, 2023
37e370b
adquery/prebid_qid_work1
adquery Jun 26, 2023
4ce0552
adquery/prebid_qid_work1
adquery Jun 26, 2023
ea7ad02
adquery/prebid_qid_work1
adquery Jul 20, 2023
c7f04d7
adquery/prebid_qid_work1
adquery Jul 20, 2023
37a8291
adquery/prebid_qid_work1
adquery Jul 20, 2023
dc0007e
Merge branch 'orgin/master' into adquery/prebid_qid_work1
adquery Jul 20, 2023
5cc0f08
adquery/prebid_qid_work1
adquery Jul 20, 2023
a0da0e4
adquery/prebid_qid_work1
adquery Jul 20, 2023
62881c1
Merge branch 'orgin/master' into adquery/prebid_qid_work1
adquery Aug 2, 2023
9756b21
adquery/prebid_qid_work1
adquery Aug 2, 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
35 changes: 17 additions & 18 deletions modules/adqueryBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
import { logInfo, buildUrl, triggerPixel, parseSizesInput } from '../src/utils.js';
import { getStorageManager } from '../src/storageManager.js';
import {buildUrl, isFn, isStr, logInfo, parseSizesInput, triggerPixel} from '../src/utils.js';
import {getStorageManager} from '../src/storageManager.js';

const ADQUERY_GVLID = 902;
const ADQUERY_BIDDER_CODE = 'adquery';
Expand Down Expand Up @@ -55,10 +55,6 @@
* @return {Bid[]}
*/
interpretResponse: (response, request) => {
logInfo(request);
logInfo(response);

let qid = null;
const res = response && response.body && response.body.data;
let bidResponses = [];

Expand Down Expand Up @@ -87,17 +83,6 @@
bidResponses.push(bidResponse);
logInfo('bidResponses', bidResponses);

if (res && res.qid) {
if (storage.getDataFromLocalStorage('qid')) {
qid = storage.getDataFromLocalStorage('qid');
if (qid && qid.includes('%7B%22')) {
storage.setDataInLocalStorage('qid', res.qid);
}
} else {
storage.setDataInLocalStorage('qid', res.qid);
}
}

return bidResponses;
},

Expand Down Expand Up @@ -189,8 +174,22 @@
}

};

function buildRequest(validBidRequests, bidderRequest) {
let bid = validBidRequests;
logInfo('buildRequest: ', bid);

let userId = null;
if (bid.userId && bid.userId.qid) {
userId = bid.userId.qid
}

if (!userId) {
userId = Math.random().toString(36).substring(2) + Date.now().toString(36);
Fixed Show fixed Hide fixed
storage.setDataInLocalStorage('qid', userId);
window.qid = userId;
}

let pageUrl = '';
if (bidderRequest && bidderRequest.refererInfo) {
pageUrl = bidderRequest.refererInfo.page || '';
Expand All @@ -203,7 +202,7 @@
auctionId: bid.auctionId,
type: bid.params.type,
adUnitCode: bid.adUnitCode,
bidQid: storage.getDataFromLocalStorage('qid') || null,
bidQid: userId,
bidId: bid.bidId,
bidder: bid.bidder,
bidPageUrl: pageUrl,
Expand Down
56 changes: 28 additions & 28 deletions modules/adqueryIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import {ajax} from '../src/ajax.js';
import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
import { isFn, isStr, isPlainObject, logError } from '../src/utils.js';
import {isFn, isPlainObject, isStr, logError, logInfo} from '../src/utils.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

const MODULE_NAME = 'qid';
Expand Down Expand Up @@ -51,11 +51,7 @@ export const adqueryIdSubmodule = {
* @returns {{qid:Object}}
*/
decode(value) {
let qid = storage.getDataFromLocalStorage('qid');
if (isStr(qid)) {
return {qid: qid};
}
return (value && typeof value['qid'] === 'string') ? { 'qid': value['qid'] } : undefined;
return {qid: value}
},
/**
* performs action to obtain id and return a value in the callback's response argument
Expand All @@ -64,38 +60,42 @@ export const adqueryIdSubmodule = {
* @returns {IdResponse|undefined}
*/
getId(config) {
logInfo('adqueryIdSubmodule getId');
if (!isPlainObject(config.params)) {
config.params = {};
}
debugger;
const url = paramOrDefault(config.params.url,
`https://bidder.adquery.io/prebid/qid`,
config.params.urlArg);

const resp = function (callback) {
let qid = storage.getDataFromLocalStorage('qid');
if (isStr(qid)) {
const responseObj = {qid: qid};
callback(responseObj);
} else {
const callbacks = {
success: response => {
let responseObj;
if (response) {
try {
responseObj = JSON.parse(response);
} catch (error) {
logError(error);
}
let qid = window.qid;
logInfo('adqueryIdSubmodule ID QID:', qid);

const callbacks = {
success: response => {
let responseObj;
if (response) {
try {
responseObj = JSON.parse(response);
} catch (error) {
logError(error);
}
callback(responseObj);
},
error: error => {
logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
callback();
}
};
ajax(url, callbacks, undefined, {method: 'GET'});
}
if (responseObj.qid) {
let myQid = responseObj.qid;
storage.setDataInLocalStorage('qid', myQid);
return callback(myQid);
}
callback();
},
error: error => {
logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
callback();
}
};
ajax(url + '?qid=' + qid, callbacks, undefined, {method: 'GET'});
};
return {callback: resp};
}
Expand Down