Introduction to the JS Privacy API

Learn what the JS Privacy API can do, and how you can use it to hook into the privacy functionality built into Uberflip Hubs.

What is the JS Privacy API?

The JS Privacy API is a JavaScript API that allows you to interact with Uberflip's Privacy Groups feature. It provides tools for both getting information about Privacy Groups, and for directly manipulating them.

Privacy Groups is a GDPR-related functionality that is built into Uberflip. It is used to assemble the cookies and other trackers set by an Uberflip Hub into "Privacy Groups", or collections. This enables visitors to consent to or deny all cookies belonging to a Privacy Group collectively, rather than having to do so individually.

The JS Privacy API provides a way for external applications to access and control a particular Hub's Privacy Groups for various purposes, such as integrating third-party Consent Management Platforms (CMPs).

What can the JS Privacy API do?

Using the JS Privacy API, you can:

  • Get a list of all Privacy Groups in a Hub
  • Get the details of specific Privacy Groups, either by unique ID, or by the functionality (cookies) it controls
  • Get the status (accepted or declined) of the Privacy Group that controls a specified functionality for the current visitor
  • Set the status of any individual Privacy Group, or of all Privacy Groups at once, for the current visitor
  • Force a reload of the Hub for the visitor to apply changed Privacy Group settings

How can I use the JS Privacy API?

The primary use case for the JS Privacy API is to replace a Hub's built-in privacy banner and controls with an external CMP solution that also manages cookie consent for related web properties. In addition, there are also other potential uses for the JS Privacy API, including:

  • Getting visitor's Privacy Groups settings and passing them as hidden fields on form submissions
  • Passing a visitor's Privacy Groups settings to an external endpoint, for example a web analytics platform

In this guide, we will only specifically cover integrating a CMP, but the included reference materials comprehensively explain the API's functions, and can be used as a starting point for other use cases.

What’s Next

Next, learn more about the JS Privacy API, or learn how to use it to integrate a consent management platform: