'Make Google Analytics TCF 2.0 Compliant

I have been on two Google Implementation calls and have been trying to get some help to implement this.

I want to know how to add this line of code:

​window['gtag_enable_tcf_support'] = true

with by Google Analytics code in the <head> tag.

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXXXX-1');
</script>

Everyone said it was a simple code adjustment but no one knows how to implement it.

This is the URL that has the instructions.

Anyone successfully added it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source