Skip to main content

Local development options

A article that explains how to test your banner locally

Updated over 3 weeks ago

How Consent Studio helps you with testing your banner locally

We have built some features that make it easy to test your banner on your local website. This allows you to preview the looks and feel of your consent banner locally.


Simple: Testing a dummy consent banner on the localhost domain

Consent Studio provides a preconfigured test domain (localhost) with a dummy banner. You cannot modify this banner, as it is managed directly by Consent Studio. This is the easiest way to test a banner installed via Google Tag Manager in a local environment.

To test the dummy banner on your local website, follow these steps:

  1. Go to Banner > Installation and fill in the questions.

  2. Copy the code snippet and paste it in the head of your website.
    ​

  3. All done! Your local website should now display our dummy banner.

Important: This method only works on localhost. Using ports (example: localhost:8080) or other local development environments will not work.

Advanced: Testing your own consent banner on any local domain

If you want to display your own (cookie) consent banner on localhost or any other local test environment, follow these steps:

  1. Go to Domain > Settings in the Consent Studio dashboard, and scroll down to Domain Aliases.

  2. Add your local domain to the list of Domain Aliases.
    ​Pro Tip: You can also include a port if needed, like localhost:8080.
    ​

  3. Go to Banner > Installation and fill in the questions.

  4. If you are on a localhost domain (with or without a port suffix) but want to see your own banner instead of the dummy banner, you must select your preferred domain in Domain Selection.

  5. Copy the code snippet and paste it in the head of your website.

Good to know: Adding localhost or localhost with a port (example: localhost:8080) to your domain aliases does not count toward your domain alias limit, so there will be no additional surcharge for using it.

After those steps everything is set up! Even on local development environments like example.local or localhost:1234, the banner will behave as if it's on your selected domain, allowing you to preview the look and feel your consent banner locally.

Processing consent into the consent log will not work in every scenario on a local domain. This may cause the consent banner to re-appear on page (re)loads. The local development preview is primarily meant to allow previewing of the look and feel (styling, copywriting) of the banner.

Did this answer your question?