Skip to content
Open
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
14 changes: 13 additions & 1 deletion modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export const spec = {
if (topicsData) {
serverRequest.topics = topicsData;
}
const gpc = getGPCSignal(bidderRequest);
if (gpc) {
serverRequest.gpc = gpc;
}

if (canAccessTopWindow()) {
serverRequest.pr = (LOCAL_WINDOW.document && LOCAL_WINDOW.document.referrer) || '';
Expand Down Expand Up @@ -417,14 +421,22 @@ function openRtbRequest(bidRequests, bidderRequest) {
if (schain) {
openRtbRequest.schain = schain;
}

const gpc = getGPCSignal(bidderRequest);
if (gpc) {
deepSetValue(openRtbRequest, 'regs.ext.gpc', gpc);
}
if (bidRequests[0].auctionId) {
openRtbRequest.auctionId = bidRequests[0].auctionId;
}
populateOpenRtbGdpr(openRtbRequest, bidderRequest);
return openRtbRequest;
}

function getGPCSignal(bidderRequest) {
const gpc = deepAccess(bidderRequest, 'ortb2.regs.ext.gpc');
return gpc;
}

function getTopics(bidderRequest) {
const userData = deepAccess(bidderRequest, 'ortb2.user.data') || [];
const topicsData = userData.filter((dataObj) => {
Expand Down
33 changes: 33 additions & 0 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,22 @@ describe('YieldmoAdapter', function () {
});
});

it('should send gpc in the banner bid request', function () {
const biddata = build(
[mockBannerBid()],
mockBidderRequest({
ortb2: {
regs: {
ext: {
gpc: '1'
},
},
},
})
);
expect(biddata[0].data.gpc).to.equal('1');
});

it('should add eids to the banner bid request', function () {
const params = {
userIdAsEids: [{
Expand Down Expand Up @@ -667,6 +683,23 @@ describe('YieldmoAdapter', function () {
});
});

it('should send gpc in the bid request', function () {
let videoBidder = mockBidderRequest(
{
ortb2: {
regs: {
ext: {
gpc: '1',
},
},
},
},
[mockVideoBid()]
);
let payload = buildAndGetData([mockVideoBid()], 0, videoBidder);
expect(payload.regs.ext.gpc).to.equal('1');
});

it('should add device info to payload if available', function () {
let videoBidder = mockBidderRequest({ ortb2: {
device: {
Expand Down