The postRejectAll command is an on-page opt-out mechanism that will reject all purposes and vendors for the U.S. Privacy - CCPA vendor list associated with the property. By attaching the command to the onclick event of a page element, your organization can provide end-users with a one-click solution that allows them to easily revoke consent.


Command

__uspapi('postRejectAll', 1, function (postRejectAllResponse, success) {
  //custom callback code can be included here
  console.log("postRejectAllResponse: ", postRejectAllResponse); 
  console.log('postRejectAllResponse was successful: ' + success)
});

Implement postRejectAll

In order to implement the postRejectAll command on your website property, you will need to:

  1. Implement a button or link on your website property with an element ID. The suggested element ID is "postRejectAll".
  2. Create a function that executes the postRejectAll command.
  3. Use the document.getElementbyId method to return the button or link ID and call your function for an onclick event.
<!--Create modal with a button--> 
<div id="myModal" class="modal"> 
  <div class="modal-content"> 
    <p>Opt out of all purposes and vendors.</p> 
    <button id="postRejectAll">Reject All</button> 
  </div>
</div>
<script>
//calls function when Opt-Out of All button is clicked
    document.getElementById("postRejectAll").onclick = function() {myFunction()};

//function that executes postRejectAll command
    function myFunction() {
      __uspapi('postRejectAll', 1, function (postRejectAllResponse, success) {
        //custom callback code can be included here
        console.log("postRejectAllResponse: ", postRejectAllResponse); 
        console.log('postRejectAllResponse was successful: ' + success)
        
});
    }
</script>
Example

Response

In addition to any custom code you might implement when your function executes, a successful reject all action will return true for the success parameter.

Example

An end-user accessing our page has opted-into all purposes and vendors on our U.S. Privacy - CCPA vendor list. As such, the uspString, an encoded 4 character string that describes the end-user's consent, returns N for the third character (Has the end-user opted-out of the sale of his or her personal information?).

1YNN

After clicking the button we configured to execute the postRejectAll command, our script returns true for the success parameter.

true

Upon re-retrieving the uspString, the third character (Has the end-user opted-out of the sale of his or her personal information?) is now set to Y.

1YYN