Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Ip Anonymization Google Analytics – How to insert code

Home / Forums / Virtue Theme / Ip Anonymization Google Analytics – How to insert code

This topic is: Not Resolved
[Not Resolved]
Posted in: Virtue Theme
August 23, 2016 at 12:58 pm

Hello,

I have to anonymize visitors IP address. I know how to do it with Google Analytics code, just inserting this “ga(‘set’, ‘anonymizeIp’, true);” in the snippet.

I need to past the entire code into the theme, so I guess unfortunately I cannot use the dedicated field Google Analytics Tracking ID (appearance – advanced setting).

So, I guess I should paste the entire GA code into the header.php. Now, my header.php looks like this:

<?php
/*
Empty on purpose.

– Force plugins to stop stating incorrect errors –
wp_head();

*/
?>

<script>
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’

ga(‘create’, ‘UA-XXXXXX’, ‘auto’);
ga(‘set’, ‘anonymizeIp’, true);
ga(‘send’, ‘pageview’);

</script>

</head>

Is this location OK? Should I change something in this editor?

Thanks a lot

Enrico

  • The forum ‘Virtue Theme’ is closed to new topics and replies.