Skip to content

Commit b294306

Browse files
committed
Refactored to use site.page
1 parent dd24af0 commit b294306

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

modules/pubxBidAdapter.js

Lines changed: 3 additions & 3 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';
@@ -15,9 +15,9 @@ export const spec = {
1515
return validBidRequests.map(bidRequest => {
1616
const bidId = bidRequest.bidId;
1717
const params = bidRequest.params;
18-
const pageUrl = location.href.replace(/\?.*$/, '');
19-
const pageEnc = encodeURIComponent(pageUrl);
2018
const sid = params.sid;
19+
const pageUrl = deepAccess(bidRequest, 'ortb2.site.page').replace(/\?.*$/, '');
20+
const pageEnc = encodeURIComponent(pageUrl);
2121
const payload = {
2222
sid: sid,
2323
pu: pageEnc

test/spec/modules/pubxBidAdapter_spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,21 @@ 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: {
4853
sid: '12345abc',
49-
pu: encodeURIComponent(location.href.replace(/\?.*$/, '')),
54+
pu: encodeURIComponent(
55+
utils.deepAccess(bidRequests[0], 'ortb2.site.page').replace(/\?.*$/, '')
56+
),
5057
},
5158
};
5259

0 commit comments

Comments
 (0)