Command queue for embedded web forms

OtSDK Command Queue

To get started, you can run the following script to initialize a command queue. This script will add the OneTrust public API commands and therefore eliminate the dependency of waiting for the SDK/OneTrust object to become available on the page before sending the next command.


  • After a command is processed, the command will be removed from the queue even if there is a failure, and the command will not be processed again.
  • It is advised that you initialize the queue before inserting Onetrust SDKs on the page.

Initialize the Command Queue

The following script will initialize the command queue. Ensure that the script is inserted before adding the OneTrust Consent SDK on the page.

// Initialize the Command Queue

Example Command Calls

The following is an example command queue call.

// Example command queue calls. 
// command[0] refers sdk type: 'consent' 
// command[1] refers API name 
// command[n] Are parameters to the API
// callback function to be passed as a last parameter and it's optional


// Example Callback for the command above
function ApiCallbackFn(isSuccess, response) {
  if (isSuccess) {
    // Success... access the response object
  } else {
    // Error handling