Skip to main content
Signocore
// signocore consent docs

Google Consent Mode v2

How Signocore Consent sends Consent Mode v2 defaults and updates, and how to set up Google Analytics 4 and Google Tag Manager with it.

Signocore Consent sends Google Consent Mode v2 signals on every frontend page while Cookie consent is on under Settings → Cookie consent. Google tags read them and adjust what they store and send. You do not need any Consent Mode code of your own.

Defaults

Early in the page head, at wp_head priority 1, the plugin prints the defaults before any other script:

gtag('consent', 'default', {
    'ad_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied',
    'analytics_storage': 'denied',
    'functionality_storage': 'denied',
    'personalization_storage': 'denied',
    'security_storage': 'granted',
    'wait_for_update': 500
});
gtag('set', 'ads_data_redaction', true);

Every signal starts as denied, apart from security_storage, which the always-active Necessary category grants. wait_for_update makes Google tags wait up to 500 milliseconds for a visitor's choice before they send anything, and ads_data_redaction removes ad click identifiers from requests while ad_storage is denied.

The same script creates window.dataLayer and the gtag() function, so it works whether you use the Google tag or Google Tag Manager.

Updates

For a returning visitor, the same head script reads the saved choice and sends it as gtag('consent', 'update', ...) straight after the defaults, before any Google tag runs. When a visitor makes or changes a choice, the update is sent right away, without a page reload.

Consent Mode signal Default Granted when the visitor allows
security_storage granted Always granted (Necessary)
functionality_storage denied Preferences
personalization_storage denied Preferences
analytics_storage denied Statistics
ad_storage denied Marketing
ad_user_data denied Marketing
ad_personalization denied Marketing

A visitor who allows Statistics but not Marketing is measured in Google Analytics, while Google Ads tags store no advertising cookies. A signal that no category grants stays denied.

Set up Google Analytics 4 or Google Tag Manager

Google tags read the consent state, but only if they load after the defaults. Add your tag inside wp_head at priority 2 or higher. Most theme options and plugins for tracking codes print it there, but check the order as described under Check the setup. A tag written into the theme's header.php above the wp_head() call loads too early.

Google Analytics 4 with the Google tag

  1. Leave Cookie consent on.

  2. Add the Google tag snippet from your GA4 property to the head. In a child theme's functions.php or a small plugin, that looks like this, with your own measurement ID:

    add_action('wp_head', function (): void {
        ?>
        <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
        <script>
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());
            gtag('config', 'G-XXXXXXXXXX');
        </script>
        <?php
    }, 10);
    
  3. Do not add Consent Mode code of your own. The plugin sends the defaults and the updates.

Google Tag Manager

  1. Add the Tag Manager container snippet to the head in the same way, at priority 2 or higher.
  2. Google tags in the container, such as the Google tag, GA4 events and Google Ads, adjust to the consent state on their own.
  3. For other tags, open the tag in Tag Manager, go to Advanced Settings → Consent Settings, choose Require additional consent for tag to fire and add analytics_storage for analytics tags or ad_storage for marketing tags. The tag is then held back while that consent is denied.
  4. Do not add a consent template or a second set of defaults in the container.

Scripts outside Google's tags, such as advertising pixels and chat widgets, do not read Consent Mode. Hold them back with an attribute as described in Load scripts after consent.

Check the setup

  1. Open a page in a private browser window and view its source. The gtag('consent', 'default', ...) line must come before your Google tag or Tag Manager snippet.
  2. Use Tag Assistant to connect to your site. Its consent view shows the denied defaults, then the update after you click Accept all or Reject all.
  3. Reload the page after choosing. The update now appears straight after the defaults, before any tag fires.

Stuck on something the docs don't cover?

Questions go straight to the developer who builds the plugins. Replies usually within a day.