Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webfactory/piwik-bundle
Symfony Bundle with twig-function for the Matomo (fka Piwik) tracking code
https://github.com/webfactory/piwik-bundle
bundle matomo php piwik symfony
Last synced: about 1 hour ago
JSON representation
Symfony Bundle with twig-function for the Matomo (fka Piwik) tracking code
- Host: GitHub
- URL: https://github.com/webfactory/piwik-bundle
- Owner: webfactory
- License: mit
- Created: 2014-09-11T09:34:11.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-03-07T09:33:55.000Z (8 months ago)
- Last Synced: 2024-04-07T11:02:12.473Z (7 months ago)
- Topics: bundle, matomo, php, piwik, symfony
- Language: PHP
- Homepage:
- Size: 84 KB
- Stars: 39
- Watchers: 10
- Forks: 15
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![webfactory Logo](http://www.webfactory.de/bundles/webfactorytwiglayout/img/logo.png) WebfactoryPiwikBundle
============[![Run Tests](https://github.com/webfactory/piwik-bundle/workflows/Run%20Tests/badge.svg)](https://github.com/webfactory/piwik-bundle/workflows/)
[![Coverage Status](https://coveralls.io/repos/webfactory/piwik-bundle/badge.png?branch=master)](https://coveralls.io/r/webfactory/piwik-bundle?branch=master)A Symfony Bundle that helps you to use the Matomo (formerly known as Piwik) 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
------------composer require webfactory/piwik-bundle
And enable the bundle in `app/AppKernel.php`:
```php
` tag, insert{{ piwik_code() }}
This will add the appropriate Matomo tracking code as [described in the API reference](https://developer.matomo.org/api-reference/tracking-javascript#where-can-i-find-the-piwik-tracking-code).
Configuration
-------------
You can configure the bundle in your `config.yml`. Full Example:```yaml
webfactory_piwik:
# Required, no default. Must be set to the site id found in the Matomo control panel
site_id: 1
# Required. no default. Hostname and path to the Matomo host.
piwik_host: my.piwik.hostname
# Optional, has default. Usually, you only want to include the tracking code in a production environment
disabled: '%kernel.debug%'
# Optional, has default. Path to the tracking script on the host.
tracker_path: "/js/"
# Optional, has default. Disable cookies in favor of GDPR
# https://matomo.org/faq/new-to-piwik/how-do-i-use-matomo-analytics-without-consent-or-cookie-banner/ & https://matomo.org/faq/general/faq_157/
disable_cookies: true
```Add calls to the JavaScript tracker API
---------------------------------------The [JavaScript tracking API](http://developer.matomo.org/api-reference/tracking-javascript) provides a lot of methods
for setting the page name, tracking search results, using custom variables and much more.The generic `piwik()` function allows you to control the `_paq` variable and add additional API calls to it. For example,
in your Twig template, you can write```twig
{{ piwik("setDocumentTitle", document.title) }}
{{ piwik("trackGoal", 1) }}
{{ piwik_code() }}