June 23, 2005

StatTraq plugin

Status: Upgraded to StatTraq for WordPress 2.x
Version: 1.0b

Randy at Stattraq has created a WordPress plugin I am constantly using. I like the fact that I can quickly see how many people are visiting my blog, what pages they are going to, and who is sending them to those pages. It not only shows what search terms are used to locate things on your blog - but also the ‘Search Engine Saturation’ ie how many of your pages have been indexed by Google, Yahoo, and MSN. Besides this you can display these statistics on your sidebar and as seen below I have even added some other statistical views.

StatTraq tracks activity of WordPress and reports:

  • Hit Counter
  • User Counter
  • Page Views
  • Browser
  • Referrer
  • Search Terms
  • Search Engine Saturation
  • IP addresses

StatTraq screen shots

Mods

Turbocharging StatTraq

Richard at Boakes.com gives an interesting idea that is supposed to speed up your stattraq database manipulation by 90%!

Open up /plugins/stattraq.php and edit line somewhere around line 52.
Where it reads: INSERT INTO
Edit it to read: INSERT DELAYED INTO

The discovery I stumbled upon, the source of the massive speedup, is that I�ve added the keyword �DELAYED� to the statement that inserts the log entry into the statistics table. This instructs the database that the stats program does not care about waiting to know that the log was definitely, entirely, and completely written. Instead the Database immediately returns a happy message so the web server can get on with generating and sending the page.

One word, 90%+ speed increase. If only every thing could be so positive we�d have a cure for the common cold by bedtime.

StatTraq Patch for WP 1.5

Adsworth has put together a couple of StatTraq patches to make StatTraq compatible with WP 1.5 permalinks

Different Counters by Gary Paulson

Instead of having just counts starting over each month, day, and hour I added a couple of new case statements to the getVisitorCount function in stattraq.php. The new options will show the number of visitors in the last 30 days, the last 7 days, the last 24 hours, and the last hour. The case statements need to be added right above the final default case statement.

case '30d':
$startDate = date(Ymd, time() - (60 * 60 * 24 * 30)) . ” ” . date(His);
$endDate = date(Ymd) . ” ” . date(His);
break;
case ‘7d’:
$startDate = date(Ymd, time() - (60 * 60 * 24 * 7)) . ” ” . date(His);
$endDate = date(Ymd) . ” ” . date(His);
break;
case ‘24h’:
$startDate = date(Ymd, time() - (60 * 60 * 24)) . ” ” . date(His);
$endDate = date(Ymd) . ” ” . date(His);
break;
case ‘1h’:
$startDate = date(Ymd, time() - (60 * 60)) . ” ” . date(His, time() - (60 * 60));
$endDate = date(Ymd) . ” ” . date(His);
break;

Whois IP

Waipaak in a StatTraq comment suggests changing the whois IP, I changed 2 lines in stattraq so as to use whois.sc instead of Arin which reports vague and often wrong info.

Check for example this two records:

http://ws.arin.net/cgi-bin/whois.pl?queryinput=218.13.215.124
vs.
http://whois.sc/218.13.215.124

Search all the StatTraq files for �arin�, then change:

http://ws.arin.net/cgi-bin/whois.pl?queryinput=
into
http://whois.sc/
( files: access_detail.php, session.php, and ip_address.php)

Usage

Added lines to sidebar:

<li>Visitors Month: <?php echo getVisitorCount('month'); ?></li>
<li>Visitors Today: <?php echo getVisitorCount(’day’); ?></li>’

Navigation:

7 Comments »

  1. 1

    When you installed the adsworth patch, did you run the patch, or install over the files? I just want to get rid of the problem with permalinks, and am very nervous about messing with php, and killing my database as I don’t have full control over it.

    Any help with this would be greatly appriciated. I’m a total wordpress noob.

    Thanks in advance.

    Cool live comment preview BTW - a nice touch.

    Comment by Vince Anido — June 29, 2005 @ 9:41 pm


  2. 2

    hehe ,i am using the last version of stattraq,but i have found that the “counter number” in the sidebar is different from the “user hit” in the /wp-srattraq/index.php,so i want the sidebar shows the “user hit” in the sidebar! what can i do for it?
    so sorry that my spelling english is not so good!i come from chinese.

    Comment by hansen — July 12, 2005 @ 10:37 pm


  3. 3

    I really am not sure how to modify it to show ‘hits’ rather than distinct users. I thought about trying to change mine when I was modifying it but decided that I didn’t want to count someone 12 times because they looked at 12 pages.

    Comment by Gary Paulson — July 13, 2005 @ 6:47 am


  4. 4

    oh ,i have limited knowledge to do this,i just have a idea so i want to realize it!it’s a way of study!

    Comment by hansen — July 14, 2005 @ 3:11 am


  5. 5

    I have trouble adding the usage lines in the sidebar, but it’s not working. The lines return 0. What could be wrong?

    Comment by Poromenos — December 13, 2005 @ 5:09 am


  6. 6

    I ended up removing all but the Visitor Stat because after a database corruption that was fixed my stats were also showing as 0 - and I am not up to speed enough on MySQL databases and php code to figure out what happened.
    Plus the stats were always being thrown off by Spam referrers who amazingly were hitting this very page because they were looking for “StatTraq” to publish them as referrer stats.

    Comment by Gary Paulson — December 13, 2005 @ 1:21 pm


  7. 7

    […] d several hacks that others have found - you can find a decent compilation of some of them here. The ones I’ve used so far are the MySQL speed tweak and the Who […]

    Pingback by WordPress Counter Plugins at The Geek Blog — December 13, 2005 @ 7:15 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment



Powered by WordPress
Copyright by Gary Paulson

Bad Behavior has blocked 2039 access attempts in the last 7 days.