kpicaza/google-analytics-bundle

Simple way to insert google analytics tracker in your templates.

dev-master / 0.1.x-dev 2016-01-27 13:26 UTC

This package is auto-updated.

Last update: 2024-11-18 09:22:06 UTC


README

Twig extension to insert Google Analytics script in your templates

##Installation:

composer require kpicaza/google-analytics-bundle=dev-master

Then activate in your app kernel

// app/AppKernel.php
class AppKernel extends Kernel
{

    public function registerBundles()
    {
        $bundles = array(    
            ...
            new Kpicaza\Bundle\GoogleanalyticsBundle\KpicazaGoogleanalyticsBundle(),
            ...

##Usage:

Add the following helper function to your twig template:

{{ ga_init('UA-XXXXXXXX-X') }}