1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)

Hide Your Analytics Tracking Code From Your IP Address

You may want to hide your Google analytics tracking code from your IP address. Why? So you can get more accurate data from the analytics program. If you track your own visits that is not giving you the full picture of your visits. Here is how you do it.

Step #1 Hide Your Analytics Tracking Code From Your IP Address *

Go to Google search and type in “What is my IP”. You will see that Google shows you your IP address.

what-is-my-ip

Step #2 For Hiding Analytics Code From Yourself *

Now you know your IP address. Open up a text editor and paste the following code into it. You have to do 2 things to this code.

  1. Replace your.ip.address with your actual IP address. Make sure that you leave the single ‘ on both sides of the ip address.
  2. Paste your analytics code over top where it says PASTE YOUR ANALYTICS CODE HERE. Again make sure you leave the single quote ‘ on both sides of the code.
<?php
add_action('wp_head', 'dont_track_my_ip');
function dont_track_my_ip() {
$myip=$_SERVER['REMOTE_ADDR'];
if($myip!='your.ip.address'){
echo 'Paste your Google Analytics code here';
}else{
echo '';
}
}
?>

Step #3 To Hide Your Google Analytics Code *

Navigate to your themes functions file. Hopefully this is a child theme. Paste the code at the bottom of your functions file before the php closing tag if you have one, “?>”. Save the file.

Step #4 Check your Browser *

Load up your google analytics in one tab and in another tab load your website. In Google analytics go to real time and see if you can see your location. You should not see yourself.

Please follow and like us:
Hide Your Analytics Tracking Code From Your IP Address was last modified: June 12th, 2017 by Maximus Mccullough

Pages: 1 2 Next

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.