Testing and Debugging Consent

On this page:

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

CommandDescription
airgap.getConsent().purposesGet the consent stored locally in your browser
airgap.export().requestsGet the requests that airgap.js is quarantining
airgap.export().mutationsGet the potential requests that airgap.js is quarantining
airgap.export().cookiesGet the cookies that airgap.js is quarantining
airgap.export().sentRequests*Get the requests that airgap.js has allowed
airgap.export().setCookies*Get the cookies that airgap.js has allowed

* API only available when extended monitoring is enabled via data-monitoring="export" on the airgap.js script tag.

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

Using the console is helpful to understand issues that arise when first setting up the Consent Manager. Below are some errors commonly encountered when getting started with the airgap.js script.

ErrorSolution
This build of Transcend Consent Manager cannot run on {{some-domain}}Add the domain to the allowed Domain List in Transcend in the Consent Developer Settings and set changes live.
Errors related to symbol.iteratorThis is likely related to Transcend's built-in tamper resistance. You can disable tamper resistance by setting data-tamper-resist="off"
Failed to read 'localStorage' property from 'Window': Accedss denied for this documentThis error results from browsing in an incognito mode or with a browser using enhanced privacy settings. This error can be ignored, as it's coming from the sync frame.

Before going live with the consent manager in production, it's a good idea to thoroughly test the implementation. It's recommend to test the consent experience for each privacy regime (including the default when there is no privacy regime detected for a user) to confirm the experience with the consent banner is as expected. It's also helpful to view as many pages on the site as possible to ensure that essential functionality needed for the site is being allowed through by the consent manager.

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