Esempio n. 1
0
 /**
  * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder
  */
 protected function buildParameters()
 {
     $p = parent::buildParameters();
     $p->utmp = $this->page->getPath();
     $p->utmdt = $this->page->getTitle();
     if ($this->page->getCharset() !== null) {
         $p->utmcs = $this->page->getCharset();
     }
     if ($this->page->getReferrer() !== null) {
         $p->utmr = $this->page->getReferrer();
     }
     if ($this->page->getLoadTime() !== null) {
         // Sample sitespeed measurements
         if ($p->utmn % 100 < $this->config->getSitespeedSampleRate()) {
             $x10 = new X10();
             $x10->clearKey(self::X10_SITESPEED_PROJECT_ID);
             $x10->clearValue(self::X10_SITESPEED_PROJECT_ID);
             // Taken from ga.js code
             $key = max(min(floor($this->page->getLoadTime() / 100), 5000), 0) * 100;
             $x10->setKey(self::X10_SITESPEED_PROJECT_ID, X10::OBJECT_KEY_NUM, $key);
             $x10->setValue(self::X10_SITESPEED_PROJECT_ID, X10::VALUE_VALUE_NUM, $this->page->getLoadTime());
             $p->utme .= $x10->renderUrlString();
         }
     }
     return $p;
 }
Esempio n. 2
0
 /**
  * Track the request with Google Analytics.
  */
 public static function track()
 {
     if (self::$isLive) {
         // Initilize GA Tracker
         $tracker = new GoogleAnalytics\Tracker('UA-5596313-6', 'weloveiconfonts.com');
         // Assemble Visitor information
         $visitor = new GoogleAnalytics\Visitor();
         $visitor->setIpAddress($_SERVER['REMOTE_ADDR']);
         $visitor->setUserAgent($_SERVER['HTTP_USER_AGENT']);
         $visitor->setScreenResolution('1024x768');
         // Assemble Session information
         $session = new GoogleAnalytics\Session();
         // Assemble Page information
         $page = new GoogleAnalytics\Page($_SERVER['REQUEST_URI']);
         $page->setTitle('We Love Icon Fonts');
         // Track page view
         $tracker->trackPageview($page, $session, $visitor);
     }
 }
Esempio n. 3
0
function ga_init($a)
{
    global $post;
    //var_dump($post->post_name);
    // Initilize GA Tracker
    $tracker = new GoogleAnalytics\Tracker(_GAT_STR, 'www.fixtures.ie');
    // Assemble Visitor information
    // (could also get unserialized from database)
    $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('/' . $post->post_name);
    $page->setTitle($post->post_title);
    // Track page view
    $tracker->trackPageview($page, $session, $visitor);
}
Esempio n. 4
0
 /**
  * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder
  */
 protected function buildParameters()
 {
     $p = parent::buildParameters();
     $p->utmp = $this->page->getPath();
     $p->utmdt = $this->page->getTitle();
     if ($this->page->getCharset() !== null) {
         $p->utmcs = $this->page->getCharset();
     }
     if ($this->page->getReferrer() !== null) {
         $p->utmr = $this->page->getReferrer();
     }
     return $p;
 }
Esempio n. 5
0
    }
    if (isset($_GET['osmandver'])) {
        $app = $_GET['osmandver'];
    } else {
        $app = 'Download ' . $_SERVER['HTTP_USER_AGENT'];
    }
    $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"]) {
Esempio n. 6
0
        $g = hexdec(substr($hex, 2, 2));
        $b = hexdec(substr($hex, 4, 2));
    }
    $rgb = array($r, $g, $b);
    return $rgb;
}
function ellipsis($text)
{
    $max = 30;
    $append = '...';
    if (strlen($text) <= $max) {
        return $text;
    }
    $out = substr($text, 0, $max);
    return preg_replace('/\\w+$/', '', $out) . $append;
}
// Google Analytics
require_once $_SERVER['DOCUMENT_ROOT'] . '/php-ga/autoload.php';
use UnitedPrototype\GoogleAnalytics;
$tracker = new GoogleAnalytics\Tracker('UA-37973757-2', 'streambadge.com');
$visitor = new GoogleAnalytics\Visitor();
$visitor->setIpAddress($_SERVER['REMOTE_ADDR']);
$visitor->setUserAgent($_SERVER['HTTP_USER_AGENT']);
$session = new GoogleAnalytics\Session();
$page = new GoogleAnalytics\Page('/' . $service . '/badge.php?' . $_SERVER['QUERY_STRING'] . '-' . $_SERVER['HTTP_REFERER']);
$page->setTitle($service . '.tv (image badge)');
$tracker->trackPageview($page, $session, $visitor);
// Output to browser
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
Esempio n. 7
0
 /**
  * Google analytics tracker
  *
  * @static
  * @return void
  */
 public static function analytics()
 {
     $site = Site::config('general');
     $services = Site::config('services');
     // Run analytics if a tracking code is set
     if (!empty($services->googleAnalyticsId)) {
         try {
             // Initilize GA Tracker
             $tracker = new GoogleAnalytics\Tracker($services->googleAnalyticsId, $site->fqdn);
             // Gather visitor information
             $visitor = new GoogleAnalytics\Visitor();
             $visitor->setIpAddress(Request::getClientIp());
             $visitor->setUserAgent(Request::server('HTTP_USER_AGENT'));
             // Gather session information
             $session = new GoogleAnalytics\Session();
             // Gather page information
             $path = Request::path();
             $page = new GoogleAnalytics\Page($path == '/' ? $path : "/{$path}");
             $page->setTitle($site->title);
             // Track page view
             $tracker->trackPageview($page, $session, $visitor);
         } catch (GoogleAnalytics\Exception $e) {
             // Suppress this error
         }
     }
 }