Improvements for Stattraq plugin.

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:
    if (($p != '')){
    	$p = intval($p);
    	$article_id = $p;
    }

    Replace with:
    if (($p != '')){
    	$p = intval($p);
    	$article_id = $p;
    }elseif (($page_id != '')){
    	$page_id = intval($page_id);
    	$article_id = $page_id;
    }elseif (($pagename != '')){
     $reqpage = get_page_by_path($pagename);
    	if ( !empty($reqpage) )
    		$article_id = $reqpage->ID;
    }

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

Find:

<?php echo PrintTimestamp();?>
			</div>
			<div id="queryTerms">

Before Add:
<table id="referrersTable">
					<thead>
						<tr>
							<th>#</th>
							<th>Referrer</th>
							<th>Pages</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<th>#</th>
							<th>Referrer</th>
							<th>Pages</th>
						</tr>
					</tfoot>		
					<tbody>
<?php
if($results){
	$i=0;
	foreach($results as $row){
		preg_match('/(http.*?\:\/\/.*?)(\/.*)/', htmlentities($row->ref), $matches);
		$ref_array[$matches[1]][] = $matches[2];
	}

				
	while( list($site, $pages) = @each($ref_array) ){
		if(strpos($site,'google') ==false && $site != ''){?>

			<tr class="<?php echo ($i % 2 == 0 ? 'even' : 'odd' );?>"><td><?php echo ++$i;?></td>
			<td>
			<a href="<?php echo $site;?>"><?php echo substr($site,0,50);?></a></td>
			<td class="right">

		<?php foreach($pages as $page){?>

			<a href="<?php echo $site.$page;?>"><?php echo substr($page,0,50);?></a><br/>

		<?php}?>


		</td>
		</tr>
<?php 	}
	}
}?>
					</tbody>
				</table>

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>