dev-master
9999999-devBundle to use the Universal Analytics Google API
MIT
The Requires
- php >=5.3.0
- symfony/symfony >=2.0
The Development Requires
by Marc Höffl
analytics google universal analytics
Bundle to use the Universal Analytics Google API
This is based on the original AntiMattr/GoogleBundle. It is solely for Analytics using the Universal Analytics API, (*1)
Add GoogleBundle to the registerBundles()
method of your application kernel:, (*2)
public function registerBundles() { return array( new Strego\GoogleBundle\StregoGoogleBundle(), ); }
Enable loading of the Google Analytics service by adding the following to
the application's config.yml
file:, (*3)
strego_google: default_tracker: default trackers: default: accountId: xXxxXx cookieDomain: .example.com
strego_google: default_tracker: default trackers: default: accountId: xXxxXx cookieDomain: .example.com allowHash: false allowLinker: true trackPageLoadTime: false
Include the Google Analytics Async template in the head
tag or just before the </body>
of your layout (The template will lazy load ga)., (*4)
With twig:, (*5)
{% include "StregoGoogleBundle:Analytics:async.html.twig" %}
Just get the analytics service in your controller via:, (*6)
$analytics = $this->get('strego_google'); // To add just a pageview: $analytics->addPageView('/testPage'); //To add a Pageview with a specific title $analytics->addPageView('/testPage2', 'testPage2Title);
Bundle to use the Universal Analytics Google API
MIT
analytics google universal analytics