endroid/google-analytics-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Endroid Google Analytics for Symfony

1.0.17 2016-02-21 08:49 UTC

README

By endroid

Latest Stable Version Build Status Total Downloads Monthly Downloads License

This bundle integrates Google Analytics in your project. It allows you to create one or multiple tracking codes and provides easy definition of tracking script in you templates.

knpbundles.com

Installation

Use Composer to install the bundle.

$ composer require endroid/google-analytics-bundle

Then enable the bundle via the kernel.

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Endroid\Bundle\GoogleAnalyticsBundle\EndroidGoogleAnalyticsBundle(),
    );
}

Configuration

config.yml

Multiple trackers can be defined via the configuration. A tracker can either be created using the short syntax or using the long syntax in case you want to change one of the optional parameters.

endroid_google_analytics:
    trackers:
        default: UA-XXXX-Y
        another: { property_id: UA-XXXX-Z, require_display_features: true }
        

Usage

After installation and configuration, the tracker can be rendered using the following Twig syntax.

<html>
    <head>
        ...
        {{ google_analytics_tracker('default') }}
    </head>
    ...

Versioning

Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.

License

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.