API Reference

postRejectAll

The postRejectAll command is an on-page opt-out mechanism that will opt out of all privacy choices and vendors for the Global Enterprise vendor list associated with the property. By attaching the command to an onclick event of a page element, your organization can provide end-users with a one-click solution that allows them to easily revoke their opt in selections.

Command

window._sp_.globalcmp.postRejectAll((postRejectAll, success) => console.log("All privacy choices opted out:" + 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.
  4. <!--Create modal with a button--> 
    <div id="myModal" class="modal"> 
      <div class="modal-content"> 
        <p> Revoke consent at any time. 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 myFunction() {
              console.log("postRejectAll Global Enterprise called:");
              window._sp_.globalcmp.postRejectAll((postRejectAll, success) => {
                if (success) {
                  console.log("postRejectAll Global Enterprise request was successful: " + success)
                }
                else {
                  // do something else
                  console.log("");
                }
              });
            }
    </script>
    

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.