dev-master
9999999-dev https://github.com/kairosagency/GoogleAnalyticsBundle.gitGoogle analytics vendor for symfony2. Warning: Deprecated!
The Requires
- php >=5.3.0
- symfony/framework-bundle >=2.1,<=2.3
by t0k4rt
by Matthiew
google-analytics php-ga
Wallogit.com
2017 © Pedro Peláez
Google analytics vendor for symfony2. Warning: Deprecated!
WARNING: Deprecated !!, (*1)
This package is directly based on this project from UnitedPrototype : http://code.google.com/p/php-ga/, (*2)
This package is aimed at using php-ga in symfony 2 as a vendor and a service., (*3)
"ga.js in PHP" - Implementation of a generic server-side Google Analytics client in PHP that implements nearly every parameter and tracking feature of the original GA Javascript client., (*4)
We love Google Analytics and want to contribute to its community with this PHP client implementation. It is intended to be used stand-alone or in addition to an existing Javascript library implementation., (*5)
It's PHP, but porting it to e.g. Ruby or Python should be easy. Building this library involved weeks of documentation reading, googling and testing - therefore its source code is thorougly well-documented., (*6)
The PHP client has nothing todo with the Data Export or Management APIs, although you can of course use them in combination., (*7)
Requires PHP 5.3 as namespaces and closures are used. Has no other dependencies and can be used independantly from any framework or whatsoever environment., (*8)
In your composer file file :, (*9)
``` js { "require": { "kairos/googleanalytics": "dev-master" } }, (*10)
**Update your composer :** ``` bash php composer.phar update kairos/googleanalytics
Composer will install the bundle to your project's vendor/kairos directory., (*11)
Enable the bundle in the AppKernel file :, (*12)
``` php <?php // app/AppKernel.php, (*13)
public function registerBundles()
{
$bundles = array(
// ...
new GoogleAnalytics\GoogleAnalyticsBundle(),
);
}
**In your parameters.yml** ``` yaml parameters: php_ga_accountID: UA-12345678-9 php_ga_domain: yourwebsite.com
In your bundle :, (*14)
You now can include the class in your controller, (*15)
``` php use GoogleAnalytics;, (*16)
And track page (or events etc.) : ``` php // Initilize GA Tracker $tracker = $this->get('googleanalytics'); // 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('/page.html'); $page->setTitle('My Page'); // Track page view $tracker->trackPageview($page, $session, $visitor);
Google analytics vendor for symfony2. Warning: Deprecated!
google-analytics php-ga