Meet Eric Docs

DocsInstall the tracking code

Consent and cookies

How Eric's tracking code handles cookie banners, consent tools, Global Privacy Control and opt-outs.

Reference · Last updated 27 October 2026

On this page

You decide whether your visitors must agree before they are measured. You know which of your visitors the law covers. This page explains what the tracking code does so you can set it up the way you need.

What the code stores

The code sets no cookies. It keeps two random numbers in the browser's own storage: a visitor number (kept up to 13 months) and a session number (ends after 30 minutes of quiet). No name, email or IP address. The full list is on our Cookies page.

The code recognises these consent tools by itself. It waits for the visitor's answer for analytics, and stores and sends nothing until the visitor agrees. You don't need to set anything up.

While a page is loading, the code waits a moment (up to two seconds) to see whether a consent tool appears, and keeps and sends nothing in that time.

Two ways to hold measurement back until the visitor agrees:

  • Fire the code from your consent tool, or on a consent trigger in Tag Manager. Anything sent before the code loads is queued, so nothing is lost.
  • Mark the code as needing consent. Add data-consent="required" to the second script line. Then, on every page where the visitor has agreed, call ec("consent", "granted"). If they refuse, call ec("consent", "denied"); that answer is remembered.

If your consent tool might call ec before the code has loaded, add this line first so the calls are queued:

window.ec = window.ec || function () { (window.ec.q = window.ec.q || []).push(arguments); };

If your site has no consent tool, the code measures from the first page. That is your choice as the site owner.

What always stops measurement

  • Global Privacy Control turned on in the visitor's browser.
  • Opting out: a link with ?ec_optout=1, or ec("optout"). ec("optin") undoes it.

Visitors who haven't agreed see your page as it is and are left out of tests.

Your own visits

Eric's install check and "Show me first" previews are kept out of your numbers.

Note: For what our own website stores, see the Cookies page and the Privacy page.

Still stuck?

Tell us what you tried and what you saw. You don’t need to be signed in, and we reply by email, usually within one working day.

Ask us