PHPackages                             sylvainjule/matomo - 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. [Admin Panels](/categories/admin)
4. /
5. sylvainjule/matomo

ActiveKirby-plugin[Admin Panels](/categories/admin)

sylvainjule/matomo
==================

Matomo helpers, panel area and sections for Kirby

2.1.1(11mo ago)14512.6k—2.8%9[2 issues](https://github.com/sylvainjule/kirby-matomo/issues)MITVue

Since Dec 12Pushed 10mo ago7 watchersCompare

[ Source](https://github.com/sylvainjule/kirby-matomo)[ Packagist](https://packagist.org/packages/sylvainjule/matomo)[ RSS](/packages/sylvainjule-matomo/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (0)

Kirby Matomo
============

[](#kirby-matomo)

This plugin helps you generate a tracking code for Matomo, and displays some useful metrics directly within the panel.

[![screenshot-dashboard-faded](https://user-images.githubusercontent.com/14079751/47715079-f3226200-dc3e-11e8-80c6-933c9f3183d0.jpg)](https://user-images.githubusercontent.com/14079751/47715079-f3226200-dc3e-11e8-80c6-933c9f3183d0.jpg)

Overview
--------

[](#overview)

> This plugin is completely free and published under the MIT license. However, if you are using it in a commercial project and want to help me keep up with maintenance, you can consider [making a donation of your choice](https://www.paypal.me/sylvainjl).

- [1. Why Matomo?](#1-why-matomo)
- [2. Installation](#2-installation)
- [3. Options](#3-options)
- [4. Template usage](#4-template-usage)
    - [4.1. Tracking code](#41-tracking-code)
    - [4.2. Opt-out snippet](#42-opt-out-snippet)
- [5. Panel display: Area](#5-panel-display-area)
- [6. Panel display: Sections](#6-panel-display-sections)
    - [6.1. Basic blueprint example](#61-basic-blueprint-example)
    - [6.2. Options](#62-options)
    - [6.3. Complete blueprint example](#63-complete-blueprint-example)
- [7. Panel page widget](#6-panel-page-widget)
    - [7.1. Basic blueprint example](#71-basic-blueprint-example)
    - [7.2. Options](#72-options)
    - [7.3. Potential pitfalls](#73-potential-pitfalls)
- [8. License](#8-license)
- [9. Credits](#9-credits)

#### TLDR – Just get me started 👀

[](#tldr--just-get-me-started-)

1. Install Matomo on your server.
2. Download and copy this repository to `/site/plugins/matomo`
3. Set the following values in `site/config/config.php` :

```
return array(
    'sylvainjule.matomo.url'        => 'http://your-matomo.url',
    'sylvainjule.matomo.id'         => 'mywebsite',
    'sylvainjule.matomo.token'      => 'token_auth',
);
```

4. Add this code to your footer snippet: ``
5. Visit the Matomo panel area or copy [this blueprint](#51-basic-blueprint-example) under a dedicated tab / page in the panel.

You're all set.

1. Why Matomo?
--------------

[](#1-why-matomo)

- It's open-source (who doesn't like open-source?)
- It's free (like, really free. You don't pay with your data)
- It's self-hosted (which means more control for you over your data)
- It respects your visitors privacy (IP Anonymization, automated logs deletion, data ownership)
- It now integrates smoothly with Kirby 5 ✌️

2. Installation
---------------

[](#2-installation)

> Kirby 3: up to 1.0.7 Kirby 4: up to 2.0.1. Kirby 5: 2.1.0+.

Download and copy this repository to `/site/plugins/matomo`

Alternatively, you can install it with composer: `composer require sylvainjule/matomo`

3. Options
----------

[](#3-options)

Here is an overview of the available options with their default values:

```
return array(
    'sylvainjule.matomo.url'            => false, #required
    'sylvainjule.matomo.id'             => false, #required
    'sylvainjule.matomo.token'          => false, #required for the panel integration
    'sylvainjule.matomo.active'         => true,
    'sylvainjule.matomo.debug'          => false,
    'sylvainjule.matomo.trackUsers'     => false,
    'sylvainjule.matomo.disableCookies' => false,
    'sylvainjule.matomo.setDoNotTrack'  => false,
    'sylvainjule.matomo.blacklist'      => ['127.0.0.1', '::1'],
    'sylvainjule.matomo.basicAuth'      => null,
    'sylvainjule.matomo.area'           => true,
    'sylvainjule.matomo.area.label'     => 'Matomo',
    'sylvainjule.matomo.area.headline'  => null,

);
```

#### 3.1. `url` (required)

[](#31-url-required)

Where your matomo install is:

```
'sylvainjule.matomo.url' => 'https://analytics.yourdomain.com'
```

#### 3.2. `id` (required)

[](#32-id-required)

A single Matomo install can host multiple websites. The plugin needs to know the `id` of the one to look for:

```
'sylvainjule.matomo.id' => 'mywebsite'
```

#### 3.3. `token` (required for the panel integration)

[](#33-token-required-for-the-panel-integration)

The panel sections will need to make calls to your Matomo API. A `token_auth` is required, you can generate it in your Matomo dashboard under `Settings > Personal > Security ↓ Auth tokens`. Copy-paste the token string generated.

> Below is an example token. Please note that this token is private and shouldn't be made public. Once added, if you need to publish your code please create something like a duplicated `config.github.php` which will contain the non-sensitive informations, and add your real `config.php` to your `.gitignore`.

```
'sylvainjule.matomo.token' => 'gQ7TQgg8EFe3h29F9t4aJqC33VQdPfFP4M'
```

#### 3.4. `active`

[](#34-active)

You can deactivate the snippet by setting this value to `false`.

```
'sylvainjule.matomo.active' => true
```

#### 3.5. `blacklist`

[](#35-blacklist)

Localhost is in the blacklist as default. You can change it.

```
'sylvainjule.matomo.blacklist' => ['127.0.0.1', '::1']
```

#### 3.6. `trackUsers`

[](#36-trackusers)

The script is only active for not logged in users by default. If you want to change it, set this option to `true`.

```
'sylvainjule.matomo.trackUsers' => false
```

#### 3.7. `debug`

[](#37-debug)

If you want to always run the script (even on localhost or if you are logged in), set this option to `true`.

```
'sylvainjule.matomo.debug' => false
```

#### 3.8. `disableCookies`

[](#38-disablecookies)

If you want to use Matomo without any tracking cookies on the user side, set this option to `true`. You can read more about this setting in the [Matomo FAQ](https://matomo.org/faq/general/faq_157/).

```
'sylvainjule.matomo.disableCookies' => false
```

#### 3.9. `setDoNotTrack`

[](#39-setdonottrack)

If you want to add the `_paq.push(["setDoNotTrack", true])` option in your tracking code, set this option to `true`. You can read more about this setting in the [Matomo FAQ](https://matomo.org/faq/general/configure-privacy-settings-in-matomo/#step-4-respect-donottrack-preference).

```
'sylvainjule.matomo.setDoNotTrack' => false
```

#### 3.10. `basicAuth`

[](#310-basicauth)

If your Matomo instance is additionally secured by Basic Authentication, you can configure these credentials in the format `USERNAME:PASSWORD`.

```
'sylvainjule.matomo.basicAuth' => null
```

#### 3.11. `area`

[](#311-area)

If you want to hide the Matomo Panel area, set this option to `false`.

```
'sylvainjule.matomo.area' => true
```

#### 3.12. `area.label`

[](#312-arealabel)

If you want to change the label for the Matomo Panel area (displayed in the menu and the breacrumb), you can configure it:

```
'sylvainjule.matomo.area.label' => 'Matomo'
```

#### 3.13. `label`

[](#313-label)

If you also want to change the headline for the Matomo Panel area, you can set it with the `area.headline` option. If not specified, the label will be used as fallback.

```
'sylvainjule.matomo.area.headline' => 'Custom area headline'
```

4. Template usage
-----------------

[](#4-template-usage)

#### 4.1. Tracking code

[](#41-tracking-code)

You only need to include the snippet in your code somewhere:

```
