Piwik PhP Tracking mulfunction?


#1

Hello, i have a few php scripts which i currently using them to redirect users.
But since 2 days ago, for some reason piwik has stoped showing me the http referers so i cant see for some reason from what sites my users gets redirected.
The code im using in the redirection script that i track users, is the bellow one:


<?php
if (getenv(HTTP_X_FORWARDED_FOR)) {
$pipaddress = getenv(HTTP_X_FORWARDED_FOR);
$ipaddress = getenv(REMOTE_ADDR);
 } else {
  $ipaddress = getenv(REMOTE_ADDR); //im using this cause i use the nginx geoip library.
 }
require_once('PiwikTracker.php');
PiwikTracker::$URL = 'http://mymainsite.com/analytics/';
$piwikTracker = new PiwikTracker($idSite = 2);  /* The Site ID also found in your tracking code */
$piwikTracker->setTokenAuth( 'blabla' );  /* The token_auth found on the API page of your CP - required to get users IP */
$piwikTracker->setVisitorId($piwikTracker->getVisitorId());  /* You need to add this so the user id isn't lost and thier tracking starts over */
$piwikTracker->setUrlReferrer($_SERVER['HTTP_REFERER']);
$piwikTracker->setBrowserLanguage($_SERVER['HTTP_ACCEPT_LANGUAGE']);
$piwikTracker->setUserAgent($_SERVER['HTTP_USER_AGENT']);
$piwikTracker->setIp($ipaddress);  /* Log visitor IP if you like */
$piwikTracker->setUrl($url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );  /* Set the current URL */
$piwikTracker->doTrackPageView( $_GET['id'] );  /* Log the Visit */

header('Location: http://www.example.com');
exit();
?>