Debugging and testing

Optional instructions for debugging and testing

Useful Commands

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.

Testing with userscripts

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.

Installing userscripts

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:

Transcend Consent Manager logsTranscend Consent Manager logs

Transcend Consent Manager logs

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.

Simulating different privacy regimes

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

localStorage.clear();
localStorage.tcmRegime = "GDPR"; // or "CPRA", etc.
addEventListener('click', airgap.reset, {once: true});
// click anywhere on your site to apply changes