} $tracker = new GoogleAnalytics\Tracker('UA-28342846-1', 'download.osmand.net'); $visitor = new GoogleAnalytics\Visitor(); $visitor->setIpAddress($_SERVER['REMOTE_ADDR']); $visitor->setUserAgent($_SERVER['HTTP_USER_AGENT']); $visitor->setScreenResolution('1024x768'); // Assemble Session information // (could also get unserialized from PHP session) $session = new GoogleAnalytics\Session(); // Assemble Page information $page = new GoogleAnalytics\Page('/download.php?' . $file); $page->setTitle('Download file ' . $file); // Track page view $tracker->trackPageview($page, $session, $visitor); $event = new GoogleAnalytics\Event($app, 'App', $file, $eventno); $tracker->trackEvent($event, $session, $visitor); } set_time_limit(0); $xml = simplexml_load_file("indexes.xml"); $res = $xml->xpath('//region[@name="' . $file . '"]'); if (count($res) > 0) { $node = $res[0]; if (isset($_GET['road'])) { downloadFile('road-indexes/' . $file); } else { if ($node["local"]) { downloadFile('indexes/' . $file); } else { header('HTTP/1.1 302 Found'); header('Location: http://osmand.googlecode.com/files/' . $file); }
function leechgate_track_ga($config) { try { // prepare GA structures $tracker = new GoogleAnalytics\Tracker($config['gaid'], $config['normalized_host']); $visitor = new GoogleAnalytics\Visitor(); $visitor->fromServerVar($_SERVER); if ($config['utma_cookie']) { $visitor->fromUtma($config['utma_cookie']); } $session = new GoogleAnalytics\Session(); $event = new GoogleAnalytics\Event($config['normalized_host'], $config['product'], $config['product_version']); $event->setNoninteraction(true); // track it! $tracker->trackEvent($event, $session, $visitor); } catch (Exception $e) { $fe = fopen('php://stderr', 'w'); fwrite($fe, "Caught exception in leechgate_track_ga: " . $e->getMessage() . "\n"); fclose($fe); } }