PHPackages                             webfactory/piwik-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. webfactory/piwik-bundle

ActiveSymfony-bundle

webfactory/piwik-bundle
=======================

Symfony Bundle that adds a twig-function for the Matomo tracking code.

3.5.0(5mo ago)38129.7k↓28.9%16[4 issues](https://github.com/webfactory/piwik-bundle/issues)1MITPHPPHP &gt;= 8.1CI passing

Since Sep 11Pushed 5mo ago8 watchersCompare

[ Source](https://github.com/webfactory/piwik-bundle)[ Packagist](https://packagist.org/packages/webfactory/piwik-bundle)[ RSS](/packages/webfactory-piwik-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (32)Used By (1)

[![webfactory Logo](https://camo.githubusercontent.com/515f5fe6cea74874145ff73bce5340a6341def3341d39c6598b346a87243e5e6/687474703a2f2f7777772e776562666163746f72792e64652f62756e646c65732f776562666163746f7279747769676c61796f75742f696d672f6c6f676f2e706e67)](https://camo.githubusercontent.com/515f5fe6cea74874145ff73bce5340a6341def3341d39c6598b346a87243e5e6/687474703a2f2f7777772e776562666163746f72792e64652f62756e646c65732f776562666163746f7279747769676c61796f75742f696d672f6c6f676f2e706e67) WebfactoryPiwikBundle
==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-webfactorypiwikbundle)

[![Run Tests](https://github.com/webfactory/piwik-bundle/workflows/Run%20Tests/badge.svg)](https://github.com/webfactory/piwik-bundle/workflows/)[![Coverage Status](https://camo.githubusercontent.com/7d2f2de4f641ffde871f22e986241754a6ff22d48dfb06b3f499c3fa15e8b1cc/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f776562666163746f72792f706977696b2d62756e646c652f62616467652e706e673f6272616e63683d6d6173746572)](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.

Usage
=====

[](#usage)

Somewhere in your views, right before the closing `` 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).

When you want to display the opt-out dialog as [described in the documentation](https://developer.matomo.org/guides/in-depth-opt-out#opt-out-using-the-matomo-javascript-tracker), use the following Twig code:

```
{{ piwik_opt_out_code() }}

```

Configuration
=============

[](#configuration)

You can configure the bundle in your `config.yml`. Full Example:

```
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
=======================================

[](#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

```

    {{ piwik("setDocumentTitle", document.title) }}
    {{ piwik("trackGoal", 1) }}

    {{ piwik_code() }}

```

Note that when you call `trackSiteSearch`, this will automatically disable the `trackPageView` call made by default. This is the [recommended](http://developer.matomo.org/api-reference/tracking-javascript#tracking-internal-search-keywords-categories-and-no-result-search-keywords)behaviour.

Credits, Copyright and License
==============================

[](#credits-copyright-and-license)

This code was written by webfactory GmbH, Bonn, Germany. We're a software development agency with a focus on PHP (mostly [Symfony](http://github.com/symfony/symfony)). If you're a developer looking for new challenges, we'd like to hear from you!

-

Copyright 2012 – 2025 webfactory GmbH, Bonn. Code released under [the MIT license](LICENSE).

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance71

Regular maintenance activity

Popularity44

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 51.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~137 days

Recently: every ~34 days

Total

31

Last Release

154d ago

Major Versions

1.0.2 → 2.0.02014-09-17

2.7.0 → 3.0.02020-11-04

2.7.1 → 3.0.12022-02-08

PHP version history (2 changes)2.5.0PHP &gt;=7.1

3.5.0PHP &gt;= 8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d4ed0a0f5a1c56f7df31bb8c854a2ad99d24281dc8df4b4d3dd986a9e84b7a24?d=identicon)[webfactory](/maintainers/webfactory)

---

Top Contributors

[![mpdude](https://avatars.githubusercontent.com/u/1202333?v=4)](https://github.com/mpdude "mpdude (60 commits)")[![MalteWunsch](https://avatars.githubusercontent.com/u/2504942?v=4)](https://github.com/MalteWunsch "MalteWunsch (18 commits)")[![relthyg](https://avatars.githubusercontent.com/u/8628559?v=4)](https://github.com/relthyg "relthyg (11 commits)")[![bnw](https://avatars.githubusercontent.com/u/2411799?v=4)](https://github.com/bnw "bnw (8 commits)")[![FabianSchmick](https://avatars.githubusercontent.com/u/17527958?v=4)](https://github.com/FabianSchmick "FabianSchmick (6 commits)")[![GenieTim](https://avatars.githubusercontent.com/u/8596965?v=4)](https://github.com/GenieTim "GenieTim (3 commits)")[![MatthiasMolitor](https://avatars.githubusercontent.com/u/1383323?v=4)](https://github.com/MatthiasMolitor "MatthiasMolitor (2 commits)")[![MHundeloh](https://avatars.githubusercontent.com/u/15419171?v=4)](https://github.com/MHundeloh "MHundeloh (2 commits)")[![bretrzaun](https://avatars.githubusercontent.com/u/277782?v=4)](https://github.com/bretrzaun "bretrzaun (2 commits)")[![TomaszGasior](https://avatars.githubusercontent.com/u/1395027?v=4)](https://github.com/TomaszGasior "TomaszGasior (1 commits)")[![mnapoli](https://avatars.githubusercontent.com/u/720328?v=4)](https://github.com/mnapoli "mnapoli (1 commits)")[![Th3Mouk](https://avatars.githubusercontent.com/u/5006899?v=4)](https://github.com/Th3Mouk "Th3Mouk (1 commits)")[![artursvonda](https://avatars.githubusercontent.com/u/147427?v=4)](https://github.com/artursvonda "artursvonda (1 commits)")

---

Tags

bundlematomophppiwiksymfony

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/webfactory-piwik-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/webfactory-piwik-bundle/health.svg)](https://phpackages.com/packages/webfactory-piwik-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[shopware/storefront

Storefront for Shopware

684.2M148](/packages/shopware-storefront)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[sulu/article-bundle

Bundle for managing localized content-rich entities like blog-posts in the Sulu content management system

66409.6k2](/packages/sulu-article-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
