The International Advertising Bureau (IAB) has advised modifications to the RTB BidRequest
object to allow “us_privacy”
be embedded to the current BidRequest object. Through this extension, publishers can pass along the required consent strings, and downstream actors can validate and include the information into their automated RTB decisions. First, you will need to get the users current "us_privacy" string, which can be handled through a number of methods:
function getUsPrivacyStr() {// Format cookies into array-like key value pairsvar cookies = document.cookie.split('; ').map(cookie => cookie.split('='));// Store U.S. Privacy stringlet usPrivacyString = cookies.find(cookie => cookie[0] === 'usprivacy')[1] || '';return usPrivacyString;}let usPrivacy = getUsPrivacyStr();if (usPrivacy !== '') {... Use as necessary ...console.log('US Privacy String: ', usPrivacy);}
To modify your Bid Request Object, follow along below:
Modify the "ext"
object, which can be found in the BidRequest "user"
object.
{"user": {"ext": {"us_privacy": "1---"}}}// Or programatically:BidRequest.user.ext.us_privacy = "1---";
Modify the "ext"
object, which can be found in the BidRequest "regs"
object.
{"regs": {"ext": {"us_privacy": "1---"}}}// Or programatically:BidRequest.regs.ext.us_privacy = "1---";
For more information on CCPA and OpenRTB, the IAB provides further documentation on extending the BidRequest
object, which can be found here.
We recommend changes to the OpenRTB BidRequest
object be validated prior to deployment with a Real-Time Bid Request Validator.