The getUserConsents command enables your organization to retrieve a list of privacy choices and their opt-in status.

Command

//call the __gpp() function with the getUserConsentsUsnat command 
__gpp('getUserConsentsUsnat', function(consents, success){ console.log(consents) })
...
function getUserConsentsUsnat() {
  console.log("getUserConsentsUsnat called:");
  __gpp("getUserConsentsUsnat", (consents, success) => {
    if (success) {
      // do something with GPPData
      console.log(consents);
      console.log("getUserConsentsUsnat request was successful: " + success);
    } else {
      // do something else
      console.log("gpp call was not successful!");
    }
  });
}
...

Response

{
  "categories": [
    {
      "id": "655dde122889126b8bfcdb43",
      "consented": true
    },
    {
      "id": "655dde122889126b8bfcdb55",
      "consented": false
    },
    {
      "id": "655dde122889126b8bfcdb6c",
      "consented": false
    },    
  ]
}
schema:
  description: getUserConsentsUsnat return
  type: object
  properties:
    categories:
      type: array
      description: "Privacy choices configured in your U.S. Multi-State vendor list"
      items:
        type: object
        description: "Individual privacy choice configured in your U.S. Multi-State vendor list and their opt-in/opt-out status"
        properties:
          id:
            type: string
            description: "ID of the privacy choice"
            example: 655dde122889126b8bfcdb43
          consented:
            type: boolean
            description: "Whether privacy choice was opted into by end-user"
            example: true