Reputation: 861
I am using GTM in my Angular 4 app and it works fine, expect for one issue. I want to anonymize user IP, the piece of code I found says to add this to your code
ga('create', 'UA-********-1', '*****.com');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
However GTM provided me with the following code which doesn't have that bit, plus as I use angular as it is a SPA ga('send', 'pageview');
isn't useful. How can I anonymizeIP in the following code?
<!-- Google Tag Manager -->
<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-xxxxxx');</script>
<!-- End Google Tag Manager -->
Upvotes: 0
Views: 2607
Reputation: 4897
Sign in to GTM, edit your universal analytics tag and find "fields to set", you can set it there.
Upvotes: 1