In Google Tag Manager we get this code for placing on pages
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-ADSAFASDF');</script>
Here we can find the code we should use for anonymizing IP https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization
gtag('config', '<GA_TRACKING_ID>', { 'anonymize_ip': true });
Where should I place it? If I place it right after the code (before ending /script tag or inside separate script) using Tag Assistant Chrome extension I can see the error
Invalid call to gtag(), the Global site snippet is not installed
How to properly insert the code and where?
Google Tag Manager doesn't process or store IPs. It is the Google Analytics tag inside of Google Tag Manager that you need to configure to anonymize IPs.
Go to GTM & edit your Google Analytics Tag(s) or Google Analytics Settings Variable:
More Settings > Fields to SetanonymizeIptrueIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With