shapecode / matomo-bundle
This bundle provides matomo functions.
Installs: 80
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ~5.6|~7.0
- symfony/config: ~2.8|~3.0|~4.0
- symfony/dependency-injection: ~2.8|~3.0|~4.0
- symfony/framework-bundle: ~2.8|~3.0|~4.0
- symfony/http-kernel: ~2.8|~3.0|~4.0
- symfony/options-resolver: ~2.8|~3.0|~4.0
- symfony/twig-bundle: ~2.8|~3.0|~4.0
- twig/twig: ~1.34|~2.0
Replaces
- shapecode/piwik-bundle: 1.1.4
README
A Symfony2 Bundle that helps you to use the Matomo Open Analytics Platform with your project.
It contains a Twig function that can insert the tracking code into your website. Plus, you can turn it off with a simple configuration switch so you don't track your dev environment.
Installation
Simply add the following to your composer.json (see http://getcomposer.org/):
"require": { "shapecode/matomo-bundle": "~1.0" }
And enable the bundle in app/AppKernel.php
:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Shapecode\Bundle\MatomoBundle\ShapecodeMatomoBundle(), ); }
Usage
Somewhere in your views, right before the closing </body>
tag, insert
{{ matomo() }}
This will add the appropriate Matomo tracking code as described in the API reference.
You have the ability to change the config on the fly if it necessary
{{ matomo({ site_id: 1, host_name: 'my.matomo.hostname' host_path: '/sub_directory/', no_script_tracking: false }) }}
Configuration
You can configure the bundle in your config.yml
. Full Example:
shapecode_matomo: site_id: 1 # required, no default. site id from matomo tool disabled: %kernel.debug% # not required, default %kernel.debug%. Usually, you only want to include the tracking code in a production environment host_name: my.matomo.hostname # required. no default. Hostname to the matomo instance. host_path: "/sub_directory/" # not required, default null. Path to the tracking script on the host. no_script_tracking: true # not required, default true. Enables Image-Tracking if JavaScript is disabeld.
Credits, Copyright and License
Copyright 2017 shapecode. Code released under the MIT license.
Original script from http://www.webfactory.de