Skip to content

Commit 5332fd0

Browse files
yuki-arasakipatmmccann
authored andcommitted
Pub-X Bid Adapter: adding page url support (prebid#9746)
* Pub-X Bid Adapter: adding page url support * Refactored to use site.page * Update pubxBidAdapter.js getting circleci to run --------- Co-authored-by: Patrick McCann <[email protected]>
1 parent 0d28cd0 commit 5332fd0

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

modules/pubxBidAdapter.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { deepSetValue } from '../src/utils.js';
1+
import { deepSetValue, deepAccess } from '../src/utils.js';
22
import { registerBidder } from '../src/adapters/bidderFactory.js';
33

44
const BIDDER_CODE = 'pubx';
@@ -16,8 +16,11 @@ export const spec = {
1616
const bidId = bidRequest.bidId;
1717
const params = bidRequest.params;
1818
const sid = params.sid;
19+
const pageUrl = deepAccess(bidRequest, 'ortb2.site.page').replace(/\?.*$/, '');
20+
const pageEnc = encodeURIComponent(pageUrl);
1921
const payload = {
20-
sid: sid
22+
sid: sid,
23+
pu: pageEnc,
2124
};
2225
return {
2326
id: bidId,

test/spec/modules/pubxBidAdapter_spec.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,22 @@ describe('pubxAdapter', function () {
3939
id: '26c1ee0038ac11',
4040
params: {
4141
sid: '12345abc'
42+
},
43+
ortb2: {
44+
site: {
45+
page: `${location.href}?test=1`
46+
}
4247
}
4348
}
4449
];
4550

4651
const data = {
4752
banner: {
48-
sid: '12345abc'
49-
}
53+
sid: '12345abc',
54+
pu: encodeURIComponent(
55+
utils.deepAccess(bidRequests[0], 'ortb2.site.page').replace(/\?.*$/, '')
56+
),
57+
},
5058
};
5159

5260
it('sends bid request to ENDPOINT via GET', function () {

0 commit comments

Comments
 (0)