Skip to content

samuelmc/google-analytics-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-analytics-bundle (SamuelGaBundle)

Google Analytics Bundle for Symfony

SensioLabsInsight

This bundle adds the Google Analytics code to every page except those that match the "exclude_path" parameter.

Installation

composer require samuelmc/google-analytics-bundle (view on packagist)

add the bundle in AppKernel:

new Samuelmc\GaBundle\SamuelGaBundle()

import the services in config.yml:

imports:
    - { resource: security.yml }
    - { resource: services.yml }
    ...
    - { resource: "@SamuelmcGaBundle/Resources/config/services.yml" }

Configuration

there are two parameters to configure under samuel_ga:

  • tracking_id: your Google Analytics tracker code.
  • exclude_paths: a regex string which filters out paths that should not be tracked by Google Analytics. Default: '(^/(_profiler|_wdt).+)'
samuelmc_ga:
    tracking_id: "UA-..."
    exclude_paths: '(^\/(_profiler|_wdt).+)'

##License

MIT Licence

© Samuel Moncarey