# Hoe IP-adressen Google Analytics anonimiseren in 2021 op Discourse?

**URL:** <https://meta.discourse.org/t/how-to-anonymize-ips-google-analytics-in-2021-on-discourse/179674>\
**Category:** Data & reporting\
**Created:** [14 februari 2021 om 16:40 UTC](https://meta.discourse.org/t/how-to-anonymize-ips-google-analytics-in-2021-on-discourse/179674 "2021-02-14T16:40:53Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![AquaL1te](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aqual1te/32/201966_2.png) [@AquaL1te](https://meta.discourse.org/u/AquaL1te)\
**Post date:** [17 februari 2021 om 10:56 UTC](https://meta.discourse.org/t/how-to-anonymize-ips-google-analytics-in-2021-on-discourse/179674/3 "2021-02-17T10:56:42Z")

</div>

One more question, when I copy/paste the gtag.js stuff before the `</head>` tag, analytics stops to work. I disabled Analytics in the admin settings. Or should I keep that enabled and do I only have to add certain config settings in my custom HTML for e.g. [IP anonymization](https://support.google.com/analytics/answer/2763052?hl=en)? How would I do that? Is Discourse blocking external loaded Javascript by default? Is there a allowlist? A lot of questions 🙂

This is the gtag.js I got from the admin panel in Google Analytics and placed that before the ` tag in Discourse:

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

  gtag('config', 'UA-12345678-1', { 'anonymize_ip': true });
</script>

```

The Google Analytics code that’s enabled by the admin settings is different, and does not external Javascript code. So that might be the main difference?

---

_[View the full topic](https://meta.discourse.org/t/how-to-anonymize-ips-google-analytics-in-2021-on-discourse/179674)._
