Testing and Debugging Consent
Here are some console commands that may be helpful as you are configuring and testing Transcend Consent.
* 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.
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.
We support a couple of different ways of testing:
- Simulate Consent via userscript. Pros: Quick, no code deploys, no risk of breaking your website. Cons: Only runs local to the user's browser, hard to catch all edge cases.
- Install "Test" Consent bundle to a staging/test environment. Pros: Exact mirror of the set-up that you will have in production. Cons: Requires code change and deploy.
It is recommended that you try simulating Consent via userscript first to get a feel for the API and how it interacts with your website, then proceed to adding the test snippet itself to your staging/test environment.
We support 2 bundle types: Test and Production. The Test bundle is hosted at
cm-test/BUNDLE_ID/airgap.js while the Production bundle is hosted at
cm/BUNDLE_ID/airgap.js. Changes made in the Admin Dashboard can be applied to either bundle without modifying the other. The Test bundle can be thought of as a test branch of your Production bundle.
We recommend that you add the Test bundle to your staging environment, and keep the Production bundle on your production environment. In Consent , under "HTML Snippet", you can find the appropriate HTML snippet for either bundle by selecting the bundle type. Copy this snippet and add it to your testing/staging site header, as you would for the production site.
To publish changes for either bundle, click "Set Changes Live". You will be prompted to choose which bundle type you would like to apply the changes to:
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.
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.