So I have a download script that I want to track who downloads, and it goes something like this:
// Download stuff
// ...
// Piwik
ob_start();
$pageTitle = '{Download "' . $filename .'"}';
if ( $hotlinked )
{
$pageTitle = 'HOTLINKED -> ' . $pageTitle;
}
$piwikId = /* ... */;
require_once( 'PiwikTracker.php' );
PiwikTracker::$URL = "__________";
$piwik = new PiwikTracker( $piwikId );
$response = $piwik->doTrackPageView( $pageTitle );
ob_end_clean();
However, if I understand correctly this creates a new HTTP request (which has become a problem recently). Since the stats and the download script are on the same server, I figure this can be done better. How would I go about doing this?
I would like to mention that I’m still on Piwik 1.12, since I was unsure how to when 2.0 was first released. I don’t mind upgrading if I need to.