FR EN

Installation

The single tag

Paste this tag first in your <head>, before any tag manager or analytics script:

<script async
  src="https://cdn.agreely.ca/e/v1/loader.js"
  data-agreely="agr_pub_YOUR_KEY"></script>

That is all. The loader is lightweight (around 0.7 KB compressed), asynchronous, and does not block page rendering. It installs the Consent Mode v2 signal in default-deny mode synchronously, before the banner module is downloaded, so no 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 async
  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 async
  src="https://cdn.agreely.ca/e/v1/loader.js"
  data-agreely="agr_pub_YOUR_KEY"
  data-nonce="abc123"></script>

Getting your site key

  1. Sign in to agreely.ca and navigate to Cookies in the main navigation.
  2. Click New website and enter your domain.
  3. Paste the installation tag into your <head> (verification step).
  4. Agreely automatically detects the tag and marks the domain as verified.
  5. Your site key (agr_pub_...) is shown at the installation step and always available in the website settings.

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.