Debugging and testing

Here are some console commands that may be helpful as you are configuring and testing Transcend Consent.

  • To check the consent stored locally in your browser: airgap.getConsent().purposes
  • To check the requests that airgap.js is regulating: airgap.export().requests and airgap.export().mutations
  • To check the cookies that airgap.js is regulating: airgap.export().cookies

This is helpful to see if airgap.js is holding a request in quarantine, causing something to not load on your site.

You can also install our simulator userscript to test Consent directly in production, without actually having to change anything in production. This is useful if your site makes any requests that use different domains on production as opposed to dev & staging.

Userscripts are JavaScript files that are injected into websites to add or change functionality on the website. A userscript manager browser extension is required to install userscripts. Think of userscripts as mini browser extensions that require a host browser extension.

We recommend the Tampermonkey userscript manager for installing userscripts. Tampermonkey is available for all modern desktop browsers and some mobile browsers (e.g. Firefox on Android).

You can install Tampermonkey for your browser of choice via the following links:

Once you have installed Tampermonkey, you can click “Install userscript” under Developer Settings.

It is recommended that you don’t use the airgap.js userscript on a site that already has airgap.js installed. If you already added the script to your site, you can enable debug logging by setting the attribute data-log="*" on your airgap.js script tag.

Once you have userscript installed, you can visit your site with the Tampermonkey extension enabled, and open up your dev console. You should see logs like this:

The first link/button you see in the console will bring up the default UI that airgap.js ships with. The pop-up/banner will vary based on your location/data rights.

You can test out Consent under different privacy jurisdictions or regimes by pasting the following code into your browser's DevTools console while the simulation userscript is active:

localStorage.tcmRegime = 'GDPR'; // or "CPRA", etc.
location.reload();

Note: If you are not using the userscript (i.e. airgap.js is already installed via a script tag), you can only simulate different privacy regimes by specifying data-regime directly on the airgap.js script tag. Read more: Directly setting your regime