I have noticed that a little problem in StatTraq gives some trouble to my plugins using it. The problem is that when you use a permalink structure where the post id is not included, such as this one :
/%year%/%monthnum%/%day%/%postname%/
The post id is not added to the statTraq table in the 'article_id' field. This causes the 'page views' StatTraq report to show only 'Mixed' page views, not the actual posts viewed by your visitors. It also confuses the hell out of my Popular posts plugin, forcing me to use mad hacks to have it report the correct thing... The solution is in fact quite simple.
The Solution (I hope)
In the stattraq.php file, there are the following lines (25 and 26)
if (($p != '')){
$p = intval($p);
But the $p variable only exists if the posts has been selected by id. If it has been selected by name, $p is null.
The variable that is passed in all cases (as far as I know) is $post, which is an object containg the posts data. So I changed the lines above for those :
if (($post->ID != '')){
$p = intval($post->ID);
And that seems to do the trick for all rewrite setups.

5 comments about 'A note to users of StatTraq extensions'
Get the comments feed for this entry or post a trackback from your own blog
est-ce qu'un simple "global $id" pour ensuite utiliser $id dans stattraq ne suffirait pas ? $id est toujours connu (c'est en gros le $_GET['p'], renseigné même avec une structure de permalien comme décrite ici)
Oui, c'est vrai, ça marcherait aussi, et c'est peut être plus simple mettre en oeuvre.
I have instituted the StatTraq extensions for user using Permalinks (Me). I was wondering if you have ever modded STatTraq or any other tool so that it will display the post names and number of hits. I have used you Popular Post plugin - but I figured you might have also hacked the backend so that when you open StatTech it actually show pages and hits rather than the default "multiple posts".
Any help you might offer would be greatly appreciated,
hello ! I think the correct way is with if (is_single() && $post->ID!='') because of when you load a category, the last $post printed is the $post that stattraq gets.
plugin works great! one question: how can i get rid of the blank entries that the query lists? none of my posts have blank titles (nor does wp allow without creating its own slug for you) check it out:
http://whiffer.net/top-10/
any suggestions would be appreciated.