Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Jan 2012
    Posts
    12
    Plugin Contributions
    0

    Default Google Analytics Question

    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****

    PHP Code:
    <?php
    $ip_address 
    $ip=$_SERVER['REMOTE_ADDR'];

             if (
    $ip_address != '127.0.0.1')
                include (
    'googleanalytics.php');
            
    ?>
    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?

    Or

    Would it be more effective if I used
    PHP Code:
    <?php
    $ip_address 
    $ip=$_SERVER['REMOTE_ADDR'];

             if(
    $ip_address '127.0.0.1'
                break;
              else 
                include (
    'googleanalytics.php');
                            

    ?>
    Thanks for any help on this matter, as I am still new to PHP and it's logic.
    Last edited by israelimports; 16 Feb 2012 at 11:03 AM.

 

 

Similar Threads

  1. Google Analytics Question
    By Clan57 in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 14 Oct 2011, 07:17 PM
  2. Google analytics question
    By spleify in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 2 Jun 2011, 10:47 PM
  3. Question about Google Analytics
    By Kryspen in forum General Questions
    Replies: 0
    Last Post: 6 May 2010, 01:06 PM
  4. google analytics question?
    By ian healy in forum General Questions
    Replies: 1
    Last Post: 13 Mar 2009, 11:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg