ajaxStats
What
ajaxStats is a program I originally created for theANTI that allowed me to see who was browsing my site in real-time. After 3 months of tinkering I began to think I had a worthwhile program and began rewriting it so it could be ported to other sites quickly and painlessly. The ajaxStats you can download here is a stripped down version of something much bigger, but I'm dying to get feedback from the community on what people think of this little app, so I'd like to release something.Why
I've played with a ton of different statistics programs over the past 3 years. It wasn't until recently, after being inspired by things like syndication, digg spy, and google alerts, that I realized none of the stats programs give me the ability to see what's happening on my site right now. This application started as one of those "there's gotta be a way" conversations, and piece by piece turned into what it is now.Features
- Real Time view of traffic on your site - watch users come and go on your site live. This will give you a real understanding of how visitors browse your site. We've all seen the percentage of users that come and leave within the first 30 seconds, but to actually watch it happen all day long makes it really hit home.
- Referer stats
- Browser stats
- Operating Systems stats
- Country stats
- City, State stats for US visitors
- Search Engine stats - When a user comes in from a search engine, all the data you need is stored in the referering URL. The "Location" field is used to show you exactly which page the search term was found on. This feature isn't found in other stats programs that I've seen ( please show me if you know of one ).
- Free - Download the code, let me know what you think. If you really like it buy a shirt.
What it is not
Currently, the app does not store data for later analysis ( march vs. april / 2005 vs. 2006 ). That type of analysis is better left to the applications that have been around for years ( I recommend hitslink for its thoroughness or google analytics for its site overlay tools ). There are plans to develop something to this effect in the future, but for now the app is only as good as its life in the browser.How does it work
The app uses php, mysql, xml and ajax to communicate between the server and your browser, running the app. I've put together a quick demo for you to look at that updates every 45 seconds ( for overload concerns ) and allows for up to 50 users ( we're on a shared hosting server... ). You should be able to see yourself on that list. If you download the app and get it running on your own site, you can set the update interval to a smaller window, where you'll be able to see users move around. Follow this link to see what this little app can do.Installing
Download the code hereThis is contents of the INSTALL file, included within the download:
- INSTALLING --------------------------------------------------------------
Step 1.
Create 'ajaxStats' table:
Create table ajaxStats (
`sess_id` varchar(100) NOT NULL default '',
`referer` text,
`landing_page` text,
`ip` varchar(15) NOT NULL default '',
`sess_startTime` int(11) NOT NULL default '0',
`sess_lastAccess` int(11) NOT NULL default '0',
`pageTrail` text NOT NULL,
`currentPage` text NOT NULL,
`browser` text NOT NULL,
`os` varchar(32),
PRIMARY KEY (`sess_id`) );
Step 2.
Create the directory structure by unzipping the ajaxStats.tar.gz file and
placing it inside of the root level of your site,
This will create the following tree:

Step 3.
Setup the database connection script to connect to your database.
Edit ajaxStats/includes/globals.php to reflect your
username, password, database_name set.
Step 4.
Place these two lines on all files you wish to be tracked:
<script type='text/javascript' src='ajaxStats/includes/js/ajax.js'></script>
<script type='text/javascript' src='ajaxStats/sessions/stats.js'></script>
Thats all.
NOTES
The viewer is located at http://www.yoursitename.com/ajaxStats/viewer/ This will show you all the users on your site right now, and update at the interval set inside of ~/www/ajaxStats/viewer/js/users.js ( var interval = 15000; 15 seconds is the default ).Whenever a new user enters your site, the title of the viewer page will contain + [thenumberofusers] +. This is just a visual que to signal to you that there is some activity on your site.
The version I'm releasing to the public is the base code of ajaxStats. There are a ton of customizations you can add to the program, for instance I have a paypal notification on antidesigns.com that tracks whenever a user adds an item to the shopping cart. That way I can track where my paying customers are coming from and determine where shopping cart abandonment is occurring ( and someday why ).
The 'location' field of the search phrases data set is the page level the term came up under. So any phrase coming up as a 1 is a term that was found on the first page of search results for the given engine.