Improvements for Stattraq plugin.

Posted on Thursday the 29th of March, 2007 at 3:06 pm in WordPress

Ever since I originally started using Stattraq a few things bothered me about the way it worked. Here are the fixes to a few of them.

Include pages with posts in your stats.

  1. Open stattraq.php
  2. Find:
    global $doing_rss, $p
    Replace With:
    global $doing_rss, $p, $page_id, $pagename,
  3. Find:
    1. if (($p != '')){
    2. $p = intval($p);
    3. $article_id = $p;
    4. }

    Replace with:

    1. if (($p != '')){
    2. $p = intval($p);
    3. $article_id = $p;
    4. }elseif (($page_id != '')){
    5. $page_id = intval($page_id);
    6. $article_id = $page_id;
    7. }elseif (($pagename != '')){
    8. $reqpage = get_page_by_path($pagename);
    9. if ( !empty($reqpage) )
    10. $article_id = $reqpage->ID;
    11. }
    12. Use the following to copy and paste the code.

To add a list of all Pages that link to your site grouped by Website (excluding Google):
Open “wp-stattraq/reporter/summary.php”

Find:

  1. <?php echo PrintTimestamp();?>
  2. </div>
  3. <div id="queryTerms">

Before Add:

  1. <table id="referrersTable">
  2. <thead>
  3. <tr>
  4. <th>#</th>
  5. <th>Referrer</th>
  6. <th>Pages</th>
  7. </tr>
  8. </thead>
  9. <tfoot>
  10. <tr>
  11. <th>#</th>
  12. <th>Referrer</th>
  13. <th>Pages</th>
  14. </tr>
  15. </tfoot>
  16. <tbody>
  17. <?php
  18. if($results){
  19. $i=0;
  20. foreach($results as $row){
  21. preg_match('/(http.*?\:\/\/.*?)(\/.*)/', htmlentities($row->ref), $matches);
  22. $ref_array[$matches[1]][] = $matches[2];
  23. }
  24. while( list($site, $pages) = @each($ref_array) ){
  25. if(strpos($site,'google') ==false && $site != ''){?>
  26. <tr class="<?php echo ($i % 2 == 0 ? 'even' : 'odd' );?>"><td><?php echo ++$i;?></td>
  27. <td>
  28. <a href="<?php echo $site;?>"><?php echo substr($site,0,50);?></a></td>
  29. <td class="right">
  30. <?php foreach($pages as $page){?>
  31. <a href="<?php echo $site.$page;?>"><?php echo substr($page,0,50);?></a><br/>
  32. <?php}?>
  33. </td>
  34. </tr>
  35. <?php }
  36. }
  37. }?>
  38. </tbody>
  39. </table>
  40. Use the following to copy and paste the code.

Related posts


Leave a reply

:) :D :( :o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: ;) :!: :?: :idea: :arrow: :| :mrgreen: