One line at the top of your page
Copy your install tag from the dashboard and paste it as the first tag inside <head>, before any analytics, ads or chat scripts:
<script id="pgcmp" src="https://cdn.trustedcookie.io/c/YOUR_SITE_KEY/script.js"></script>Load it normally, without async or defer: it has to run before other scripts so it can hold them back. Your settings are built into this one file, so there is nothing else to load.
Notes for common platforms
| Platform | Where the tag goes |
|---|---|
| WordPress | Use the Trusted Cookie plugin: paste your code in its settings page |
| Next.js | In pages/_document.tsx inside <Head> as a plain <script>, not next/script |
| Google Tag Manager | Directly in the page, not inside Tag Manager |
| Shopify, Webflow, Wix, HTML | In the site's custom code or head section, as high as it allows |
A JavaScript API for developers
PGConsent.get() // the visitor's choice, or null
PGConsent.has("analytics") // true or false
PGConsent.open() // open the preferences panel
PGConsent.onChange(fn) // run fn after every choiceAdd a cookie settings link to your footer with PGConsent.open(), so visitors can change their mind at any time.
Questions
Will it slow my site down?
The script is about 8 KB compressed, comes as one file with your settings built in, and is cached by the browser.
What if I change the banner later?
Change it in the dashboard. The script picks up your new settings, so you never edit your site's code again.