Where do I put the CookieConsentHQ script in HTML?
Place the script immediately after the opening <head> tag, before any other scripts. Copy the snippet from the Install tab in your CookieConsentHQ dashboard.
Your HTML looks like this:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.cookieconsenthq.com/s/YOUR_SITE_KEY.js"></script>
<!-- analytics, tag manager and other scripts come after -->
</head>
The script must load synchronously, so don't add async or defer. Position matters because CookieConsentHQ can't stop a tracker that has already run, so analytics and advertising scripts must come after it.
If you use a tag manager, place the CookieConsentHQ snippet above the tag manager's container code.
How do I add it to every page?
Add the script once to the shared header template or layout that every page uses, or to each HTML file. Then publish or deploy the updated files.
- Hand-coded sites with separate files: paste the snippet right after the opening
<head>in each file. - Static site generators and custom CMSs: put it in the shared template that produces the page's
<head>. - Single-page apps: add it once to the HTML shell's
<head>; it stays loaded as the app changes routes.
Check pages that don't use the shared template. Old landing pages and error pages may need the snippet added separately.
See the installation documentation for the shared setup steps.
How do I block scripts and iframes before consent?
Use the manual blocking attributes when a script or iframe must not load before consent. A marketing script becomes:
<script type="text/plain" data-cchq="marketing" src="..."></script>
Use analytics or functional where that fits. A normal <script src> tag is stopped from running, but the browser may still fetch it early; type="text/plain" stops that request too.
For a marketing iframe, move the address into data-cchq-src:
<iframe data-cchq="marketing" data-cchq-src="..."></iframe>
How do I check the published HTML?
Look at the published HTML, not only your source files: a plugin, build step or CDN can rewrite or reorder the head on the way out. Confirm that CookieConsentHQ is the first script in <head>, without async or defer, and that no analytics, advertising or tag manager script comes before it.
The Verify installation button in your dashboard does this for your homepage. It loads the page as a new visitor and checks the script for your site, its position, the banner, cookies set before consent, Google Consent Mode defaults and the live banner version.
The free checker checks any single page for cookies set before consent, hardcoded tracker tags and Consent Mode v2 defaults.
How do I show the cookie list and a settings link?
Add <div data-cchq-cookie-table></div> where your cookie list should appear; the cookie scanner fills it. To let visitors reopen their choices, call CCHQ.showPreferences(), for example from a "Cookie settings" link in your footer.
Each choice is kept in your consent log.
This page is technical installation guidance, not legal advice.