ORTB
中 / EN
Chapter navigation

CMP JS API

Role & classification

The three browser-side entry points: __gpp() (the Global Privacy Platform (GPP) Consent Management Platform (CMP) API v1.1, 2023-06) / __tcfapi() (the pre-Transparency & Consent Framework (TCF) 2.2 entry, still coexisting) / __uspapi() (USPrivacy legacy). The queue-callback model, the generic command set, and the PingReturn / TCData return-body structures (the getGPPData command and GPPData object were deprecated in v1.1).

Carriage
__gpp() · __tcfapi() · __uspapi()
Status
GPP CMP API v1.1 (2023-06)

String & field layout

Generic commands (section-independent; every CMP must support all)

  • __gpp('ping')
  • __gpp('addEventListener')
  • __gpp('removeEventListener')
  • __gpp('hasSection')
  • __gpp('getSection')
  • __gpp('getField')

Generic commands are section-independent; a CMP must support all of them and they must be synchronously available even in stub mode (not queued). The getGPPData command and GPPData object were deprecated in v1.1, their information folded into the PingReturn returned by ping.

PingReturn

FieldDescription
gppVersionGPP API version, currently "1.1"
cmpStatusstub / loading / loaded / error
cmpDisplayStatushidden / visible / disabled
signalStatusnot ready / ready
supportedAPIssupported sections, e.g. ["2:tcfeuv2", "6:uspv1"]
cmpIdthe Interactive Advertising Bureau (IAB)-assigned CMP ID, may be 0 during stub/loading; for a section with no registration requirement (e.g. the US national signal) string creators use 1
applicableSectionssection IDs in force for this transaction: normally one, rarely two; up to three during the transition (ending 2023-09-30) when legacy USPrivacy §6 applies alongside another US section; [-1] when none applies
gppStringthe complete encoded GPP string, may be empty during CMP load
parsedSectionsparsed objects for each section of gppString supported by this page's supportedAPIs (same return as getSection, may include subsections)

Carriage & access

__gpp is the unified entry point of the GPP era; __tcfapi is the pre-TCF-2.2 entry and still coexists — the European Economic Area (EEA) spec requires it to keep being implemented for standalone TC string scenarios; __uspapi is the legacy USPrivacy entry. All three share the same queue-callback invocation model (command + callback + parameter).

Before the CMP loads, the stub on the page must queue calls (e.g. __gpp starts as an array, pushing [command, callback, parameter]); the CMP executes them in call order once loaded — but generic commands must respond synchronously even in stub mode.

Invalid forms

  • Using __gpp as a return-value function (it is a queue-callback model; results arrive via callback — generic commands synchronously, others possibly asynchronously)
  • Still relying on getGPPData / GPPData (deprecated in v1.1; use ping's PingReturn with getSection / getField instead)
  • Parsing a section when applicableSections is [-1] (no applicable section)
This chapter's body is migrated from the legacy /protocol/gpp-tcf single page; the material matches the official specification.