Advanced Configuration: Collect all data and require explicit consent before running

Do you want to continue collecting data and insights while having your website comply with the EU GDPR?

In this guide, we will show you how to implement the advanced configuration of requiring a user’s explicit consent before running Google Analytics tracking.


  1. If you’re looking for other necessary steps and instructions involved with EU Compliance, head over to our guide: Getting Started with the EU Compliance Addon.
  2. Please see the bottom of this guide for an important legal disclaimer.

This guide is for those who might be interested in requiring their website visitors to explicitly opt-in. We don’t recommend this option since some Google Analytics data can be lost as a result. This is because visitors will not be tracked until after they’ve opt-in, which can lead to:

  • some sessions only being partially tracked
  • missing page views
  • inflated bounce rates
  • and so on

However, our customers have shown a good amount of interest in this implementation, so we’ve put this guide together!

If you’re planning on using an explicit opt-in via the integration with Cookie Notice, CookieBot, CookieYes, or Complianz to collect all information ExactMetrics would normally, you won’t have to worry about toggling off certain options in your Google Analytics settings as instructed in Google Analytics Account Settings Changes for EU Compliance. You will just need to use the following snippet:

add_filter( 'exactmetrics_eu_compliance_require_optin', '__return_true' );

You can add this snippet of code easily with the plugin Code Snippets.

Please note the following if you choose to require opt-in:

  • Your privacy policy and cookie information pages need to be up to date and be explained clearly to your visitors.
  • Your opt-out option is clear. It is as easy to opt-out as it is to opt-in.
  • For the storage of PII (personally identifiable information), we highly recommend consulting with an appropriate attorney to ensure you have met all compliance obligations.
  • We do not provide support for incomplete or missing data within Google Analytics.
  • We do not guarantee the above method will always be valid, as we make development decisions based on how the majority of our users are using our product.
  • We emphasize best practices and if you choose to utilize this guide, please follow our ExactMetrics blog or this page for future changes that may impact this implementation or method.

That’s all there is to it! You’ve set up the snippet that requires your users to explicitly opt-in for tracking. You should be able to continue tracking normal information, such as demographics.

If you’re looking for other necessary steps on your compliance with the EU GDPR for your Google Analytics tracking, read our complete guide: Getting Started with the EU Compliance Addon.


Legal Disclaimer: This addon is designed to automate some of the settings change required to be in compliance with various EU laws however due to the dynamic nature of websites, no plugin can offer 100% legal compliance. Please consult a specialist internet law attorney to determine if you are in compliance with all applicable laws for your jurisdictions and your use cases.

As a website operator, it is solely your responsibility to ensure that you are in compliance with all applicable laws and regulations governing your use of our plugin.

ExactMetrics, its employees/contractors, and other affiliated parties are not lawyers. Any advice given in our support, documentation, website, other mediums or through our services/products should not be considered legal advice and is for informational and/or educational purposes only and are not guaranteed to be correct, complete or up-to-date, and do not constitute creating/entering an Attorney-Client relationship.