Skip to main content

LaunchPad API Functions

LaunchPad exposes an API on the page via JavaScript. This allows your scripts to programmatically interact with LaunchPad. You can check the user consent status and register consents that you would collect yourself.

__launchpad(command, [version], [callback], [parameter])

Name

Type

Value

configuration

String

Name of the command to execute

version

Optional parameter

Version of the API

callback

Function

Function to be executed with the result of the command

parameter

*

Parameter to be passed to the command function

The ping command will return the IAB TCF v2 ping object i.e. to determine whether or not the main CMP script has loaded and whether GDPR applies.

__launchpad('ping', null, (pingReturn) => {console.log(pingReturn)})

Argument Name

Type

Value

command

string

'ping'

version

number

(Ignored)

callback

function

Function to be executed with the result of the command Arguments

Arguments Result Object

Argument

Value

isLoaded

true if LaunchPad main script is loaded, false if still running

stub status

stub | loaded | error

apiVersion

version of the LaunchPad API that is supported, e.g. "1.0"

libraryVersion

LaunchPad's own/internal version that is currently running

cmpType

GDRP | CCPA

cmpApplies

true if active CMP applies to visitor

[parameter]

(ignored)

getVendorList

The getVendorList command returns the latest global vendor list.

__launchpad('getVendorList', 2, (result) => {console.log(result)});

Argument Name

Type

Value

command

string

'getVendorList'

version

number

(ignored)

callback(result)

function

function(result: object)

Vendor list retrieved from active CMP

[parameter]

(ignored)

getAuditId

The getAuditId command will retrieve the LiveRamp Audit ID of a user. The Audit ID is only present, logged and stored after a user saves its consent preferences.

__launchpad('getAuditId', 1, (result) => {console.log(result)});

Argument Name

Type

Value

command

string

'getAuditId'

version

number

(ignored) or 2

callback(result)

function

function(result: string)

AuditId of a user.

Example:

        __launchpad('getAuditId', null, function (data, success) {
          console.log('LR LaunchPad - Get Audit ID, Success: ' + success + ', Data: ', data);
        });

      

resetAuditId

The resetAuditId command will reset the LiveRamp Audit ID.

__launchpad('resetAuditId', 1, (launchPadData, success) => {console.log(launchPadData)});

Argument

Type

Value

command

string

'resetAuditId'

version

number

(ignored) or 2

callback(result)

function

function(result: string)

Auto generated AuditId

Example:

        __launchpad('resetAuditId', null, function (data, success) {
          console.log('LR LaunchPad - Get Audit ID, Success: ' + success + ', Data: ', data);
        });

      

getConsentData

The getConsentData command will return consent data from the current active user.

__launchpad('getConsentData', 1, (consentData, success) => {console.log(consentData)});

Argument

Type

Value

command

string

'getConsentData'

version

number

(ignored)

callback(result, success)

function

function(result: consentData, success: boolean)

Current user's consent data retrieved from active CMP.

Example:

        
      __launchpad('getConsentData', null, function (data, success) {
          console.log('LR LaunchPad - Get Consent Data,  Success: ' + success + ', Data: ', data);
        });

checkConsent

The checkConsent command will return an object whether or not there is consent for the given vendor.

__launchpad("checkConsent", 1 ,(data, success)=>{console.log(data)}, [parameter]);

Example:

        __launchpad('checkConsent', null, (data, success) => {
  console.log(`Success: ${success}, Data: `, data)
}, {
  data: [{ vendorId: 1 }],
  perVendor: true,
  recheckConsentOnChange: true
});

      

Argument

Type

Value

command

string

'checkConsent'

version

number

(ignored)

callback(result)

function

function(result: boolean)

True if there's consent for provided vendors or list of vendors with hasConsent property

if perVendor property is set to true

if no data or invalid one is provided as parameter result will be false

parameter

Array|Object

Array of objects or only object with vendorId,

purposeIds and featureIds properties to check consent for if no data or invalid one is provided result will be false.

recheckConsentOnChange=true

Will trigger every time the consent status has changed by listening to the event consent changed. It will be invoked depending on the event.

Per vendor

  • Passing the perVendor parameter as false will return a boolean regarding all the data which was passed.

  • Passing the perVendor parameter as true will return an array of objects, and each object will represent consent pre vendor from the passed data.

Accept

The accept method will simulate a user click on the accept button. The object can be used for specific purposeIds, vendorIds, legIntPurposeIds, legIntVendorIds and/or specialFeatureIds. If the object is empty all vendors will be accepted.

__launchpad('accept', 2, (result) => {console.log(result)}, [parameter]);

Argument

Type

Value

command

string

'accept'

version

number

(ignored) or 1

callback(result,)

function

function(result: Void)

parameter

Array

Object with (Universal) purposeIds, (Universal) vendorIds properties.

If none is passed all vendors will be accepted.

Example:

        __launchpad('accept', null, (result) => {console.log(result)});

// accept all
__launchpad('accept', null, (data, success) => {
  console.log(`Success: ${success}, Data: `, data)
});


// accept partial
__launchpad('accept', null, (data, success) => {
  console.log(`Success: ${success}, Data: `, data)
}, {
  vendorIds: [1, 2, 3],
  purposeIds: [1, 4],
  publisher: { purposeIds: [2] },
  consentOnDemand: true
});

      

Reject

The rejected method will simulate a user click on the reject button. The object can be used for specific purposeIds, vendorIds, legIntPurposeIds, legIntVendorIds and/or specialFeatureIds. If the object is empty all vendors will be rejected.

__launchpad('reject', 1, (result) => {console.log(result)}, [parameter]);

Argument

Type

Value

command

string

'reject'

version

number

(ignored) or 2

callback(result)

function

function(result: Void)

parameter

Array

Array of (Universal) vendors with (Universal) purposes, if none is passed all vendors will be rejected.

Example:

        
      __launchpad('reject', 2, (result) => {console.log(result)});





// reject all
__launchpad('reject', null, (data, success) => {
  console.log(`Success: ${success}, Data: `, data)
});




// reject partial
__launchpad('reject', null, (data, success) => {
  console.log(`Success: ${success}, Data: `, data)
}, {
  vendorIds: [1, 2, 3],
  purposeIds: [1, 4],
  publisher: { purposeIds: [2] },
  consentOnDemand: false
});

addEventListener

The addEventListener command registers a callback function with the CMP. The listener's callback is triggered when for example the consent string status has changed. The listener is registered with an ID for later removal.

__launchpad('addEventListener', 1, (launchPadData, success) => {console.log(launchPadData)}, [parameter]);

command

addEventListener

version

(ignored)or 1

[callback(result)]

Function to execute when the event is fired Arguments result (Object, Boolean): Object containing the event name or listenerId and any data the event may return, Boolean if success.

parameter(String)

Name of the event to listen to.

You can choose the event name from the list in "LaunchPad Events."

removeEventListener

The removeEventListener command removes the event listener.

__launchpad('removeEventListener', 1, (result) => {console.log(launchPadData)}, [parameter]);

command

removeEventListener

version

(ignored)or 1

[callback(result)]

Function to execute when the event is fired Arguments result (Object, Boolean): Object containing the event name or listenerId and any data the event may return, Boolean if success.

parameter(String)

Unique ID assigned by the LaunchPad to the registered callback (via addEventListener) or event name.

You can choose the event name from the list in "LaunchPad Events."

showConsentManager

The showConsentManager command will surface the consent manager UI at any given time regardless of consent state.

`command`: "showConsentManager"

`version`: (ignored)

`[callback(result)]`: Function to be executed with the result of the command

*Arguments*

`result (Void)`: Consent manager will be toggled

`parameter (Object)`: Object with openPrivacyInformation and toggle properties, both boolean