API Reference (CCPA for Web)

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

Argument Name

Type

Value

callback

function

Function to be executed with the result of the command

command

String

Name of the command to execute

parameter

number

Parameter to be passed to the command function

version

number

Optional parameter, version of the API, currently v1.0

command: "ping"

[parameter]: (ignored)

version: (ignored)

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

Arguments

result (Object):

isLoaded: true if CCPA main script is loaded, false if still running stub

status: stub | loading | loaded | error

displayStatus: visible | hidden | disabled

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

vendorListVersion: Version of the vendor list used when consent is given.

command: "optIn"

[parameter]: Array of vendors with purposes, if none is passed all vendors will be opted in

version: (ignored)

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

Arguments

result (Void): Void

command: "optOut"

[parameter]: Array of vendors with purposes, if none is passed all vendors will be opted out

version: (ignored)

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

Arguments

result (Void): Void

command: "ccpaApplies"

[parameter]: (ignored)

version: (ignored)

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

Arguments

result (Boolean): True if ccpa details apply for current user

command: "getConsent"

[parameter]: (ignored)

version: (ignored)

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

Arguments

result (Object): Consent data for the current user

command: "getAuditId"

[parameter]: (ignored)

version: (ignored)

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

Arguments

result (String): AuditId of a user

command: "resetAuditId"

[parameter]: (ignored)

version: (ignored)

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

Arguments

result (String): Auto generated AuditId

command: "shouldConsentToolBeShown"

[parameter]: (ignored)

version: (ignored)

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

Arguments

result (Boolean): True if consent tool should be shown

command: "getVendorList"

[parameter]: (ignored)

version: (ignored)

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

Arguments

result (Object): Vendor list

command: "addEventListener"

parameter (String): Name of the event to listen to

version:

[callback(result)]: Function to execute when the event is fired

Arguments

result (Object): Object containing the event name and any data the event may return

command: "removeEventListener"

parameter (String): Name of the event to remove as a listener

version:

[callback(result)]: Callback function to remove as a listener

Arguments

result (Object): Object containing the event name and any data the event may return

command: "showConsentManager"

[parameter]: (ignored)

version: (ignored)

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

Arguments

result (Void): Consent manager will be displayed

The U.S. Privacy String is a core part of IAB’s framework to support CCPA compliance amongst publishers. This U.S. Privacy String communicates signals regarding consumer privacy and choice under U.S. privacy regulation [For more technical information: Github]. The U.S. Privacy String only applies to traffic originating in the U.S. market.

Version 1 of this specification is focused on supporting requirements under the California Consumer Privacy Act (CCPA). If privacy regulations apply, digital property owners (websites, apps, or other media platforms) are expected to provide consumer privacy signals to all parties that intend to exchange data on a given transaction (such as displaying an impression). For example, parties receiving the signal use the information to determine whether they’re allowed to process the consumer’s personal data.

This privacy string enables the capture of signals to ensure:

  • Notice has been given to the consumer, or an opportunity to opt-out

  • The consumer can pass their right to opt-out of the sale of data

IAB U.S. Privacy API

Check the __uspapi stub for consent data. The stub has three parameters:

__uspapi(Command, Version, Callback)

Argument Name

Type

Value

command

string

'getUSPData'

version

number

U.S. Privacy spec version

callback

version

function(uspData: uspdata, success: boolean)

Example how to view the content of the uspData object:

__uspapi('getUSPData', 1 , (uspData, success) => { 

    if (success) { 

        console.log('cmp response: ', JSON.stringify(uspData));

    } 

});

"version" is a number, indicating the U.S. Privacy spec version.

"uspString" is a string that encodes all choices and information, and has the following components:

Character

Value

Explanation

1st

1

U.S. Privacy spec version

2nd

Y / N

Explicit notice / Opportunity to opt out

3rd

Y / N

User opted out of sale of personal information

4th

Y / N

Publisher is a signatory to the IAB Limited Service Provider Agreement. (In case you are a signatory to the IAB Limited Service Provider Agreement then you should enable this in the settings of your Privacy Manager CCPA configuration.)

The eligibility of CCPA is determined based on IP. In case CCPA does not apply, the string's value will always be "1---."

Examples

The following examples provide a sample U.S. Privacy String that represents the stated conditions. In all but the last example, a digital property has determined to use a U.S. Privacy String and that CCPA applies to the transaction.

Example 1 meets the following conditions:

Version 1 of the U.S. Privacy string is being used. (1)

The digital property has provided explicit user notice. (Y)

The user has NOT made a choice to opt out of sale. (N)

The digital property is not operating under the Limited Service Provider Agreement. (N)

Result: 1YNN

Example 2 meets the following conditions:

Version 1 of the U.S. Privacy string is being used. (1)

The digital property has NOT provided explicit user notice. (N)

The user has made a choice to opt out of sale. (Y)

The digital property is not operating under the Limited Service Provider Agreement. (N)

Result: 1NYN

Example 3: CCPA does not apply

In this example, a digital property has determined to use a U.S. Privacy String and that CCPA does not apply to the transaction.

Result: 1---