. No npm, no build step required. Style and color are configured in the dashboard."}},{"@type":"Question","name":"Is getconsent.io GDPR compliant?","acceptedAnswer":{"@type":"Answer","text":"Yes. getconsent.io is built with privacy by design and is intended to support common consent requirements under GDPR, CCPA, LGPD, and similar laws. The Ghost style presents essential-only messaging by default and exposes a consent signal so your site can gate non-essential scripts and cookies."}},{"@type":"Question","name":"Is there a free plan?","acceptedAnswer":{"@type":"Answer","text":"Yes. Free plan supports 1 site and 5,000 consent events per month. No credit card required."}}]},{"@type":"Organization","name":"getconsent.io","url":"https://getconsent.io","contactPoint":{"@type":"ContactPoint","contactType":"customer support","email":"support@getconsent.io","url":"https://getconsent.io/support"}}]}
4 min read

How to Add GDPR Cookie Consent to Any Website in 60 Seconds

Adding GDPR-compliant cookie consent to your website shouldn't require a weekend of work. In this guide, you'll go from zero to fully compliant in under 60 seconds — with a single line of code.

Why You Need Cookie Consent

If your website uses cookies — and it almost certainly does — the General Data Protection Regulation (GDPR) requires you to obtain explicit, informed consent from visitors before setting non-essential cookies. This applies to any site that has visitors from the EU, regardless of where you're based.

The consequences of non-compliance aren't theoretical. Fines can reach up to €20 million or 4% of annual global turnover, whichever is higher. More practically, enforcement is ramping up, and even small businesses are receiving notices from data protection authorities.

Step 1: Create Your Account

Head to getconsent.io/signup and create a free account. No credit card required. You'll land on your dashboard where you can register your first site.

Step 2: Register Your Domain

Click "Add site" in the dashboard and enter your domain name. getconsent.io will generate a unique site ID for you. This ID links the consent banner to your domain and stores consent records on your behalf.

Step 3: Add the Script Tag

Copy the script tag from your dashboard and paste it into the <head> of your HTML — before any other scripts. It looks like this:

<script
  src="https://getconsent.io/v1.js"
  data-site-id="your-site-id"
  defer
></script>

That's it. One line of code. The script automatically:

  • Detects the visitor's locale and shows the banner in the right language
  • Blocks non-essential cookies until consent is granted
  • Records proof of consent with a timestamp and consent ID
  • Respects the visitor's choice on subsequent visits

Step 4: Choose Your Style

getconsent.io ships with four banner styles that you can select from your dashboard: a bottom bar, a corner popup, a centered modal, and an inline banner. Each is designed to be clear and respectful — no dark patterns, no visual tricks.

You can configure:

  • Position — bottom, top, center, or corner
  • Colors — match your brand with custom accent and background colors
  • Text — customise the banner copy and button labels
  • Categories — define which cookie categories visitors can toggle (analytics, marketing, functional)

Step 5: Verify It Works

Open your site in an incognito window. You should see the consent banner immediately. Accept or reject cookies and check your getconsent.io dashboard — the consent event will appear in your analytics within seconds.

Conditional Script Loading

For scripts that should only fire after consent (like Google Analytics), use the built-in event listener:

window.addEventListener("consent", function (e) {
  if (e.detail.analytics) {
    // Load Google Analytics
    const script = document.createElement("script");
    script.src = "https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX";
    document.head.appendChild(script);
  }
});

This ensures analytics scripts never execute until the visitor has explicitly opted in.

What About Existing Cookies?

If a visitor rejects cookies or withdraws consent, getconsent.io automatically clears any non-essential cookies that were set. You don't need to write any cleanup code — it's handled by the script.

Wrapping Up

GDPR compliance doesn't have to be complicated. With a single script tag, you get a fully compliant consent banner, automatic cookie blocking, proof of consent, and a clean dashboard to manage everything. No legal fees, no complex configurations, no maintenance burden.

The free plan covers up to 5,000 consent events per month — more than enough for most websites. If you outgrow it, paid plans start at $9/month.


Ready to add consent to your site?

GDPR-compliant cookie consent in 60 seconds. Free plan available — no credit card required.

Get started