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

Pub-X Bid Adapter: adding page url support #9746

Merged
merged 3 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions modules/pubxBidAdapter.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -16,8 +16,11 @@ export const spec = {
const bidId = bidRequest.bidId;
const params = bidRequest.params;
const sid = params.sid;
const pageUrl = deepAccess(bidRequest, 'ortb2.site.page').replace(/\?.*$/, '');
const pageEnc = encodeURIComponent(pageUrl);
const payload = {
sid: sid
sid: sid,
pu: pageEnc,
};
return {
id: bidId,
Expand Down
12 changes: 10 additions & 2 deletions test/spec/modules/pubxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ describe('pubxAdapter', function () {
id: '26c1ee0038ac11',
params: {
sid: '12345abc'
},
ortb2: {
site: {
page: `${location.href}?test=1`
}
}
}
];

const data = {
banner: {
sid: '12345abc'
}
sid: '12345abc',
pu: encodeURIComponent(
utils.deepAccess(bidRequests[0], 'ortb2.site.page').replace(/\?.*$/, '')
),
},
};

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