Installation
The single tag
Paste this tag first in your <head>, before any tag manager or analytics
script:
<script
src="https://cdn.agreely.ca/e/v1/loader.js"
data-agreely="agr_pub_YOUR_KEY"></script>
Place this tag first, before any other script, and without the async
attribute: the loader must run before your other tags. It is tiny (around 0.7
KB compressed) and executes immediately. On execution it synchronously
installs the Consent Mode v2 signal in default-deny mode and the guard that
defers known tracker hosts until consent is granted; it then downloads the banner
module asynchronously, without blocking rendering. This order (loader first,
synchronously) is what ensures no tracker or Google non-consent signal escapes
during loading.
Subresource integrity (SRI)
The loader embeds the sha384 hash of the banner module by default; the injected
script carries integrity and crossorigin="anonymous" automatically. No extra
attribute is needed on the base tag.
For pinned versions (URL of the form /e/v1.2.3/loader.js), the URL is
immutable and the SRI is fixed - ideal if you want to control the exact deployed
version:
<script
src="https://cdn.agreely.ca/e/v1.2.3/loader.js"
data-agreely="agr_pub_YOUR_KEY"></script>
CSP nonce
If your script-src is nonce-based, pass the nonce via the data-nonce
attribute and the loader forwards it to the injected module script:
<script
src="https://cdn.agreely.ca/e/v1/loader.js"
data-agreely="agr_pub_YOUR_KEY"
data-nonce="abc123"></script>
Getting your site key
- Sign in to
agreely.caand navigate to Cookie banner in the main navigation. - Click New website and enter your domain. The site is created on the free Discovery tier; no payment is requested at this step (see pricing).
- Paste the installation tag above into your
<head>. - Back in the dashboard, click Verify the installation. Agreely scans the
page, confirms the
data-agreelytag with your key is present, then marks the domain as verified. - Your site key (
agr_pub_...) is shown at the installation step and always available in the website settings.
Tag-based verification, not DNS. Verification simply confirms that the
data-agreelytag is present on the page: you install the tag, you click Verify the installation, and the Agreely scanner observes the tag. There is no DNS record or TXT file to publish. See also Verification and security.
The site key is a public, capability-free identifier. It only allows reading the public configuration and submitting a rate-limited, domain-checked consent record. It is safe to include in your page HTML.
Key rotation
To rotate a key, generate a new one in the website settings. A 24-hour grace period lets both keys work in parallel while you roll out the update. Then revoke the old key.
Reopening the banner
To let visitors review or change their preferences from any page, add a link or
button with the data-agreely-open attribute:
<a href="#" data-agreely-open>Manage my cookies</a>
This link must remain visible and keyboard-reachable on every page, in line with Law 25 (article 14: withdrawing consent must be as easy as giving it). You can also call it programmatically:
window.agreelyCookies.open(); // open preferences
window.agreelyCookies.refuseAll(); // refuse all programmatically
window.agreelyCookies.withdraw(); // withdraw active consent
Accessibility note. The preferences layer (
role="dialog",aria-modal="true") manages focus traps, Esc key handling, and focus restoration. Layer 1 (the main banner) does not block scrolling or navigation so that consent remains free.