CookieScan works on any WordPress site – self-hosted, WordPress.com Business/Commerce/Enterprise, or WordPress VIP. Pick the install method that suits your setup.
Before you start
You will need:
- An active CookieScan subscription (view plans)
- Your CookieScan ID – a unique code provided in your dashboard
- Your banner installation code – find it in your CookieScan dashboard:
- Go to Cookie Banner in the left sidebar
- Click the Install Code button
- A popup appears with the code ready to copy
The install code looks like this:
<script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script>
Replace YOUR-COOKIESCAN-ID with the code from your dashboard.
Where it needs to go: in the <head> of every page, before any other 3rd-party scripts (analytics, ads, chat widgets, etc.). This ensures CookieScan loads first and can block cookies until the user consents.
Good news: once CookieScan is installed, you do not need to modify any of your other scripts. CookieScan detects cookies via its built-in scanner (see Cookie Manager in your dashboard) and handles blocking automatically based on user consent.
Method 1: Use a plugin (easiest, no code)
Best for most WordPress users. Safer than editing theme files because a theme update cannot wipe out your changes.
Recommended plugin: WPCode (free, 2 million+ installs)
- In your WordPress admin, go to Plugins → Add New
- Search for “WPCode”
- Click Install Now, then Activate
- In the left sidebar, go to Code Snippets → Header & Footer
- In the Header box, paste your CookieScan code:
<script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script> - Click Save Changes
- Open your site in a new incognito window – the CookieScan banner should appear
Alternative plugins that do the same job:
- Insert Headers and Footers by WPBeginner
- Header and Footer Scripts by DraftPress
- Head, Footer and Post Injections by Stefano Lissa
They all work the same way – paste the CookieScan snippet into the header section, save, done.
Method 2: Add directly via functions.php
Faster than installing a plugin and no extra dependencies. Always use a child theme so the change survives theme updates.
- Go to Appearance → Theme File Editor (or edit
functions.phpvia FTP) - Make sure you are editing your active child theme’s
functions.php(not the parent theme) - Add this at the bottom of the file:
/**
* Load CookieScan banner in the site <head>.
* Priority 1 ensures it loads before any other head scripts.
*/
function cookiescan_banner_script() {
?>
<script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script>
<?php
}
add_action( 'wp_head', 'cookiescan_banner_script', 1 );
Replace YOUR-COOKIESCAN-ID with your own ID from the dashboard.
- Click Update File
- Verify by visiting your site in incognito
Method 3: Install via Google Tag Manager
Good if you already manage tags via GTM. CookieScan provides an official GTM Template so you do not need to write any code.
Step 1 – Get your CookieScan ID
- In your CookieScan dashboard, go to Cookie Banner
- Click Install Code
- Switch to the Google Tag Manager Install tab
- Click Copy Key to copy your CookieScan ID
Step 2 – Add the CookieScan template to GTM
- Log into Google Tag Manager
- Select your container
- In the left sidebar, click Templates
- Under Tag Templates, click Search Gallery
- Search for “CookieScan” and add it to your workspace
Step 3 – Create a new tag using the template
- Go to Tags → New
- Name the tag “CookieScan Banner”
- For Tag Configuration, choose the CookieScan template you just added
- Paste your CookieScan ID into the ID field
- Triggering: choose Consent Initialization – All Pages
Important: Use Consent Initialization, not All Pages. This fires CookieScan before any other tag, so consent is established before analytics/ads try to load.
- Click Save
Step 4 – Submit and publish
- Click Submit (top right)
- Give the version a name and description
- Click Publish
Step 5 – Verify
Use GTM’s Preview mode to confirm the CookieScan tag fires on every page before your other tags.
Verify the installation
In your CookieScan dashboard, open the Cookie Banner → Install Code popup. Step 3 is Verify Installation. Follow it, and the dashboard will confirm whether CookieScan is live.
Alternatively:
- Visit your site in a new incognito window
- The CookieScan banner should appear
- Open browser DevTools (F12) → Network tab → filter by
cookiescan - You should see
banner.cookiescan.combeing loaded successfully
What happens next
Once the banner is live, CookieScan handles the rest automatically:
- It scans your site (monthly by default) and detects every cookie
- New cookies appear in your Cookie Manager → Unclassified – move them into the right category (Necessary, Preference, Statistics, Marketing)
- The banner blocks cookies until the user consents to their category
- Every consent decision is logged in Consent Log for compliance audits
No manual script tagging required.
Troubleshooting
Banner is not appearing
- Clear your WordPress cache (WP Rocket, W3 Total Cache, WP Super Cache etc.)
- Clear your CDN cache (Cloudflare, BunnyCDN, etc.)
- View page source (Ctrl+U / Cmd+Option+U) and search for
cookiescanto confirm the script is present in the<head> - Check the browser console (F12 → Console) for errors
Banner keeps reappearing on each page load
- A caching plugin may be stripping the consent cookie. Clear the cache
- Check you are not in incognito/private browsing (cookies do not persist between sessions)
Cookies are still loading before consent
- The banner needs to run before other scripts. Make sure it is near the top of
<head> - Check it is loaded on every page (not just the homepage)
- Run a fresh scan in Cookie Manager → Rescan Domain so CookieScan knows about all your cookies
Full documentation
For detailed setup help, go to Cookie Banner → Install Code → support guide in your CookieScan dashboard, or visit our support guides.