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 1 commit
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
5 changes: 4 additions & 1 deletion modules/pubxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export const spec = {
return validBidRequests.map(bidRequest => {
const bidId = bidRequest.bidId;
const params = bidRequest.params;
const pageUrl = location.href.replace(/\?.*$/, '');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use site.page on the request object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patmmccann
Thank you for letting me know about the site object. I found what I needed in the request object with ortb2.site.page .
Made the changes and committed the code. b294306

const pageEnc = encodeURIComponent(pageUrl);
const sid = params.sid;
const payload = {
sid: sid
sid: sid,
pu: pageEnc
};
return {
id: bidId,
Expand Down
5 changes: 3 additions & 2 deletions test/spec/modules/pubxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down