From dd24af05b083eab5a1016d6fef3e956f6c4bcdd0 Mon Sep 17 00:00:00 2001 From: arasaki Date: Sat, 1 Apr 2023 08:22:05 +0900 Subject: [PATCH 1/3] Pub-X Bid Adapter: adding page url support --- modules/pubxBidAdapter.js | 5 ++++- test/spec/modules/pubxBidAdapter_spec.js | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/pubxBidAdapter.js b/modules/pubxBidAdapter.js index 17c4ba3848e..817ab04b898 100644 --- a/modules/pubxBidAdapter.js +++ b/modules/pubxBidAdapter.js @@ -15,9 +15,12 @@ export const spec = { return validBidRequests.map(bidRequest => { const bidId = bidRequest.bidId; const params = bidRequest.params; + const pageUrl = location.href.replace(/\?.*$/, ''); + const pageEnc = encodeURIComponent(pageUrl); const sid = params.sid; const payload = { - sid: sid + sid: sid, + pu: pageEnc }; return { id: bidId, diff --git a/test/spec/modules/pubxBidAdapter_spec.js b/test/spec/modules/pubxBidAdapter_spec.js index 06bb5b5f638..feaaa244a97 100644 --- a/test/spec/modules/pubxBidAdapter_spec.js +++ b/test/spec/modules/pubxBidAdapter_spec.js @@ -45,8 +45,9 @@ describe('pubxAdapter', function () { const data = { banner: { - sid: '12345abc' - } + sid: '12345abc', + pu: encodeURIComponent(location.href.replace(/\?.*$/, '')), + }, }; it('sends bid request to ENDPOINT via GET', function () { From b2943068cbd223e0d7588d202b78a3891a30d921 Mon Sep 17 00:00:00 2001 From: arasaki Date: Sun, 9 Apr 2023 07:27:04 +0900 Subject: [PATCH 2/3] Refactored to use site.page --- modules/pubxBidAdapter.js | 6 +++--- test/spec/modules/pubxBidAdapter_spec.js | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/pubxBidAdapter.js b/modules/pubxBidAdapter.js index 817ab04b898..b3bedd544d8 100644 --- a/modules/pubxBidAdapter.js +++ b/modules/pubxBidAdapter.js @@ -1,4 +1,4 @@ -import { deepSetValue } from '../src/utils.js'; +import { deepSetValue, deepAccess } from '../src/utils.js'; import { registerBidder } from '../src/adapters/bidderFactory.js'; const BIDDER_CODE = 'pubx'; @@ -15,9 +15,9 @@ export const spec = { return validBidRequests.map(bidRequest => { const bidId = bidRequest.bidId; const params = bidRequest.params; - const pageUrl = location.href.replace(/\?.*$/, ''); - const pageEnc = encodeURIComponent(pageUrl); const sid = params.sid; + const pageUrl = deepAccess(bidRequest, 'ortb2.site.page').replace(/\?.*$/, ''); + const pageEnc = encodeURIComponent(pageUrl); const payload = { sid: sid, pu: pageEnc diff --git a/test/spec/modules/pubxBidAdapter_spec.js b/test/spec/modules/pubxBidAdapter_spec.js index feaaa244a97..b387264bf91 100644 --- a/test/spec/modules/pubxBidAdapter_spec.js +++ b/test/spec/modules/pubxBidAdapter_spec.js @@ -39,6 +39,11 @@ describe('pubxAdapter', function () { id: '26c1ee0038ac11', params: { sid: '12345abc' + }, + ortb2: { + site: { + page: `${location.href}?test=1` + } } } ]; @@ -46,7 +51,9 @@ describe('pubxAdapter', function () { const data = { banner: { sid: '12345abc', - pu: encodeURIComponent(location.href.replace(/\?.*$/, '')), + pu: encodeURIComponent( + utils.deepAccess(bidRequests[0], 'ortb2.site.page').replace(/\?.*$/, '') + ), }, }; From fe9f6654ec1484a26bb4b6acdd1797b40a372781 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Tue, 11 Apr 2023 10:55:00 -0400 Subject: [PATCH 3/3] Update pubxBidAdapter.js getting circleci to run --- modules/pubxBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/pubxBidAdapter.js b/modules/pubxBidAdapter.js index b3bedd544d8..ee28d549475 100644 --- a/modules/pubxBidAdapter.js +++ b/modules/pubxBidAdapter.js @@ -20,7 +20,7 @@ export const spec = { const pageEnc = encodeURIComponent(pageUrl); const payload = { sid: sid, - pu: pageEnc + pu: pageEnc, }; return { id: bidId,