PrivacyQuick

All documentation pages ↓

Install PrivacyQuick on any website

If you can edit your site's HTML head, you can install the banner: one script tag, then a type attribute on each script that should wait for consent.

This page covers hand-written HTML, static site generators (Hugo, Jekyll, Eleventy, Astro) and any CMS that lets you edit a shared header template. If your site runs on a platform with its own guide, use that instead: WordPress, Shopify, Next.js, Wix, Squarespace or Webflow.

1. Add your site and copy the snippet

In the dashboard, choose Add a website and enter your domain. A first cookie scan is queued and the site gets a default banner. Open the site's Overview tab and copy the snippet from the Install box:

<script src="https://cdn.privacyquick.com/v1/privacy.js" data-site-id="pq_xxxxxxxxxx" async></script>

2. Paste it at the top of the head

Put the tag as high in the <head> as you can, above analytics and advertising tags, on every page. On a templated site that means the shared layout or header partial, so you only paste it once.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <script src="https://cdn.privacyquick.com/v1/privacy.js" data-site-id="pq_xxxxxxxxxx" async></script>
  <!-- your other tags below -->
</head>

The position matters for Google tags. The banner sets the Consent Mode default as soon as it runs, and Google expects that default before its own tags start. If you can't control the order, add the inline default snippet described in that guide.

3. Tag the scripts that should wait

Rather not tag each script? Put the automatic blocker line directly above the snippet. It holds scripts from known analytics and advertising services, so you only tag what it doesn't cover. It has to load before those scripts, so it only helps if it is the first script in the head.

The banner doesn't block anything by itself. Change each tracking script to type="text/plain" and give it a data-category of analytics, functional or marketing:

<!-- before -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

<!-- after -->
<script type="text/plain" data-category="analytics" async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script type="text/plain" data-category="analytics">
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Embeds such as YouTube videos or maps are iframes. Move the address from src to data-src and add a category:

<iframe data-src="https://www.youtube-nocookie.com/embed/VIDEO_ID" data-category="functional" width="560" height="315" title="Video"></iframe>

Blocking scripts has every pattern, including ES modules and tags that need more than one category. Cookie categories explains which category to pick.

4. Add a "Cookie settings" link

Visitors must be able to change their mind as easily as they agreed. The banner shows a small floating button after a choice. A footer link is a good addition, and it's the only way back to the settings if you switch the floating button off:

<a href="#" onclick="window.PrivacyQuick && PrivacyQuick.open(); return false;">Cookie settings</a>

5. Test it

  1. Open your site in a private window. The banner should appear.
  2. Open the browser's developer tools, go to the Network tab and reload. Tagged scripts shouldn't be requested before you choose.
  3. Click Accept all. The tagged scripts load without a page reload.
  4. Reload the page. The banner stays closed.
  5. In the dashboard, the site changes from Not seen yet to Installed within a minute or two.

Something not working? See Troubleshooting.

Things that trip people up

  • A Content Security Policy. If your site sends a CSP header, allow https://cdn.privacyquick.com in both script-src and connect-src. The script loads from that host, then fetches your site settings and sends consent records to it.
  • One site ID per site. Use the snippet that belongs to the site you added. Page views count toward your plan wherever the snippet runs, including a staging copy.
  • Subdomains. The visitor's choice is stored in a cookie for the exact host name, so www.example.com and shop.example.com each ask once.
  • Scripts added by JavaScript. Tags your own code injects later aren't watched. Check PrivacyQuick.has('analytics') before injecting them; see the JavaScript API.