Presence
Presence

Reputation: 135

How to setup gtag anonymize_ip? Am I doing it wrong?

So reading by reading this little page, first I thought, I just have to add the following line to my gtag script and everything gonna be just fine:

gtag('config', '<GA_TRACKING_ID>', { 'anonymize_ip': true });

But today I realized that, maybe I didn't understand it right, and what I did, it's just plain stupid. :)

gtag('config', 'UA-2180247-1');
gtag('config', '<GA_TRACKING_ID>', { 'anonymize_ip': true });

So now I don't know how should the second line look:

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

or

gtag('config', 'UA-2180247-1', { 'anonymize_ip': true });

or there shouldn't be two lines at all, just the one which already contains the anonymize_ip...

Somehow it's not self explanatory for me, because elsewhere in documentation google has examples like this:

gtag('config', 'GA_TRACKING_ID');
gtag('config', '<UA-2180247-1>');

not like this, with these brackets ('<>'). So it's just a misspelling?

Upvotes: 3

Views: 2349

Answers (1)

Presence
Presence

Reputation: 135

I guess i got my answer at the following link: https://smarter-ecommerce.com/blog/en/analytics/implement-gdpr-compliant-ip-anonymization-google-analytics/

I've tested, and i only need one extended line like this

gtag('config', 'UA-2180247-1', { 'anonymize_ip': true });

Upvotes: 9

Related Questions