Commit 26affcdd authored by Patrick Barroca's avatar Patrick Barroca 😠
Browse files

fix api compatibility

parent 8f6cfc60
......@@ -24,9 +24,9 @@ class Class_WebService_Analytics_GoogleTracker extends Class_WebService_Analyti
public function __construct($config) {
require_once('php-ga-1.1.1/src/autoload.php');
$this->_tracker = new UnitedPrototype\GoogleAnalytics\Tracker($config->getTrackerid(),
$config->getDomainName(),
new UnitedPrototype\GoogleAnalytics\Config(['fireAndForget' => true]));
$this->_tracker = new UnitedPrototype\GoogleAnalytics\Tracker($config->getTrackerid(),
$config->getDomainName(),
new UnitedPrototype\GoogleAnalytics\Config(['fireAndForget' => true]));
}
......@@ -41,13 +41,12 @@ class Class_WebService_Analytics_GoogleTracker extends Class_WebService_Analyti
public function trackEvent($category, $action, $label, $value) {
$event = new UnitedPrototype\GoogleAnalytics\Event($category, $action, $label, $value, true);
$event = new UnitedPrototype\GoogleAnalytics\Event($category, $action, $label, $value, true);
$visitor = $this->_getOrCreateVisitor();
$this->_tracker->trackEvent($event, new UnitedPrototype\GoogleAnalytics\Session(), $visitor);
$this->_tracker->trackEvent($event, new UnitedPrototype\GoogleAnalytics\Session(), $visitor);
}
protected function _getOrCreateVisitor() {
// cf: https://code.google.com/p/php-ga/issues/detail?id=18
$session = new Zend_Session_Namespace('analyticsClient');
......@@ -55,7 +54,7 @@ class Class_WebService_Analytics_GoogleTracker extends Class_WebService_Analyti
// Assemble Visitor information
// (could also get unserialized from database)
if( !isset($session->uniqueID) || !isset($session->visitor) ) {
$visitor = new UnitedPrototype\GoogleAnalytics\Visitor();
$visitor = new UnitedPrototype\GoogleAnalytics\Visitor();
} else {
$visitor = unserialize($session->visitor);
}
......@@ -73,7 +72,4 @@ class Class_WebService_Analytics_GoogleTracker extends Class_WebService_Analyti
$session->visitor = serialize($visitor);
return $visitor;
}
}
?>
\ No newline at end of file
......@@ -26,8 +26,5 @@ class Class_WebService_Analytics_NullTracker {
public function getDomainName() {return '';}
public function trackEvent($event,$session, $visitor) {
}
public function trackEvent($category, $action, $label, $value) {}
}
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment