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

Added CCPA support #4823

Closed
wants to merge 11 commits into from
14 changes: 11 additions & 3 deletions modules/onetagBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ function buildRequests(validBidRequests, bidderRequest) {
};
}

if (bidderRequest && bidderRequest.uspConsent) {
payload.usPrivacy = bidderRequest.uspConsent;
}

const payloadString = JSON.stringify(payload);

return {
Expand All @@ -63,7 +67,7 @@ function buildRequests(validBidRequests, bidderRequest) {
}

function interpretResponse(serverResponse, request) {
var body = serverResponse.body;
let body = serverResponse.body;
const bids = [];

if (typeof serverResponse === 'string') {
Expand Down Expand Up @@ -104,7 +108,7 @@ function interpretResponse(serverResponse, request) {
* @returns {{location: *, referrer: (*|string), masked: *, wWidth: (*|Number), wHeight: (*|Number), sWidth, sHeight, date: string, timeOffset: number}}
*/
function getPageInfo() {
var w, d, l, r, m, p, e, t, s;
let w, d, l, r, m, p, e, t, s;
for (w = window, d = w.document, l = d.location.href, r = d.referrer, m = 0, e = encodeURIComponent, t = new Date(), s = screen; w !== w.parent;) {
try {
p = w.parent; l = p.location.href; r = p.document.referrer; w = p;
Expand Down Expand Up @@ -170,7 +174,7 @@ function requestsToBids(bid) {
return toRet;
}

function getUserSyncs(syncOptions, serverResponses, gdprConsent) {
function getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent) {
const syncs = [];
if (syncOptions.iframeEnabled) {
const rnd = new Date().getTime();
Expand All @@ -183,6 +187,10 @@ function getUserSyncs(syncOptions, serverResponses, gdprConsent) {
}
}

if (uspConsent && typeof uspConsent === 'string') {
params += '&us_privacy=' + uspConsent;
}

syncs.push({
type: 'iframe',
url: USER_SYNC_ENDPOINT + params
Expand Down
Loading