Skip to content

Set up the cookie banner and your own code

The screen Website > Cookies & code in the KonversAI console holds three things for your whole website. The Cookie banner asks visitors what they allow before anything optional runs. Privacy policy and cookie page lists the two legal pages the banner links to. Your own code adds your HTML and scripts, such as an analytics tag or an ad pixel, to every page. For code in one place on one page, the page editor has a Custom code part. Your own code runs only on your own domain.

Cookies & code needs the View tenant settings permission to open and Modify tenant settings to change, in the KonversAI console. A Tenant Admin always has both. Without View tenant settings, Cookies & code is missing under Website in the left sidebar. The privacy policy, the cookie page and the Custom code part are website pages, so they need the View knowledge base and Modify knowledge base permissions. Ask a Tenant Admin to change your role on Settings > Users & permissions.

The Website add-on must be on, and your website must be set up with the start guide. See Create your website.

Your own code runs only on your own domain, such as www.yourbusiness.no. Connect the domain first under Website > Web address. See Connect your own domain. Until then, KonversAI saves your code but leaves it out.

  1. In the KonversAI console, select Website > Cookies & code in the left sidebar.
  2. Under Cookie banner, leave Ask visitors before using cookies on. The switch is on for every new website.
  3. Select Save changes in the bar at the bottom if you changed anything.

The banner asks only about the kinds of cookie your website uses. Preferences shows when the chat bubble is on, because the chat can remember a visitor and the conversation. Statistics, Marketing or Preferences also show when your own code needs them. Visitors choose Accept all, Reject all or Choose, and the three buttons are equally easy to press.

Section titled “Fill in the privacy policy and the cookie page”
  1. Under Privacy policy and cookie page on Cookies & code, select the privacy policy. The page opens in the page editor.
  2. Replace each text in [brackets] with how your business handles personal data. The headings say what each part of the page must cover.
  3. Select Publish page in the toolbar above the page. The page editor saves your text by itself, but visitors see the page only once you publish.
  4. Do the same for the cookie page. List the cookies your website and your own code use.

The start guide makes both pages as drafts, in the footer only. In English they are called Privacy policy and Cookies. The cookie banner links to the privacy policy once the privacy policy is published. The AI never writes these pages, so the page editor has no Rewrite with AI button on them. When a website has no privacy policy or cookie page, for example one made before these pages existed, select Add the missing pages under Privacy policy and cookie page.

  1. On Cookies & code, under Your own code, paste your code into In the page head or At the end of the page. Most analytics and verification snippets go in the page head. Chat tools and scripts that should load last go at the end of the page.
  2. Under Needs consent for, choose what the code needs: Marketing, Statistics, Preferences or Necessary (runs without asking). Marketing is chosen for new code. The code waits until the visitor allows that kind of cookie in the banner.
  3. Select Save changes in the bar at the bottom.

Choose Necessary (runs without asking) only for code that sets no cookies and tracks no one. Needs consent for shows only while the cookie banner is on and the code field has code in it.

  1. Open the page in the page editor: select Website > Pages, then Edit next to the page.
  2. Select + Add a part, then select Custom code.
  3. Fill in Name. Only you see the name, in the editor.
  4. Paste your HTML or script into HTML, and choose Needs consent for.
  5. The page editor saves the part by itself. On a published page, select Publish changes in the toolbar above the page so visitors get the code. On a draft page, select Publish page when the page is ready.

In the page editor, in the preview and on the KonversAI address of your website, a Custom code part runs in a closed box. A simple map or booking tool often works there. Code that needs the rest of the page works only on your own domain.

Section titled “Why does my website show no cookie banner?”

The KonversAI cookie banner shows only when your website uses something the visitor must allow. That is the chat bubble, or your own code set to Marketing, Statistics or Preferences under Needs consent for. A website with none of these has nothing to ask about, so the banner stays hidden even when Ask visitors before using cookies is on. Check also that the switch is on under Website > Cookies & code, and that you selected Save changes. A visitor who already chose sees the banner again only when the choice runs out or your website starts using a new kind of cookie.

How long does KonversAI remember a visitor’s choice?

Section titled “How long does KonversAI remember a visitor’s choice?”

The KonversAI cookie banner keeps a visitor’s choice for six months, a “no” included, so visitors are not asked on every visit. After six months the banner asks again. The banner also asks again when your website starts to use a kind of cookie the visitor was not asked about, for example when you add marketing code. Visitors can change or withdraw their choice at any time with the Cookie settings link at the bottom of every page. When a visitor withdraws, KonversAI removes the cookies common analytics and ad tags leave, and loads the page again without that code.

Can I prove that a visitor said yes or no?

Section titled “Can I prove that a visitor said yes or no?”

Yes. KonversAI records every choice made in the cookie banner of your website as proof of consent: what the visitor chose and when. The record is anonymous. It holds a random id that the visitor’s browser keeps in the cookie kv_consent, and no IP address or other details about the visitor. KonversAI keeps each record for three years. To look up one visitor’s choices, ask them for the id in that cookie, enter it under Proof of consent on Cookies & code and select Look up. Select Download all records (CSV) for every record, for example for a data protection authority.

Why does my analytics tag not run in the preview?

Section titled “Why does my analytics tag not run in the preview?”

Your own code runs only on your own domain. In the KonversAI console preview and on the KonversAI address of your website, KonversAI leaves out the code from In the page head and At the end of the page. A Custom code part runs in a closed box there. Cookies & code says Your code runs on your domain when the domain is connected. Otherwise it says Your code runs only once your website has its own domain. Until then it is saved but left out. Select Connect a domain to set the domain up. On your own domain, code also waits for the visitor’s consent in the cookie banner.

Can I hold back one script and let the rest run?

Section titled “Can I hold back one script and let the rest run?”

Yes. Set the code to Necessary (runs without asking) under Needs consent for, then give the script you want to hold back type="text/plain" and data-category="statistics", or marketing or preferences:

<script type="text/plain" data-category="statistics" src="https://example.com/analytics.js"></script>

The KonversAI cookie banner runs that script when the visitor allows that kind of cookie. The banner also asks about every kind a held-back script is marked with, so a script marked statistics adds Statistics to the banner. analytics, ads and functional, and Cookiebot’s data-cookieconsent, work too.

Do my Google, Microsoft and Meta tags get the visitor’s choice?

Section titled “Do my Google, Microsoft and Meta tags get the visitor’s choice?”

Yes. The KonversAI cookie banner tells tags on your website what the visitor allowed. It sends Google Consent Mode v2, Microsoft UET consent and Meta Pixel consent. Google Tag Manager gets the event konversai_consent_update in the dataLayer. Your own scripts can listen for the konversai:consent event on document, or use window.KonversaiSiteConsent: get() returns the choice, allowed("statistics") says whether a kind is allowed, onChange(callback) calls back on every change, and open() opens the cookie settings.

Only when your own code brings its own consent tool, such as Cookiebot. Without the KonversAI cookie banner, your own code runs for every visitor without asking, and Cookies & code says so. Turn the banner off under Website > Cookies & code with Ask visitors before using cookies, then select Save changes.

No. KonversAI never lets the AI write the privacy policy or the cookie page, because only you know how your business handles personal data. The page editor shows Your privacy policy. Replace each text in [brackets] with how your business handles personal data, then publish it. Replace each text in [brackets], then select Publish page in the toolbar above the page. When you publish the website, these two pages start unticked under Also publish these draft pages.

Last reviewed . Tell us when a step no longer matches the product.