Page 1 of 2 12 LastLast
Results 1 to 15 of 26

Thread: AXS Visitor Tracking PHP Module

  1. #1
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480

    Thumbs up AXS Visitor Tracking PHP Module

    The AXS visitor tracking software has been highly recommended by Chris and others on this forum. It comes with a default javascript module code you place on each page of your site.

    Below you will find Chris' PHP module code for AXS. Among its advantages over the javascript is the ability to track search engine spiders as they crawl your site. I find this to be a huge benefit. Note that you do loose the ability to not log your visits using this technique. Chris agreed it could be posted in the forum so here it is... enjoy:

    PHP Code:
    if ($_COOKIE['axs_no_log'] != "1") {
    $AXSLogFile '/full/path/to/log.txt';
    $AXSTimeOffsetInHours = +1;

    $AXSdomain 'http://www.yourdomain.com';
    $AXSuri $_SERVER['REQUEST_URI'];
    $AXSrad $_SERVER['REMOTE_ADDR'];
    $AXSREMOTE_HOST = @getHostByAddr($AXSrad);
    $AXSFrom $_SERVER['HTTP_REFERER'];
    $AXSTo $AXSdomain.$AXSuri;
    $AXSHTTP_USER_AGENT $_SERVER['HTTP_USER_AGENT'];

    $AXSunixtime time() + (3600*$AXSTimeOffsetInHours);
    $AXSsecond date("s", ($AXSunixtime))+0;
    $AXSminute date("i", ($AXSunixtime))+0;
    $AXShour date("G", ($AXSunixtime))+0;
    $AXSday date("j", ($AXSunixtime))+0;
    $AXSmonth date("n", ($AXSunixtime))-1;
    $AXSyear date("y", ($AXSunixtime))+100;
    $AXSwday date("w", ($AXSunixtime))+0;
    $AXSyday date("z", ($AXSunixtime))+0;

    $AXSlogline =
    "|$AXSREMOTE_HOST|$AXSrad|$AXSFrom|$AXSTo|$AXSHTTP_USER_AGENT|$AXSsecond|$AXSminute|$AXShour|$AXSday|$AXSmonth|$AXSyear|$AXSwday|$AXSyday|\n";

    $AXSfile fopen("$AXSLogFile""a");
    flock($AXSfile2);
    fwrite($AXSfile"$AXSlogline");
    flock($AXSfile3);
    fclose($AXSfile);

    *** Be sure to make the $AXSlogline = "...."; one line, and no space between the quote and the '|', I don't know why vb is doing that.



    Reference:

    http://www.websitepublisher.net/foru...=&threadid=392
    http://www.xav.com/scripts/axs/
    Last edited by GCT13; 12-13-2003 at 12:42 PM.
    ....

  2. #2
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    Use this to prevent logging yourself...
    PHP Code:
    if ($_COOKIE['axs_no_log'] != "1") {
        
    $file fopen("$LogFile""a");
        
    flock($file2);
        
    fwrite($file"$logline");
        
    flock($file3);
        
    fclose($file);


  3. #3
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    Nice one chromate. Would wrapping the whole module in the if statement save server resources?
    ....

  4. #4
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    Yep. It was just easier to paste that Really you should have the whole thing as a function and then use the if statement to call the function if the cookie is not set to 1. Like:

    PHP Code:
    if ($_COOKIE['axs_no_log'] != "1"logVisit(); 
    where logVisit() is the function containing the logging code.

  5. #5
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    Even better.

    ....

  6. #6
    Senior Member
    Join Date
    Jul 2003
    Posts
    774
    so what do u actually do with this ? lol im a bit confused i manage to install axs and im using the javascript

    im looking at the stats page and does hits refer to pageviews ?

    There were 9 total hits analyzed. Of these, 9 were relevant, and they resulted in 1 lines in the table. No string matching was done against the access log. The log was not filtered by date.

    Last edited by s2kinteg916; 12-11-2003 at 08:43 PM.

  7. #7
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    Yes, pageviews (and hits from crawlers if you use the PHP module).

    http://www.websitepublisher.net/foru...=&threadid=392
    ....

  8. #8
    Senior Member
    Join Date
    Jul 2003
    Posts
    774
    well right now i have awstats installed as well... what benefit would i get from installing the php module ? In awstats it tells me how many hits i get from spiders...

    Im also looking at my stats for axs and i click on the checkbox
    Hits by Day of the Week
    it shows Friday 80.08% 1692
    so does that mean 1692 pageviews ? without counting any googlebot spiders ? or does that count hits from bots as well...

    sorry im a bit confused...

  9. #9
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    You'll be able to log crawlers if you use the php module, that is its main benefit.

    With AXS you can get more precision of search engine referrarals info compared to awstats. You can see exactly what search terms where used in what search engine to get to whatever page on your site. In awstats, that info is not as precise, the search engine chart is separated from the keyword chart so you don't know which terms were used with what engine.

    Awstats does show crawler hits, but without listing the actual pages hit. In axs you can see which pages were hit when, by what crawler. Right now I'm watching Googlebot index one of my sites, it's kinda fun because I've never seen that before.

    it shows Friday 80.08% 1692
    This is pageviews. If you were using the php module it would also include crawler hits.
    ....

  10. #10
    Senior Member
    Join Date
    Jul 2003
    Posts
    774
    so with the module installed will it show pageviews and crawler hits seperately ? or all together ?

    also how do i implement this ? i see the code there but i dont know what to do with it lol

  11. #11
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    With the PHP mod installed it AXS will show the total number of page views. This will include "views" from GoogleBot etc.

    As far as how to install it... You know the javascript code that comes with AXS that you put at the top of each of the pages you want to monitor? Just replace that javascript with the PHP code.

  12. #12
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    Originally posted by s2kinteg916
    so with the module installed will it show pageviews and crawler hits seperately ? or all together ?
    In the "Web Browser Type and Version" chart it will display crawlers separately. In the "Day of Year", "Day of Week" charts it will add the hits together and show them all together.


    Originally posted by s2kinteg916
    also how do i implement this ? i see the code there but i dont know what to do with it lol
    Go to the first post of this thread and copy that script into its own php file: aws.php. Make sure to read the instructions in that post.

    Next, replace the javascript with the php module by including it in each page:
    PHP Code:
    include("/your/path/to/file/axs.php"
    ....

  13. #13
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    Hmmm.... I've just tried this but I get a parse error saying that it's expecting ']" somewhere along the top line of the code you posted.

    Anyone know whats wrong?

    Thanks,
    Mike
    Don't you just love free internet games ?

  14. #14
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    What line do you get the error?

    Did you see the note about the line that starts-
    "$AXSlogline = ..." That line should be contained on one line.
    ....

  15. #15
    Junior Registered
    Join Date
    Aug 2005
    Posts
    9
    Hi all,

    I've been using the AX logging package for years, and really like what it does.

    But I'd like to be able to use the PHP module. I tried installing this on an Invision Power Board site of mine and it seems to cause a bunch of gobbeldygoop to appear. Somehow the include is messing up javascript or something (that I think causes a popup to jump if you've got a private message, but I'm not entirely sure)

    When I include the standard javascript code, it works fine, but when I do the include statement

    include("/home/mydomainname/htdocs/axs.php")

    it causes a bunch of code to appear at the top of the page.

    Anyone have an idea what I could do to make it work?

    Thanks in advance,

    Juli

Similar Threads

  1. Review: Professional PHP Programming
    By Chris in forum Books
    Replies: 6
    Last Post: 07-17-2013, 05:26 AM
  2. Learning how to create PHP database driven sites online...
    By incka in forum Website Programming & Databases
    Replies: 15
    Last Post: 01-23-2004, 03:18 PM
  3. How do I make my PHP thing list in name order?
    By incka in forum Website Programming & Databases
    Replies: 8
    Last Post: 12-11-2003, 07:18 AM
  4. PHP, ODBC, and Unicode compatibilities...
    By Stevens in forum Website Programming & Databases
    Replies: 4
    Last Post: 10-14-2003, 09:27 AM
  5. PHP Include
    By Mike in forum Website Programming & Databases
    Replies: 4
    Last Post: 05-29-2003, 08:19 AM

Bookmarks

Posting Permissions

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