FR EN

Google Consent Mode v2 and GTM

Principle: default deny

As soon as the Agreely loader runs, it installs Consent Mode v2 in default-deny mode synchronously, before the banner module is downloaded and before GTM loads any tag:

// what the loader installs immediately (no action required on your part)
gtag('consent', 'default', {
  ad_storage:            'denied',
  analytics_storage:     'denied',
  ad_user_data:          'denied',
  ad_personalization:    'denied',
  functionality_storage: 'denied',
  security_storage:      'granted',
});

The security_storage: 'granted' signal covers the agreely_consent cookie itself, classified as strictly necessary (article 14: the consent cookie is required for the mechanism to function).

Load order

The Agreely tag must appear before the GTM tag in your <head>:

<head>
  <!-- 1. Agreely first - installs default deny -->
  <script async
    src="https://cdn.agreely.ca/e/v1/loader.js"
    data-agreely="agr_pub_YOUR_KEY"></script>

  <!-- 2. GTM next -->
  <script async src="https://www.googletagmanager.com/gtm.js?id=GTM-XXXXX"></script>

  <!-- ... rest of head ... -->
</head>

If GTM loads before Agreely, tags fire without a consent signal and zero-click enforcement is not guaranteed.

Signal mapping

When a visitor makes a decision, the banner sends a gtag('consent', 'update', ...) signal with the following mapping:

Agreely category Consent Mode v2 signals updated
Marketing ad_storage, ad_user_data, ad_personalization
Analytics analytics_storage
Functional functionality_storage
Strictly necessary (no signal - always granted)

Categories the visitor has not granted stay at denied until an update. A consent withdrawal resets all signals to denied (except security_storage).

If you use gtag.js directly (without GTM), the flow is identical: Agreely installs the default, your upstream code can call gtag('config', ...), and the agrConsent event on window signals each decision change if you need it:

window.addEventListener('agrConsent', (e) => {
  console.log(e.detail); // { action, decisions, consentId }
});

Verifying the default signal is applied

Open your browser in private mode (no pre-existing cookies), navigate to your site, and in the DevTools console:

// before any interaction with the banner:
window.google_tag_data?.ics?.entries ?? 'not loaded yet'

All non-essential signals should be denied. If you see granted, the GTM tag is probably loading before the Agreely tag.