Okay, so what I am trying to do is exclude my-self from being recorded by Google Analytics on my own site.
What I believe will work is as followed:
Saving the Google Tracking Code into it's own php file (googleanalytics.php) and saving it in the same dir as my html_header.php file.
Adding the following code to the bottom of html_header.php right before the </head> tag.
****127.0.0.1 is just an example of a IP address: (it's not used in the code) and is replaced with my real IP address****
Will this bypass the Tracking Code if the ip_address is equal to my_ip_address? and then continue down the script after after this check?PHP Code:<?php
$ip_address = $ip=$_SERVER['REMOTE_ADDR'];
if ($ip_address != '127.0.0.1')
include ('googleanalytics.php');
?>
Or
Would it be more effective if I used
Thanks for any help on this matter, as I am still new to PHP and it's logic.PHP Code:<?php
$ip_address = $ip=$_SERVER['REMOTE_ADDR'];
if($ip_address = '127.0.0.1')
break;
else
include ('googleanalytics.php');
?>


Reply With Quote
