Skip to content

Consent Management: JavaScript APIs

10minFidesConsent Management
This tutorial requires Fides Cloud or Fides Enterprise. For more information, talk to our solutions team. (opens in a new tab)

Fides.js provides several JavaScript APIs depending on the functionalities included in your Fides license.

GPP API

When Fides is configured to support the IAB's Global Privacy Platform (GPP), then fides.js includes the GPP API so that downstream services can call it to get a user's privacy preferences and ensure that advertising and other services are loaded according to user preferences.

You can inspect the GPP API and your current preferences by calling:

__gpp('ping', (data) => {console.log({data})})

from your browser console.

When GPP is supported in your jurisdiction, an object will be returned with information about the API and current user preferences. For more information about the GPP API, see the spec from the IAB in Github (opens in a new tab).

Forcing GPP Inclusion

In some cases it may be necessary to always support GPP, even when visiting from an unsupported jurisdiction. Forcing the inclusion of the GPP API can be accomplished by including query parameter gpp=true on the FidesJS script:

<script src="path/to/fides.js?gpp=true"></script>

When the GPP API is included this way, the applicableSections property is set to [-1] whenever a user visits a page from a non-supported location.