Hi All,

After a search in Google and in this forum, and being swamped with options.. I'd like to hear from you.. What do you use to generate website statistics.. Your own script / a specific script? Which scripts would you suggest to use?

I'd like to track visits to each page, by unique visitors, and have an idea of screen settings, platform, etcetc.

Any suggestions?

J.

    Hi Jimson,

    Yes. I have read quite a bit of sites. I would just like to hear from people of whom I know more or less the knowledge they <seem> to have of PhP, instead of some unknown reviewers etcetc.

    But it looks like people are not interested in commenting on this topic..
    I have started building my own, which does exactly what I want.

    Thanks though,

    J.

      if($YouUseStatistics) read please - advice.me

      maybe this phrase will fail in advertisement...

      🙂

        What do you use to generate website statistics.. Your own script / a specific script? Which scripts would you suggest to use?

        I use my own. Basically I've just been logging ip addresses. To estimate unique hits for a given 24 hr period I don't log the IP if it has visited that day. Heres the code ....

        $ip = $_SERVER['REMOTE_ADDR'];
        $query = "select * from ipaddress where _ip='$ip' and date='$todaysdate' ";
        $result = mysql_query($query);
        $numrows = mysql_num_rows($result);
        
        if ($numrows < 1 )
        {
        	$query = "insert into ipaddress values (NULL, '$ip', '$todaysdate', '$other_info')";
        	mysql_query($query);
        }
        

        Pretty simple. So now I have this big ass table of IP addresses on my server. Its sorta slow but with this info I can see if a given ip is a repeat visitor or not. Im sure theres much more elegant ways of doing it but thats what i slapped together.

          The best way to do the same thing as above is to just use your server log. An apache log can be parsed using a file like this, to do the exact same thing:

          <form enctype="multipart/form-data" method="post" action="<?php echo($_SERVER["PHP_SELF"]); ?>">
          <input type="file" name="log">
          <input type="submit" name="submit">
          </form>
          <?php
          $iparray = array();
          if (isset($_POST["submit"])) {
            $fp = fopen($_FILES["log"]["tmp_name"],"rb");
            $content = fread($fp,filesize($_FILES["log"]["tmp_name"]));
            fclose($fp);
            $contentarray = split("\n",$content);
            for ($i=0;$i<count($contentarray);$i++) {
              $linearray = split(" ",$contentarray[$i]);
              $ip = $linearray[0];
              if (!in_array($ip,$iparray)) {
                $iparray[] = $ip;
              }
            }
            for ($i=0;$i<count($iparray);$i++) {
              echo($iparray[$i]."<br>\n");
            }
            echo("A total of ".count($iparray)." unique hits to your page.");
          }
          ?>

          You upload your log file to it and it tells you all the unique IPs. At the bottom of the page, it tells you how many unique hits you had. If you have a crapload of hits (several million or so) in your log, it will probably max out PHP. BTW, this is verrrry slow, as it goes through every line of the file.

          This is what I use, if I ever want to know how many unique hits I got that day.
          A word to the wise: make sure you only use a log-file for one day! It doesn't check the date.

            Sorry Leatherback- I'm always interested in commenting on something 🙂 Except for when I have nothing productive to add to the conversation.

            I use whatever our webhosts give us- before it was just raw access logs, so I would use analog/report magic to analyze the stats. But now they have some slick stats program that gives me what I need. Much less of a hassle, but I don't really have control over what info is gathered... lucky for me they pretty much gather everything and give it to me all neatly tied with a bow.

            Good luck in your program!
            -Elizabeth

              16 days later

              i just found out about PPhlogger..
              that's what i'm using now and it seems to work nicely. anyone use this?

                Write a Reply...