1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How Do I Track Click Through A Meta Redirect?

Discussion in 'Black Hat SEO' started by blackxxxer, Jan 3, 2009.

  1. blackxxxer

    blackxxxer BANNED BANNED

    Joined:
    Oct 29, 2008
    Messages:
    137
    Likes Received:
    57
    Does anyone know how to track clicks & referral through a page with a meta redirect? Can this be done through Google Analytics or would you recommend something different?

    Thanks:D
     
  2. zone69

    zone69 Junior Member

    Joined:
    Nov 24, 2008
    Messages:
    196
    Likes Received:
    1,291
    I usually just write it to a log file prior to refreshing using PHP. Here is a sample of how to do it. This will give you a log with DATE,REFERRER,IP.
    Code:
    <?php
    $myLogFile = "./log/mylogfilename.txt";
    $refData = $_SERVER['HTTP_REFERER'];
    $ipaddr = $_SERVER['REMOTE_ADDR'];
    $fh = fopen($myLogFile, 'a') or die("can't open log file");
    $stringData = date("c").",".$refData.",".$ipaddr."\n";
    fwrite($fh, $stringData );
    fclose($fh);
    ?>
    
    You can PM me if you need any help with this.

    Hope that helps!
     
  3. xhpdx

    xhpdx Regular Member

    Joined:
    Sep 21, 2008
    Messages:
    331
    Likes Received:
    2,161
    Occupation:
    Coder
    Location:
    EU
    you can also try this:

    PHP:
    <?php
        $ip 
    $_SERVER['REMOTE_ADDR']; //Get the ip address.
        
    $agent $_SERVER['HTTP_USER_AGENT']; //Get the user agent.
        
    $ref $_SERVER['HTTP_REFERER']; // Referer information.
        
    $date date("H:i dS F"); //Get the date and time.
        
    $file "log.htm"//Where the log will be saved.
        
    $open fopen($file"a+"); //open the file, (log.htm).    
        
    fwrite($open"<b>IP Address:</b> " .$ip "<br/>"); //print / write the ip address.
        
    fwrite($open"<b>Referer:</b>"$ref "<br/>"); //print / write the referer.
        
    fwrite($open"<b>UserAgent:</b>"$agent"<br/>"); //print / write thier useragent.
        
    fwrite($open"<b>Date & Time:</b>"$date"<br/>"); //print / write the date and time they viewed the log.
      
    fclose($open); // you must ALWAYS close the opened file once you have finished.
    ?>
    it will log IP of user, useragent (IE,FF,etc), referer, date and time.
    it will be written to log.htm which is easy readable by your browser.

    the code is placed above the meta refresh
     
  4. zone69

    zone69 Junior Member

    Joined:
    Nov 24, 2008
    Messages:
    196
    Likes Received:
    1,291
    That'll work as well. My recommendation would be to protect the .htm file above or the .txt file in my code earlier with a .htaccess file so not everyone can view it, unless you don't mind sharing your stats with the world.

    I usually create a "logs" directory and send all stats I gather to this directory, then simply protect that directory with a password.