API Reference

ping

The ping command will return the GPP pingReturn object that you can use to determine the state of the CMP.


Command

//call the __gpp() function from the browser console with the ping command 
__gpp('ping', (pingReturn, success) => {console.log('Ping request was successful: ' + success, pingReturn);});
...

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

...

Response

📘

Historically, organizations who have used U.S. Privacy (Legacy) campaigns have looked at the uspString (e.g. 1YNN) to determine the applicability of the framework to an end-user. When using U.S. Multi-State Privacy campaigns, the applicability of sections to an end-user within the Global Privacy Platform MSPS framework is determined by looking at the applicableSections response in the ping command.

{
  "applicableSections": [
    7
  ],
  "cmpDisplayStatus": "hidden",
  "cmpId": 6,
  "cmpStatus": "loaded",
  "gppString": "ABCBLA~BVQqAAAAAgA.QA",
  "gppVersion": "1.1",
  "parsedSections": {
    "usnat": {
      "Gpc": false,
      "GpcSegmentType": 1,
      "KnownChildSensitiveDataConsents": [
        0,
        0
      ],
      "MspaCoveredTransactions": 2,
      "MspaOptOutOptionMode": 0,
      "MspaServiceProviderMode": 0,
      "PersonalDataConsents": 0,
      "SaleOptOut": 2,
      "SaleOptOutNotice": 1,
      "SensitiveDataLimitUseNotice": 0,
      "SensitiveDataProcessing": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ],
      "SensitiveDataProcessingOptOutNotice": 0,
      "SharingNotice": 1,
      "SharingOptOut": 2,
      "SharingOptOutNotice": 1,
      "TargetedAdvertisingOptOut": 2,
      "TargetedAdvertisingOptOutNotice": 1,
      "Version": 1
    }
  },
  "sectionList": [
    7
  ],
  "signalStatus": "ready",
  "supportedAPIs": []
}
schema:
  description: pingReturn object
  type: object
  properties:
    applicableSections:
      type: array
      description: "Section ID considered to be enforced for this transaction. In most cases, this field should have a single section ID. In rare occasions where such a single section ID can not be determined, the field may contain up to 2 values. [Click here](https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Sections/Section%20Information.md#section-ids) for more information on section ID values."
      items:
        type: number
        description: "Section ID"
        example: 7
    cmpDisplayStatus:
      type: string
      description: "Possible values: hidden | visible | disabled."
      example: hidden
    cmpId:
      type: number
      description: "IAB assigned CMP ID"
      example: 6
    cmpStatus:
      type: string
      description: "Possible values: stub | loading | loaded | error."
      example: loaded
    gppString:
      type: string
      description: "Complete encoded GPP string. May be empty during CMP load"
      example: ABCBLA~BVQqAAAAAgA.QA
    gppVersion:
      type: string
      description: "Gpp version.sub-version"
      example: "1.1"
    parsedSections:
      type: object
      description: "Represents an object of all parsed sections of the gppString property that are supported by the API on this page. The object contains one property for each supported API with the name of the API as the property name and the value as a parsed representation of this section (similar to getSection command). If a section is supported but not represented in the gppString, it is omitted in the parsedSections object. Review the fields of each section by visiting Sourcepoint's National and State Privacy Sections documentation."
    sectionList:
      type: array
      description: "Sections contained within the encoded GPP string as parsed from the header."
      example: [7]
    signalStatus:
      type: string
      description: "Possible values: ready | not ready. Used to let callers know if the CMP is ready to respond to with the corresponding GPP string and applicable section IDs."
      example: ready
    supportedAPIs:
      type: array
      description: "List of supported APIs (section ids and prefix strings), e.g. used while loading."
      example: []

📘

Click here for more information about the ping command, ping status codes, and the pingReturn object.