Quantcast
Channel: Piwik Forums - Support & Bugs
Viewing all articles
Browse latest Browse all 13117

Re: How to get referer through image tracking

$
0
0
After reading through Stephan Miller's Piwik Web Analytics Essentials, it seems there are three categories of non javascript tracking: Simple Image Tracking, Advanced Image tracking, and PHP Tracking API. From what I can see, it is possible to get the referer using advanced image tracking. However, his book says the parameter is "url_ref" not "urlref", and that "you will have to use PHP to set this value. In PHP this value
is accessible with $_SERVER['HTTP_REFERRER']." Changing "&" to "&", my best guess is now:

<?php
if (preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) {
//do not fire tracker  
}
else {?>
<!-- Piwik Image Tracker -->
<img src="http://example.com/piwik/piwik.php?idsite=1&amp;rec=1&amp;action_name=example.com&amp;url_ref=$_SERVER['HTTP_REFERER']" style="border:0" alt="" />
<!-- End Piwik Image Tracker -->
<?php }?>

Viewing all articles
Browse latest Browse all 13117

Trending Articles