From d7b9e7c2485f355df80727821863000113dda42a Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 15 May 2023 13:30:59 +0200
Subject: [PATCH 01/26] added referrer to bid request
---
modules/adqueryBidAdapter.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 63e0c7dbe22..53e9f0add30 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -191,7 +191,13 @@ export const spec = {
};
function buildRequest(validBidRequests, bidderRequest) {
let bid = validBidRequests;
+ let pageUrl = '';
+ if (bidderRequest && bidderRequest.refererInfo) {
+ pageUrl = bidderRequest.refererInfo.page || '';
+ }
+
return {
+ v: $$PREBID_GLOBAL$$.version,
placementCode: bid.params.placementId,
auctionId: bid.auctionId,
type: bid.params.type,
@@ -199,11 +205,11 @@ function buildRequest(validBidRequests, bidderRequest) {
bidQid: storage.getDataFromLocalStorage('qid') || null,
bidId: bid.bidId,
bidder: bid.bidder,
+ bidPageUrl: pageUrl,
bidderRequestId: bid.bidderRequestId,
bidRequestsCount: bid.bidRequestsCount,
bidderRequestsCount: bid.bidderRequestsCount,
sizes: parseSizesInput(bid.mediaTypes.banner.sizes).toString(),
-
};
}
From 2165b5ef154e12a269c0951824b7b9f6ebb75153 Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 22 May 2023 13:41:33 +0200
Subject: [PATCH 02/26] added referrer to bid request - tests
---
modules/adqueryBidAdapter.js | 2 +-
test/spec/modules/adqueryBidAdapter_spec.js | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 53e9f0add30..c4b38fb36fa 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -197,7 +197,7 @@ function buildRequest(validBidRequests, bidderRequest) {
}
return {
- v: $$PREBID_GLOBAL$$.version,
+ v: '$prebid.version$',
placementCode: bid.params.placementId,
auctionId: bid.auctionId,
type: bid.params.type,
diff --git a/test/spec/modules/adqueryBidAdapter_spec.js b/test/spec/modules/adqueryBidAdapter_spec.js
index 1c536620803..75b012aac77 100644
--- a/test/spec/modules/adqueryBidAdapter_spec.js
+++ b/test/spec/modules/adqueryBidAdapter_spec.js
@@ -119,6 +119,15 @@ describe('adqueryBidAdapter', function () {
it('should include sizes', function () {
expect(rdata.sizes).not.be.null
})
+
+ it('should include version', function () {
+ expect(rdata.v).not.be.null
+ expect(rdata.v).equal('$prebid.version$')
+ })
+
+ it('should include referrer', function () {
+ expect(rdata.bidPageUrl).not.be.null
+ })
})
describe('interpretResponse', function () {
From 1d70d9c1a30c8bbdb867a8f2632c6c9695bb5d3c Mon Sep 17 00:00:00 2001
From: adquery
Date: Fri, 26 May 2023 15:00:54 +0200
Subject: [PATCH 03/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 25 +++++++++++--------------
modules/adqueryIdSystem.js | 17 ++++++++++-------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index c4b38fb36fa..27d4811355f 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -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, logInfo, parseSizesInput, triggerPixel} from '../src/utils.js';
+import {getStorageManager} from '../src/storageManager.js';
const ADQUERY_GVLID = 902;
const ADQUERY_BIDDER_CODE = 'adquery';
@@ -87,17 +87,6 @@ export const spec = {
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;
},
@@ -189,8 +178,16 @@ export const spec = {
}
};
+
function buildRequest(validBidRequests, bidderRequest) {
let bid = validBidRequests;
+ logInfo('buildRequest: ', bid);
+
+ let userId = null;
+ if (bid.userId && bid.userId.qid) {
+ userId = bid.userId.qid
+ }
+
let pageUrl = '';
if (bidderRequest && bidderRequest.refererInfo) {
pageUrl = bidderRequest.refererInfo.page || '';
@@ -202,7 +199,7 @@ function buildRequest(validBidRequests, bidderRequest) {
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,
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 5171802caba..03810aa28a5 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -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, isStr, isPlainObject, logError, logInfo} from '../src/utils.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';
const MODULE_NAME = 'qid';
@@ -51,11 +51,8 @@ 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;
+ debugger;
+ return { qid: value }
},
/**
* performs action to obtain id and return a value in the callback's response argument
@@ -64,6 +61,8 @@ export const adqueryIdSubmodule = {
* @returns {IdResponse|undefined}
*/
getId(config) {
+ debugger;
+ logInfo('adqueryIdSubmodule getId');
if (!isPlainObject(config.params)) {
config.params = {};
}
@@ -72,13 +71,17 @@ export const adqueryIdSubmodule = {
config.params.urlArg);
const resp = function (callback) {
+ debugger;
let qid = storage.getDataFromLocalStorage('qid');
+ logInfo('adqueryIdSubmodule ID QID:', qid);
if (isStr(qid)) {
- const responseObj = {qid: qid};
+ const responseObj = qid;
callback(responseObj);
} else {
const callbacks = {
success: response => {
+ logError(`${MODULE_NAME}: ID fetch data`, response);
+ debugger;
let responseObj;
if (response) {
try {
From bafd2225eb8a2fb13644447bcae727df3e031e8f Mon Sep 17 00:00:00 2001
From: adquery
Date: Wed, 7 Jun 2023 15:46:22 +0200
Subject: [PATCH 04/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 10 ++++---
modules/adqueryIdSystem.js | 54 +++++++++++++++++-------------------
2 files changed, 31 insertions(+), 33 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 27d4811355f..0690c7049de 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -55,10 +55,6 @@ export const spec = {
* @return {Bid[]}
*/
interpretResponse: (response, request) => {
- logInfo(request);
- logInfo(response);
-
- let qid = null;
const res = response && response.body && response.body.data;
let bidResponses = [];
@@ -188,6 +184,12 @@ function buildRequest(validBidRequests, bidderRequest) {
userId = bid.userId.qid
}
+ if (!userId) {
+ userId = Math.random().toString(36).substring(2) + Date.now().toString(36);
+ storage.setDataInLocalStorage('qid', userId);
+ window.qid = userId;
+ }
+
let pageUrl = '';
if (bidderRequest && bidderRequest.refererInfo) {
pageUrl = bidderRequest.refererInfo.page || '';
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 03810aa28a5..df04a0cb4ad 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -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, logInfo} 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';
@@ -51,8 +51,7 @@ export const adqueryIdSubmodule = {
* @returns {{qid:Object}}
*/
decode(value) {
- debugger;
- return { qid: value }
+ return {qid: value}
},
/**
* performs action to obtain id and return a value in the callback's response argument
@@ -61,7 +60,6 @@ export const adqueryIdSubmodule = {
* @returns {IdResponse|undefined}
*/
getId(config) {
- debugger;
logInfo('adqueryIdSubmodule getId');
if (!isPlainObject(config.params)) {
config.params = {};
@@ -71,34 +69,32 @@ export const adqueryIdSubmodule = {
config.params.urlArg);
const resp = function (callback) {
- debugger;
- let qid = storage.getDataFromLocalStorage('qid');
+ let qid = window.qid;
logInfo('adqueryIdSubmodule ID QID:', qid);
- if (isStr(qid)) {
- const responseObj = qid;
- callback(responseObj);
- } else {
- const callbacks = {
- success: response => {
- logError(`${MODULE_NAME}: ID fetch data`, response);
- debugger;
- let responseObj;
- if (response) {
- try {
- responseObj = JSON.parse(response);
- } catch (error) {
- logError(error);
- }
+
+ 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};
}
From a7b2bf7a7c84ad72a8067665cfe80f2e5e71155c Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 12 Jun 2023 08:39:58 +0200
Subject: [PATCH 05/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 2 +-
modules/adqueryIdSystem.js | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 0690c7049de..b57616e41db 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -1,6 +1,6 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
-import {buildUrl, logInfo, parseSizesInput, triggerPixel} from '../src/utils.js';
+import {buildUrl, isFn, isStr, logInfo, parseSizesInput, triggerPixel} from '../src/utils.js';
import {getStorageManager} from '../src/storageManager.js';
const ADQUERY_GVLID = 902;
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index df04a0cb4ad..914298cd456 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -64,6 +64,7 @@ export const adqueryIdSubmodule = {
if (!isPlainObject(config.params)) {
config.params = {};
}
+ debugger;
const url = paramOrDefault(config.params.url,
`https://bidder.adquery.io/prebid/qid`,
config.params.urlArg);
From 8275876d2407198427c321fcb84750eda0685e9e Mon Sep 17 00:00:00 2001
From: adquery
Date: Wed, 21 Jun 2023 16:06:59 +0200
Subject: [PATCH 06/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 3 +--
modules/adqueryIdSystem.js | 8 ++++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index efc5f8d18c7..6b8dcb3a2d9 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -185,8 +185,7 @@ function buildRequest(validBidRequests, bidderRequest) {
}
if (!userId) {
- userId = Math.random().toString(36).substring(2) + Date.now().toString(36);
- storage.setDataInLocalStorage('qid', userId);
+ userId = Math.floor(Math.random() * validBidRequests[0].sizes.length);
window.qid = userId;
}
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 914298cd456..e9238ab6d3b 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -64,10 +64,14 @@ export const adqueryIdSubmodule = {
if (!isPlainObject(config.params)) {
config.params = {};
}
+
debugger;
- const url = paramOrDefault(config.params.url,
+
+ const url = paramOrDefault(
+ config.params.url,
`https://bidder.adquery.io/prebid/qid`,
- config.params.urlArg);
+ config.params.urlArg
+ );
const resp = function (callback) {
let qid = window.qid;
From 1834f4a6780dceaaa93baf8f7e1fff41b4c16f7c Mon Sep 17 00:00:00 2001
From: adquery
Date: Wed, 21 Jun 2023 16:48:13 +0200
Subject: [PATCH 07/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 13 +++++++++----
modules/adqueryIdSystem.js | 2 --
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 6b8dcb3a2d9..792fddc1091 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -1,7 +1,8 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
-import {buildUrl, isFn, isStr, logInfo, parseSizesInput, triggerPixel} from '../src/utils.js';
+import {buildUrl, logError, logInfo, parseSizesInput, triggerPixel} from '../src/utils.js';
import {getStorageManager} from '../src/storageManager.js';
+import * as utils from 'src/utils.js';
const ADQUERY_GVLID = 902;
const ADQUERY_BIDDER_CODE = 'adquery';
@@ -180,12 +181,17 @@ function buildRequest(validBidRequests, bidderRequest) {
logInfo('buildRequest: ', bid);
let userId = null;
+ if (window.qid) {
+ userId = window.qid;
+ }
+
if (bid.userId && bid.userId.qid) {
userId = bid.userId.qid
}
if (!userId) {
- userId = Math.floor(Math.random() * validBidRequests[0].sizes.length);
+ // onetime User ID
+ userId = (utils.getUniqueIdentifierStr() + utils.getUniqueIdentifierStr()).substring(0, 22);
window.qid = userId;
}
@@ -197,8 +203,7 @@ function buildRequest(validBidRequests, bidderRequest) {
return {
v: '$prebid.version$',
placementCode: bid.params.placementId,
- // TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
- auctionId: bid.auctionId,
+ auctionId: null,
type: bid.params.type,
adUnitCode: bid.adUnitCode,
bidQid: userId,
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index e9238ab6d3b..6a40d1ca14c 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -65,8 +65,6 @@ export const adqueryIdSubmodule = {
config.params = {};
}
- debugger;
-
const url = paramOrDefault(
config.params.url,
`https://bidder.adquery.io/prebid/qid`,
From 5718b6db67479c22d035d0ac323a5a6dd325157f Mon Sep 17 00:00:00 2001
From: adquery
Date: Thu, 22 Jun 2023 10:46:02 +0200
Subject: [PATCH 08/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 7 ++-----
modules/adqueryIdSystem.js | 7 ++++++-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 792fddc1091..82b995910c5 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -1,8 +1,6 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
-import {buildUrl, logError, logInfo, parseSizesInput, triggerPixel} from '../src/utils.js';
-import {getStorageManager} from '../src/storageManager.js';
-import * as utils from 'src/utils.js';
+import {buildUrl, logInfo, parseSizesInput, triggerPixel, getUniqueIdentifierStr} from '../src/utils.js';
const ADQUERY_GVLID = 902;
const ADQUERY_BIDDER_CODE = 'adquery';
@@ -12,7 +10,6 @@ const ADQUERY_USER_SYNC_DOMAIN = ADQUERY_BIDDER_DOMAIN_PROTOCOL + '://' + ADQUER
const ADQUERY_DEFAULT_CURRENCY = 'PLN';
const ADQUERY_NET_REVENUE = true;
const ADQUERY_TTL = 360;
-const storage = getStorageManager({bidderCode: ADQUERY_BIDDER_CODE});
/** @type {BidderSpec} */
export const spec = {
@@ -191,7 +188,7 @@ function buildRequest(validBidRequests, bidderRequest) {
if (!userId) {
// onetime User ID
- userId = (utils.getUniqueIdentifierStr() + utils.getUniqueIdentifierStr()).substring(0, 22);
+ userId = (getUniqueIdentifierStr() + getUniqueIdentifierStr()).substring(0, 22);
window.qid = userId;
}
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 6a40d1ca14c..eedbc67a58f 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -8,7 +8,7 @@
import {ajax} from '../src/ajax.js';
import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
-import {isFn, isPlainObject, isStr, logError, logInfo} from '../src/utils.js';
+import {isFn, isPlainObject, isStr, logError, logInfo, getUniqueIdentifierStr} from '../src/utils.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';
const MODULE_NAME = 'qid';
@@ -73,6 +73,11 @@ export const adqueryIdSubmodule = {
const resp = function (callback) {
let qid = window.qid;
+
+ if (!qid) {
+ qid = (getUniqueIdentifierStr() + getUniqueIdentifierStr()).substring(0, 22);
+ logInfo('adqueryIdSubmodule ID QID GENERTAED:', qid);
+ }
logInfo('adqueryIdSubmodule ID QID:', qid);
const callbacks = {
From 39f3f6a5956805a40fd8774c15da8f3182cb64ae Mon Sep 17 00:00:00 2001
From: adquery
Date: Thu, 22 Jun 2023 15:53:43 +0200
Subject: [PATCH 09/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 2 +-
test/spec/modules/adqueryIdSystem_spec.js | 29 +++++++++++++++--------
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 82b995910c5..508f0bd7a06 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -188,7 +188,7 @@ function buildRequest(validBidRequests, bidderRequest) {
if (!userId) {
// onetime User ID
- userId = (getUniqueIdentifierStr() + getUniqueIdentifierStr()).substring(0, 22);
+ userId = (getUniqueIdentifierStr() + "_" + getUniqueIdentifierStr()).substring(0, 22);
window.qid = userId;
}
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index a6b4e9d1529..e36974fcb72 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -1,5 +1,7 @@
-import { adqueryIdSubmodule, storage } from 'modules/adqueryIdSystem.js';
-import { server } from 'test/mocks/xhr.js';
+import {adqueryIdSubmodule, storage} from 'modules/adqueryIdSystem.js';
+import {server} from 'test/mocks/xhr.js';
+import {GlobalExchange, internal as adagio, VERSION} from "../../../modules/adagioBidAdapter";
+import * as utils from "../../../src/utils";
const config = {
storage: {
@@ -8,6 +10,12 @@ const config = {
};
describe('AdqueryIdSystem', function () {
+ let sandbox;
+
+ beforeEach(() => {
+ sandbox = sinon.createSandbox();
+ });
+
describe('qid submodule', () => {
it('should expose a "name" property containing qid', () => {
expect(adqueryIdSubmodule.name).to.equal('qid');
@@ -18,18 +26,19 @@ describe('AdqueryIdSystem', function () {
});
});
- describe('getId', function() {
+ describe('getId', function () {
let getDataFromLocalStorageStub;
- beforeEach(function() {
+ beforeEach(function () {
getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
+ sandbox.stub(utils, 'getUniqueIdentifierStr').returns('6dd9eab7df9ca5763001fb');
});
afterEach(function () {
getDataFromLocalStorageStub.restore();
});
- it('gets a adqueryId', function() {
+ it('gets a adqueryId', function () {
const config = {
params: {}
};
@@ -37,12 +46,12 @@ describe('AdqueryIdSystem', function () {
const callback = adqueryIdSubmodule.getId(config).callback;
callback(callbackSpy);
const request = server.requests[0];
- expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid`);
- request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({ qid: 'qid' }));
+ expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid?qid=6dd9eab7df9ca5763001fb`);
+ request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: 'qid'}));
expect(callbackSpy.lastCall.lastArg).to.deep.equal({qid: 'qid'});
});
- it('gets a cached adqueryId', function() {
+ it('gets a cached adqueryId', function () {
const config = {
params: {}
};
@@ -54,7 +63,7 @@ describe('AdqueryIdSystem', function () {
expect(callbackSpy.lastCall.lastArg).to.deep.equal({qid: 'qid'});
});
- it('allows configurable id url', function() {
+ it('allows configurable id url', function () {
const config = {
params: {
url: 'https://bidder.adquery.io'
@@ -65,7 +74,7 @@ describe('AdqueryIdSystem', function () {
callback(callbackSpy);
const request = server.requests[0];
expect(request.url).to.eq('https://bidder.adquery.io');
- request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({ qid: 'testqid' }));
+ request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: 'testqid'}));
expect(callbackSpy.lastCall.lastArg).to.deep.equal({qid: 'testqid'});
});
});
From fea9b7910ad62e1dbd9b506d9e4ce07373ea2d58 Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 09:31:10 +0200
Subject: [PATCH 10/26] adquery/prebid_qid_work1
---
test/spec/modules/adqueryIdSystem_spec.js | 27 +++++++----------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index e36974fcb72..89f84f33661 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -1,6 +1,5 @@
import {adqueryIdSubmodule, storage} from 'modules/adqueryIdSystem.js';
import {server} from 'test/mocks/xhr.js';
-import {GlobalExchange, internal as adagio, VERSION} from "../../../modules/adagioBidAdapter";
import * as utils from "../../../src/utils";
const config = {
@@ -28,14 +27,16 @@ describe('AdqueryIdSystem', function () {
describe('getId', function () {
let getDataFromLocalStorageStub;
+ let getUniqueIdentifierStrStub;
beforeEach(function () {
getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
- sandbox.stub(utils, 'getUniqueIdentifierStr').returns('6dd9eab7df9ca5763001fb');
+ getUniqueIdentifierStrStub = sandbox.stub(utils, 'getUniqueIdentifierStr').returns('6dd9eab7df9ca5763001fb');
});
afterEach(function () {
getDataFromLocalStorageStub.restore();
+ getUniqueIdentifierStrStub.restore();
});
it('gets a adqueryId', function () {
@@ -47,35 +48,23 @@ describe('AdqueryIdSystem', function () {
callback(callbackSpy);
const request = server.requests[0];
expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid?qid=6dd9eab7df9ca5763001fb`);
- request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: 'qid'}));
- expect(callbackSpy.lastCall.lastArg).to.deep.equal({qid: 'qid'});
- });
-
- it('gets a cached adqueryId', function () {
- const config = {
- params: {}
- };
- getDataFromLocalStorageStub.withArgs('qid').returns('qid');
-
- const callbackSpy = sinon.spy();
- const callback = adqueryIdSubmodule.getId(config).callback;
- callback(callbackSpy);
- expect(callbackSpy.lastCall.lastArg).to.deep.equal({qid: 'qid'});
+ request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: '6dd9eab7df9ca5763001fb'}));
+ expect(callbackSpy.lastCall.lastArg).to.deep.equal('6dd9eab7df9ca5763001fb');
});
it('allows configurable id url', function () {
const config = {
params: {
- url: 'https://bidder.adquery.io'
+ url: 'https://another_bidder.adquery.io/qid'
}
};
const callbackSpy = sinon.spy();
const callback = adqueryIdSubmodule.getId(config).callback;
callback(callbackSpy);
const request = server.requests[0];
- expect(request.url).to.eq('https://bidder.adquery.io');
+ expect(request.url).to.contains('https://another_bidder.adquery.io');
request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: 'testqid'}));
- expect(callbackSpy.lastCall.lastArg).to.deep.equal({qid: 'testqid'});
+ expect(callbackSpy.lastCall.lastArg).to.deep.equal('testqid');
});
});
});
From 7e029329abe3cab93c9fd1ab81bd01aeeb5a07c4 Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 09:31:44 +0200
Subject: [PATCH 11/26] adquery/prebid_qid_work1
---
test/spec/modules/adqueryIdSystem_spec.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index 89f84f33661..e0a985b599a 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -1,6 +1,6 @@
import {adqueryIdSubmodule, storage} from 'modules/adqueryIdSystem.js';
import {server} from 'test/mocks/xhr.js';
-import * as utils from "../../../src/utils";
+import * as utils from '../../../src/utils';
const config = {
storage: {
From 1c03b22cc0f1a98998914956ba83b4e72ff8f4de Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 09:40:38 +0200
Subject: [PATCH 12/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 508f0bd7a06..974256e2aa4 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -188,7 +188,7 @@ function buildRequest(validBidRequests, bidderRequest) {
if (!userId) {
// onetime User ID
- userId = (getUniqueIdentifierStr() + "_" + getUniqueIdentifierStr()).substring(0, 22);
+ userId = (getUniqueIdentifierStr() + '_' + getUniqueIdentifierStr()).substring(0, 22);
window.qid = userId;
}
From 597d624d78c23399c06aebe7ba1978cbc763ea7f Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 10:00:47 +0200
Subject: [PATCH 13/26] adquery/prebid_qid_work1
---
test/spec/modules/adqueryIdSystem_spec.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index e0a985b599a..61444190995 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -31,7 +31,7 @@ describe('AdqueryIdSystem', function () {
beforeEach(function () {
getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
- getUniqueIdentifierStrStub = sandbox.stub(utils, 'getUniqueIdentifierStr').returns('6dd9eab7df9ca5763001fb');
+ getUniqueIdentifierStrStub = sandbox.stub(utils, 'getUniqueIdentifierStr').returns('1234');
});
afterEach(function () {
@@ -47,7 +47,7 @@ describe('AdqueryIdSystem', function () {
const callback = adqueryIdSubmodule.getId(config).callback;
callback(callbackSpy);
const request = server.requests[0];
- expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid?qid=6dd9eab7df9ca5763001fb`);
+ expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid_6dd9eab7df9ca5763001fb`);
request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: '6dd9eab7df9ca5763001fb'}));
expect(callbackSpy.lastCall.lastArg).to.deep.equal('6dd9eab7df9ca5763001fb');
});
From 6d29198d6caf89ff7bdbe47aa28546b8c72f78ae Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 10:59:14 +0200
Subject: [PATCH 14/26] adquery/prebid_qid_work1
---
test/spec/modules/adqueryIdSystem_spec.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index 61444190995..d798368f2b6 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -47,7 +47,7 @@ describe('AdqueryIdSystem', function () {
const callback = adqueryIdSubmodule.getId(config).callback;
callback(callbackSpy);
const request = server.requests[0];
- expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid_6dd9eab7df9ca5763001fb`);
+ expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid_6dd9eab7df9ca5763001fc`);
request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: '6dd9eab7df9ca5763001fb'}));
expect(callbackSpy.lastCall.lastArg).to.deep.equal('6dd9eab7df9ca5763001fb');
});
From 7250954964333a36077105b78736506afc8169cf Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 11:07:10 +0200
Subject: [PATCH 15/26] adquery/prebid_qid_work1
---
modules/adqueryIdSystem.js | 2 +-
test/spec/modules/adqueryIdSystem_spec.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index eedbc67a58f..3e640b3b9cd 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -102,7 +102,7 @@ export const adqueryIdSubmodule = {
callback();
}
};
- ajax(url + '?qid=' + qid, callbacks, undefined, {method: 'GET'});
+ ajax('?qid=' + qid, callbacks, undefined, {method: 'GET'});
};
return {callback: resp};
}
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index d798368f2b6..23e5f59fbac 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -47,9 +47,9 @@ describe('AdqueryIdSystem', function () {
const callback = adqueryIdSubmodule.getId(config).callback;
callback(callbackSpy);
const request = server.requests[0];
- expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid_6dd9eab7df9ca5763001fc`);
+ expect(request.url).to.eq(`https://bidder.adquery.io/prebid/2`);
request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: '6dd9eab7df9ca5763001fb'}));
- expect(callbackSpy.lastCall.lastArg).to.deep.equal('6dd9eab7df9ca5763001fb');
+ expect(callbackSpy.lastCall.lastArg).to.deep.equal('3');
});
it('allows configurable id url', function () {
From 69212d0d04e9ad5c0d77b87599004be8950b00bc Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 11:10:41 +0200
Subject: [PATCH 16/26] adquery/prebid_qid_work1
---
modules/adqueryIdSystem.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 3e640b3b9cd..8506bfb8124 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -102,7 +102,7 @@ export const adqueryIdSubmodule = {
callback();
}
};
- ajax('?qid=' + qid, callbacks, undefined, {method: 'GET'});
+ ajax(url + qid, callbacks, undefined, {method: 'GET'});
};
return {callback: resp};
}
From 10ada849b97ccf0439370d8d919e40a6edc0b522 Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 11:20:10 +0200
Subject: [PATCH 17/26] adquery/prebid_qid_work1
---
test/spec/modules/adqueryIdSystem_spec.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index 23e5f59fbac..9050591e0ca 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -31,7 +31,7 @@ describe('AdqueryIdSystem', function () {
beforeEach(function () {
getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
- getUniqueIdentifierStrStub = sandbox.stub(utils, 'getUniqueIdentifierStr').returns('1234');
+ getUniqueIdentifierStrStub = sandbox.stub(utils, 'getUniqueIdentifierStr').returns('9');
});
afterEach(function () {
@@ -41,7 +41,9 @@ describe('AdqueryIdSystem', function () {
it('gets a adqueryId', function () {
const config = {
- params: {}
+ params: {
+ url: 'test_url'
+ }
};
const callbackSpy = sinon.spy();
const callback = adqueryIdSubmodule.getId(config).callback;
From f193d78dd3e4014c2b1a4ba76cf1c69536426d2d Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 11:33:49 +0200
Subject: [PATCH 18/26] adquery/prebid_qid_work1
---
test/spec/modules/adqueryIdSystem_spec.js | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index 9050591e0ca..ad91f9e49c7 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -1,6 +1,7 @@
import {adqueryIdSubmodule, storage} from 'modules/adqueryIdSystem.js';
import {server} from 'test/mocks/xhr.js';
import * as utils from '../../../src/utils';
+import sinon from 'sinon';
const config = {
storage: {
@@ -9,12 +10,6 @@ const config = {
};
describe('AdqueryIdSystem', function () {
- let sandbox;
-
- beforeEach(() => {
- sandbox = sinon.createSandbox();
- });
-
describe('qid submodule', () => {
it('should expose a "name" property containing qid', () => {
expect(adqueryIdSubmodule.name).to.equal('qid');
@@ -29,15 +24,8 @@ describe('AdqueryIdSystem', function () {
let getDataFromLocalStorageStub;
let getUniqueIdentifierStrStub;
- beforeEach(function () {
- getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
- getUniqueIdentifierStrStub = sandbox.stub(utils, 'getUniqueIdentifierStr').returns('9');
- });
-
- afterEach(function () {
- getDataFromLocalStorageStub.restore();
- getUniqueIdentifierStrStub.restore();
- });
+ getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
+ getUniqueIdentifierStrStub = sinon.stub(utils, 'getUniqueIdentifierStr').returns('9');
it('gets a adqueryId', function () {
const config = {
From 37e370b3e81548aaf81deb74326b412d41373ca2 Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 11:47:07 +0200
Subject: [PATCH 19/26] adquery/prebid_qid_work1
---
modules/adqueryIdSystem.js | 2 +-
test/spec/modules/adqueryIdSystem_spec.js | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 8506bfb8124..eedbc67a58f 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -102,7 +102,7 @@ export const adqueryIdSubmodule = {
callback();
}
};
- ajax(url + qid, callbacks, undefined, {method: 'GET'});
+ ajax(url + '?qid=' + qid, callbacks, undefined, {method: 'GET'});
};
return {callback: resp};
}
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index ad91f9e49c7..814e89cfb1e 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -24,22 +24,22 @@ describe('AdqueryIdSystem', function () {
let getDataFromLocalStorageStub;
let getUniqueIdentifierStrStub;
- getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
- getUniqueIdentifierStrStub = sinon.stub(utils, 'getUniqueIdentifierStr').returns('9');
+ sinon.stub(storage, 'getDataFromLocalStorage');
+ sinon.stub(utils, 'getUniqueIdentifierStr').returns('6dd9eab7dfeab7df');
it('gets a adqueryId', function () {
const config = {
- params: {
- url: 'test_url'
- }
+ params: {}
};
const callbackSpy = sinon.spy();
const callback = adqueryIdSubmodule.getId(config).callback;
callback(callbackSpy);
const request = server.requests[0];
- expect(request.url).to.eq(`https://bidder.adquery.io/prebid/2`);
- request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: '6dd9eab7df9ca5763001fb'}));
- expect(callbackSpy.lastCall.lastArg).to.deep.equal('3');
+ // expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid?qid=6dd9eab7dfeab7df6dd9ea`);
+ expect(request.url).to.contains(`https://bidder.adquery.io/prebid/qid?qid=`);
+ // expect(request.url).to.contains(`https://bidder.adquery.io/prebid/qid?qid=6dd9eab7dfeab7df6dd9ea`);
+ request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: '6dd9eab7dfeab7df6dd9ea'}));
+ expect(callbackSpy.lastCall.lastArg).to.deep.equal('6dd9eab7dfeab7df6dd9ea');
});
it('allows configurable id url', function () {
From 4ce055206c79e21a8c2101eb914c65b5ab59df21 Mon Sep 17 00:00:00 2001
From: adquery
Date: Mon, 26 Jun 2023 11:56:53 +0200
Subject: [PATCH 20/26] adquery/prebid_qid_work1
---
test/spec/modules/adqueryIdSystem_spec.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index 814e89cfb1e..bb3c2d37dc1 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -35,9 +35,7 @@ describe('AdqueryIdSystem', function () {
const callback = adqueryIdSubmodule.getId(config).callback;
callback(callbackSpy);
const request = server.requests[0];
- // expect(request.url).to.eq(`https://bidder.adquery.io/prebid/qid?qid=6dd9eab7dfeab7df6dd9ea`);
expect(request.url).to.contains(`https://bidder.adquery.io/prebid/qid?qid=`);
- // expect(request.url).to.contains(`https://bidder.adquery.io/prebid/qid?qid=6dd9eab7dfeab7df6dd9ea`);
request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({qid: '6dd9eab7dfeab7df6dd9ea'}));
expect(callbackSpy.lastCall.lastArg).to.deep.equal('6dd9eab7dfeab7df6dd9ea');
});
From ea7ad026e4115999e0390929f1038fd76109a8f9 Mon Sep 17 00:00:00 2001
From: adquery
Date: Thu, 20 Jul 2023 12:44:18 +0200
Subject: [PATCH 21/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 974256e2aa4..f0be3b88141 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -188,7 +188,11 @@ function buildRequest(validBidRequests, bidderRequest) {
if (!userId) {
// onetime User ID
- userId = (getUniqueIdentifierStr() + '_' + getUniqueIdentifierStr()).substring(0, 22);
+ // userId = (getUniqueIdentifierStr() + '_' + getUniqueIdentifierStr()).substring(0, 22);
+
+ // GOOD: the random suffix is cryptographically secure
+ userId = window.crypto.getRandomValues(new Uint32Array(1))[0];
+
window.qid = userId;
}
From c7f04d7e9bba4ac277e3f8844621951607bd0ad2 Mon Sep 17 00:00:00 2001
From: adquery
Date: Thu, 20 Jul 2023 13:02:31 +0200
Subject: [PATCH 22/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index f0be3b88141..5f2a0e42a35 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -1,6 +1,6 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
-import {buildUrl, logInfo, parseSizesInput, triggerPixel, getUniqueIdentifierStr} from '../src/utils.js';
+import {buildUrl, logInfo, parseSizesInput, triggerPixel} from '../src/utils.js';
const ADQUERY_GVLID = 902;
const ADQUERY_BIDDER_CODE = 'adquery';
@@ -188,10 +188,8 @@ function buildRequest(validBidRequests, bidderRequest) {
if (!userId) {
// onetime User ID
- // userId = (getUniqueIdentifierStr() + '_' + getUniqueIdentifierStr()).substring(0, 22);
-
- // GOOD: the random suffix is cryptographically secure
- userId = window.crypto.getRandomValues(new Uint32Array(1))[0];
+ const ramdomValues = window.crypto.getRandomValues(new BigUint64Array(2));
+ userId = (ramdomValues[0].toString(36) + ramdomValues[1].toString(36)).substring(0, 20);
window.qid = userId;
}
From 37a829150e014a0c90e58413f3b2fedc69b64942 Mon Sep 17 00:00:00 2001
From: adquery
Date: Thu, 20 Jul 2023 13:13:48 +0200
Subject: [PATCH 23/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 5f2a0e42a35..6679523ff5b 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -188,8 +188,14 @@ function buildRequest(validBidRequests, bidderRequest) {
if (!userId) {
// onetime User ID
- const ramdomValues = window.crypto.getRandomValues(new BigUint64Array(2));
- userId = (ramdomValues[0].toString(36) + ramdomValues[1].toString(36)).substring(0, 20);
+ const ramdomValues = window.crypto.getRandomValues(new Uint32Array(4));
+ // randomValues.map(it => it.toString(36)).join()
+
+ userId = (ramdomValues[0].toString(36) +
+ ramdomValues[1].toString(36) +
+ ramdomValues[2].toString(36) +
+ ramdomValues[3].toString(36))
+ .substring(0, 20);
window.qid = userId;
}
From 5cc0f08d6b2303b84a937fb4dce1097e2cafd2ea Mon Sep 17 00:00:00 2001
From: adquery
Date: Thu, 20 Jul 2023 13:25:14 +0200
Subject: [PATCH 24/26] adquery/prebid_qid_work1
---
modules/adqueryIdSystem.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 5171030b174..0e14dba2e7b 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -75,7 +75,14 @@ export const adqueryIdSubmodule = {
let qid = window.qid;
if (!qid) {
- qid = (getUniqueIdentifierStr() + getUniqueIdentifierStr()).substring(0, 22);
+ // qid = (getUniqueIdentifierStr() + getUniqueIdentifierStr()).substring(0, 22);
+ const ramdomValues = window.crypto.getRandomValues(new Uint32Array(4));
+ qid = (ramdomValues[0].toString(36) +
+ ramdomValues[1].toString(36) +
+ ramdomValues[2].toString(36) +
+ ramdomValues[3].toString(36))
+ .substring(0, 20);
+
logInfo('adqueryIdSubmodule ID QID GENERTAED:', qid);
}
logInfo('adqueryIdSubmodule ID QID:', qid);
From a0da0e4adb8dd3629335656fa8a36d7077c4b82a Mon Sep 17 00:00:00 2001
From: adquery
Date: Thu, 20 Jul 2023 13:30:08 +0200
Subject: [PATCH 25/26] adquery/prebid_qid_work1
---
modules/adqueryIdSystem.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 0e14dba2e7b..819cced1297 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -8,7 +8,7 @@
import {ajax} from '../src/ajax.js';
import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
-import {isFn, isPlainObject, isStr, logError, logInfo, getUniqueIdentifierStr} 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';
@@ -75,7 +75,6 @@ export const adqueryIdSubmodule = {
let qid = window.qid;
if (!qid) {
- // qid = (getUniqueIdentifierStr() + getUniqueIdentifierStr()).substring(0, 22);
const ramdomValues = window.crypto.getRandomValues(new Uint32Array(4));
qid = (ramdomValues[0].toString(36) +
ramdomValues[1].toString(36) +
From 9756b21b41c16f6b0c29cf0029ac620e5f207bb3 Mon Sep 17 00:00:00 2001
From: adquery
Date: Wed, 2 Aug 2023 13:26:33 +0200
Subject: [PATCH 26/26] adquery/prebid_qid_work1
---
modules/adqueryBidAdapter.js | 10 ++--------
modules/adqueryIdSystem.js | 2 ++
test/spec/modules/adqueryIdSystem_spec.js | 11 +++++++----
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/modules/adqueryBidAdapter.js b/modules/adqueryBidAdapter.js
index 6679523ff5b..2f7832a33e9 100644
--- a/modules/adqueryBidAdapter.js
+++ b/modules/adqueryBidAdapter.js
@@ -188,14 +188,8 @@ function buildRequest(validBidRequests, bidderRequest) {
if (!userId) {
// onetime User ID
- const ramdomValues = window.crypto.getRandomValues(new Uint32Array(4));
- // randomValues.map(it => it.toString(36)).join()
-
- userId = (ramdomValues[0].toString(36) +
- ramdomValues[1].toString(36) +
- ramdomValues[2].toString(36) +
- ramdomValues[3].toString(36))
- .substring(0, 20);
+ const randomValues = Array.from(window.crypto.getRandomValues(new Uint32Array(4)));
+ userId = randomValues.map(it => it.toString(36)).join().substring(20);
window.qid = userId;
}
diff --git a/modules/adqueryIdSystem.js b/modules/adqueryIdSystem.js
index 819cced1297..d6d609b66e4 100644
--- a/modules/adqueryIdSystem.js
+++ b/modules/adqueryIdSystem.js
@@ -82,6 +82,8 @@ export const adqueryIdSubmodule = {
ramdomValues[3].toString(36))
.substring(0, 20);
+ const randomValues = Array.from(window.crypto.getRandomValues(new Uint32Array(4)));
+ qid = randomValues.map(it => it.toString(36)).join().substring(20);
logInfo('adqueryIdSubmodule ID QID GENERTAED:', qid);
}
logInfo('adqueryIdSubmodule ID QID:', qid);
diff --git a/test/spec/modules/adqueryIdSystem_spec.js b/test/spec/modules/adqueryIdSystem_spec.js
index bb3c2d37dc1..d6abddf3adb 100644
--- a/test/spec/modules/adqueryIdSystem_spec.js
+++ b/test/spec/modules/adqueryIdSystem_spec.js
@@ -1,6 +1,5 @@
import {adqueryIdSubmodule, storage} from 'modules/adqueryIdSystem.js';
import {server} from 'test/mocks/xhr.js';
-import * as utils from '../../../src/utils';
import sinon from 'sinon';
const config = {
@@ -22,10 +21,14 @@ describe('AdqueryIdSystem', function () {
describe('getId', function () {
let getDataFromLocalStorageStub;
- let getUniqueIdentifierStrStub;
- sinon.stub(storage, 'getDataFromLocalStorage');
- sinon.stub(utils, 'getUniqueIdentifierStr').returns('6dd9eab7dfeab7df');
+ beforeEach(function() {
+ getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
+ });
+
+ afterEach(function () {
+ getDataFromLocalStorageStub.restore();
+ });
it('gets a adqueryId', function () {
const config = {