Set up consent mode on websites

This page is for developers who maintain their own consent solution on their website and want to integrate consent mode. For an introduction to consent mode, read Consent mode overview. If you use a Consent Management Platform (CMP) to obtain user consent, learn more about how to set up consent mode with a CMP.

You can implement consent mode in a basic or advanced way. Check your company's guidelines to pick an implementation method and which defaults to set. Learn more about basic versus advanced consent mode.

Before you begin

Take the following into consideration before implementing consent mode:

  • If you use Tag Manager and want to maintain your own banner, the recommended approach is loading your banner through the Tag Manager container. To do so, you need to create a consent mode template. Alternatively, you can use a consent mode template from the Community Template Gallery.

  • If you use gtag.js, make sure you have installed the Google tag on every page of your website. The consent mode code gets added to each page of your website.

To set up consent mode, you need to:
  1. Before a user grants consent: Set the default consent state.
  2. Update the consent state based on the user interaction with your consent settings.

As a part of Google's ongoing commitment to a privacy-centric digital advertising ecosystem, we are strengthening the enforcement of our EU user consent policy.

Learn more about Google's Updates to consent mode for traffic in European Economic Area (EEA).

Consent mode users need to send two new parameters in addition to ad_storage and analytics_storage:

Field Name Allowed Values Description
ad_user_data 'granted' | 'denied' Sets consent for sending user data related to advertising to Google.
ad_personalization 'granted' | 'denied' Sets consent for personalized advertising.

Next steps

Legacy tag controls

If you use legacy tags, such as ga.js, analytics.js, or conversion.js, update to gtag.js or Google Tag Manager.

To learn more about other legacy tag's privacy controls, see the following documentation: