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

How to get referer through image tracking (no replies)

$
0
0
Hello, I'm new to Piwik and PHP but have managed to get everything working except for passing through the referer url when a visitor goes to my website.

I have read the documentation at https://piwik.org/docs/tracking-api/ and have done many google searches. Despite this, I have not found an explicit example of what I'm trying to accomplish. My best guess is

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

I prefer to do this without using the "tracking API" as mentioned in the documentation and just stick with the simpler Image based tracking. Thanks for any help.

Viewing all articles
Browse latest Browse all 4243

Trending Articles