The Google Consent Mode tag in Matomo Tag Manager lets you control the tracking behaviour of Google tags (e.g., Google Analytics and Google Ads) implemented in your Matomo container. When integrated with a certified Consent Manager Platform (CMP), the Google Consent Mode tag ensures that each Google service adapts its tracking based on the user’s consent choice.

Note: The Google Consent Mode tag does not collect consent from users on its own. It must be connected to a Google-certified or permitted Consent Management Platform (CMP) that collects valid consent and pushes consent update events, which the Consent Mode tag then uses to inform Google.

Targeting users in the EEA, UK, or Switzerland?.
You must use the Google Consent Mode tag in Matomo Tag Manager if you configured Matomo to track any Google advertising or analytics services (e.g., GA4, Customer Match, Ads Data Hub) and your site targets users in the EEA, UK, or Switzerland.
By default, the Google Consent Mode tag should be configured to deny all consent types (ad_storage, analytics_storage, ad_user_data, ad_personalization) for users in the EEA, UK, or Switzerland until explicit consent is granted through a CMP. Check which countries you are targeting to determine if consent is required for your implementation.

If you are using Google-based tags in Matomo Tag Manager and need to respect user consent for compliance, you should implement the Google Consent Mode tag together with a Google-certified consent manager to notify Google on the user’s consent choices.

You can integrate a Consent Management Platform (CMP) to manage how and when cookies are set based on user choices. The CMP must be configured to block and enable Google tags based on consent given. The Google Consent Mode tag is needed to define the default consent status (before consent given) and the update consent status (after consent granted or denied).

If the Consent Mode tag is not used with other Google tags in MTM, Google assumes consent is granted (or automatically denied by the CMP if implemented). Tracking behaviour does not get adjusted and no consent-related information is passed to the dataLayer.

Each tag container in Matomo Tag Manager (MTM) and Google Tag Manager (GTM) is independent and Google services do not automatically share consent signals across containers.

  • If you use MTM to fire some Google tags, then use the built-in Google Consent Mode tag to ensure Google tags loaded via MTM respect the user’s consent. If you’re only using MTM to manage Google tags, no configuration is needed in GTM.
  • If you use GTM to fire some Google tags, then use the GTM tags’ built-in consent settings to ensure Google tags loaded via GTM respect the user’s consent.

To maintain compliance and consistent behaviour across your site, it is recommended to implement Consent Mode wherever Google tags are loaded.

The Google Consent Mode tag supports the following consent types (based on the Google consent mode reference):

  • ad_storage – Enables storage, such as cookies (web) or device identifiers (apps), related to advertising.
  • ad_user_data – Sets consent for sending user data to Google for online advertising purposes.
  • ad_personalization – Sets consent for personalised advertising.
  • analytics_storage – Enables storage, such as cookies (web) or device identifiers (apps), related to analytics.
  • functionality_storage – Enables storage that supports the functionality of the website or app.
  • personalization_storage – Enables storage related to personalisation.
  • security_storage – Enables storage related to security such as authentication and other user protection.

Each type represents a specific purpose for data collection and can be set to one of two states:

  • granted: The user has given consent for this type of data to be collected.
  • denied: The user has not given consent, so tracking must occur without cookies or be disabled.

The Google Consent Mode tag in MTM is not used for data uploads directly. However, when uploading user data to Google (e.g., offline sales, CRM data), you must ensure that consent was obtained and that the consent state for ad_user_data and ad_personalization was recorded and sent to Google using an appropriate mechanism, such as via Consent Mode v2 or a Google Ads API parameter.

  1. Open your Matomo Tag Manager container and navigate to Tags.
  2. Click Create New Tag and choose Google Consent Mode.
    choose google consent mode tag in matomo

The Google Consent Mode tag relies on two types of signals to determine how Google tags should behave based on the user’s consent. To work correctly, you will need to add two Google Consent Mode tags for each mode:

  • Default mode: One default mode tag that sets all consent types to denied (or your preferred default aligned with applicable privacy laws) before the user interacts with your consent banner.
  • Update mode: One or more update mode tags that change specific consent types to granted based on accepted categories.

Without both signals, Google services will automatically track with cookies (if not blocked by the CMP) and Google tags will not react to user consent changes if update mode is missing.

Set up Tag 1: Default mode (on page load)

  1. Set the Consent mode action to default.
  2. Add or remove the required Google consent types with the Consent state set to denied (or your preferred consent state).
    google consent default mode in matomo
  3. Link a Pageview trigger to fire the tag when the page loads.
  4. Click Create New Tag to save.
  5. When the tag fires on page load, the consent object default is created in the dataLayer.

Before configuring the Consent Mode – Update tag, you will need to add one or more Custom Event triggers to fire the tag when the CMP pushes a consent update event. Depending on your CMP configuration, you may need to create a trigger for each defined category, e.g., Performance, Targeting, and Functional. This example uses an integration with the CookieScript CMP where the Performance category is used by default for analytics.

  1. Go to Tag Manager > Triggers and click Create New Trigger.
  2. Choose the Custom Event trigger and provide a name, e.g., Consent Mode Update-Performance. This trigger fires the consent tag when consent updates are received for the Performance category.
  3. Enter the Event Name that must occur to execute this trigger. For example, CookieScript pushes the event CookieScriptCategory-performance if consent is granted for the Performance category.
  4. To find the event name, open your browser’s developers tools and go to the Console tab. Use the CMP widget to grant/deny consent. In the Console, type dataLayer and press Enter to view the events pushed by your consent manager and identify which events correspond to consent updates. Use these event names to configure the custom triggers.
  5. Click Create New Trigger to save.
  6. Repeat the custom trigger set up steps for each category event you want to track consent updates for.
  7. To set up the Consent Mode – Update tag, go to Tags and click Create New Tag.
  8. Set the Consent mode action to update.
  9. Use the same Google consent types added in Tag 1 (default mode) and set the Consent state to granted (or your preferred consent state when the user changes the default consent state).
    define google consent update mode in matomo
  10. Link the Custom Event trigger to fire the tag when the consent event is detected.
  11. Click Create New Tag to save.
  12. When the tag fires on consent change, the consent object update is created in the dataLayer.

Note: If you want to prevent your Google tags from firing at all before consent is granted, update the triggers to use the same Custom Event triggers you created for the Consent Mode – Update tag. This ensures that Google tags only execute after the relevant consent has been explicitly granted by the user.

Validate the configuration

Once your Google Consent Mode tags and Custom Event triggers are configured in Matomo Tag Manager, you can test the tracking behaviour for different regions to validate your privacy compliance setup.

  1. To simulate different locations, use a VPN during testing.
  2. Open your site in an incognito browser window to simulate a new visitor with no prior cookies or consent.
  3. Use the Preview and Debug mode in Tag Manager.
  4. Open your browser’s developer tools > Console tab. Use the CMP widget to decline or accept different categories (e.g., Performance, Targeting) to test both default and update behaviour.
  5. Type dataLayer in the Console and press Enter to inspect the events pushed by your CMP.
  6. Look for a consent object with "default" with all consent types set to "denied" (this should appear before user interaction).
    datalayer view of google consent mode
  7. After granting consent, look at the dataLayer for a consent object with "update" and the consent types are set to "granted".
    view the datalayer after google consent update

Troubleshooting Tips

  • No consent object in the dataLayer: Check that the Google Consent Mode tag – Default tag is firing on page load and that your CMP is loading before it.
  • Consent Mode – Update not firing: Ensure your Custom Event trigger matches the event name pushed by your CMP. You can inspect the dataLayer output to confirm the exact spelling.
  • Google tags firing before consent: Update the Google tag triggers to use the Custom Event triggers instead of a DOM Ready or All Pages trigger.
  • Cookies dropped before consent: Confirm that your CMP is properly blocking tags/cookies until consent is given.
Previous FAQ: How to add Google Ads Remarketing Tags in Matomo Tag Manager