Download the PHP package hamaryuginh/google-analytics-bundle without Composer
On this page you can find all versions of the php package hamaryuginh/google-analytics-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hamaryuginh/google-analytics-bundle
More information about hamaryuginh/google-analytics-bundle
Files in hamaryuginh/google-analytics-bundle
Package google-analytics-bundle
Short Description Symfony2 Google Analytics Bundle
License MIT
Homepage http://hamaryuginh.github.io/google-analytics-bundle/
Informations about the package google-analytics-bundle
GoogleAnalyticsBundle
Work in progress
This Symfony bundle will simplify the management of interactions with google analytics.
Installation
Install composer
Add the following to your require block in composer.json config
Then, execute the following command in your symfony poject root
Configuration
Register the bundle in app/AppKernel.php
:
Add to your app/config/config.yml
the following:
Add the following before </head>
tag:
At the end of your document, before the </body>
tag, add:
Install assets (from your symfony project root):
Usage
Globally, you define a data-ga-xxx
attribute on any tag and you give arguments as JSON string (ex: data-ga-page="{'page':'/home'}"
)
Page tracking
Add data-ga-page
attribute on <body>
tag or any other tag:
Or:
Or whatever you want...
Warning!
data-ga-page
must be defined only once per document !
For further information, take a look at the Page tracking documentation.
Custom dimentions and metrics
Add data-ga-dimension
attribute on any tag:
For further information, take a look at the Custom dimensions and metrics documentation.
Event tracking (only "click" event at the moment)
Add data-ga-event
attribute on any tag:
For further information, take a look at the Event tracking documentation.
Social interactions (only homemade social buttons at the moment)
Add data-ga-social
attribute on any tag:
For further information, take a look at the Social interactions documentation.
Last but not least
Obviously, you can still use the Google Analytics library by the default way:
Ecommerce usage
1. Start the ecommerce tracking
Be sure to only declare this once and AFTER initializing the GA tracker (see Configuration)
2. Add a transaction
A transaction is like a basket
3.Add an item to the transaction
An item is a product in your basket. Add as many items in your transaction as you want.
4. Send the transaction to GA
Call this after having added all the items to the transaction.
Have fun!
Contributions
Feel free to open an issue or add a pull request.
All versions of google-analytics-bundle with dependencies
symfony/framework-bundle Version >=2.5.6
twig/twig Version *
doctrine/doctrine-bundle Version *