agencetwogether/matomo-analytics

Matomo Analytics integration for Filament Panels with a set of widgets to display your analytics data in a beautiful way.

Maintainers

Package info

github.com/agencetwogether/matomo-analytics

pkg:composer/agencetwogether/matomo-analytics

Fund package maintenance!

agencetwogether

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.3 2026-03-06 14:48 UTC

This package is auto-updated.

Last update: 2026-03-06 14:51:06 UTC


README

matomo-analytics-art

FILAMENT 4.x FILAMENT 5.x Packagist Code Style Passing Downloads

Matomo Analytics

Matomo Analytics integration for Filament Panels with a set of widgets to display your analytics data in a beautiful way.

Note

This package is an adaptation of bezhanSalleh/filament-google-analytics, updated to work with Matomo Analytics. Thanks to him

Installation

You can install the package in a Laravel app that uses Filament via composer:

composer require agencetwogether/matomo-analytics

Important

If you have not set up a custom theme and are using Filament Panels follow the instructions in theFilament Docs (V4), Filament Docs (V5) first.

After setting up a custom theme add the following to your theme css file.

@source '../../../../vendor/agencetwogether/matomo-analytics/resources/views/**/*';
@source '../../../../vendor/agencetwogether/matomo-analytics/src/{Widgets,Support}/*';

Then rebuild your assets:

npm run build

First you need to retrieve credentials from your Matomo instance (self-hosted or cloud)

Matomo API Key

To generate a new API Key go to Administration->Personal->Security and click on Create new token button.

  • Give a description as you want,
  • Uncheck Only allow secure requests
  • And set or no an exire date.

Matomo Base Url

Copy Url of your instance with http or https prefix and remove slash (/) at the end. For example, your base Url must be like : https://analyse.domain.com

Matomo ID Site

To retrieve ID of your website you want to track, go to Administration->Websites->Manage and copy the ID below site name.

After that, add these credentials to the .env for your Filament PHP app:

MATOMO_API_KEY=
MATOMO_BASE_URL=
MATOMO_ID_SITE=

For example, it might look like this

MATOMO_API_KEY="d26fa64666d15073d9a8e49101422c06"
MATOMO_BASE_URL="https://analyse.domain.com"
MATOMO_ID_SITE=1

Registering the plugin

use Agencetwogether\MatomoAnalytics\MatomoAnalyticsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            ...
            MatomoAnalyticsPlugin::make()
        ]);
}

Usage

All the widgets are enabled by default for you to use them in your filament pages/resources. In order to enable the widgets for the default filament dashboard, you need to set the filament_dashboard option to true in the config file matomo-analytics.php for each widget you want to enable.

Publish the config files and set your settings:

 php artisan vendor:publish --tag=matomo-analytics-config

Available Widgets

use Agencetwogether\MatomoAnalytics\Widgets;

Widgets\PageViewsWidget::class,
Widgets\VisitorsWidget::class,
Widgets\VisitsWidget::class,
Widgets\VisitsDurationWidget::class,
Widgets\VisitorsFrequenciesWidget::class,
Widgets\VisitorsFrequenciesDurationWidget::class,
Widgets\VisitsByCountryWidget::class,
Widgets\VisitsByCityWidget::class,
Widgets\VisitsPerHourWidget::class,
Widgets\VisitsByBrowserListWidget::class,
Widgets\VisitsByDeviceWidget::class,
Widgets\VisitsByModelListWidget::class,
Widgets\MostVisitedPagesWidget::class,
Widgets\TopReferrersListWidget::class,

Custom Dashboard

Though this plugin comes with a default dashboard, but sometimes you might want to change navigationLabel or navigationGroup or disable some widgets or any other options and given that the dashboard is a simple filament page; The easiest solution would be to disable the default dashboard and create a new page:

php artisan filament:page MyCustomDashboardPage

then register the widgets you want from the Available Widgets list either in the getHeaderWidgets() or getFooterWidgets():

<?php

namespace App\Filament\Pages;

use BackedEnum;
use Filament\Pages\Page;
use Agencetwogether\MatomoAnalytics\Widgets;

class MyCustomDashboardPage extends Page
{
    protected static string | BackedEnum | null $navigationIcon = 'heroicon-o-document-text';

    protected string $view = 'filament.pages.my-custom-dashboard-page';

    protected function getHeaderWidgets(): array
    {
        return [
            Widgets\PageViewsWidget::class,
            Widgets\VisitorsWidget::class,
            Widgets\VisitsWidget::class,
            Widgets\VisitsDurationWidget::class,
            Widgets\VisitorsFrequenciesWidget::class,
            Widgets\VisitorsFrequenciesDurationWidget::class,
            //Widgets\VisitsByCountryWidget::class,
            //Widgets\VisitsByCityWidget::class,
            Widgets\VisitsPerHourWidget::class,
            Widgets\VisitsByBrowserListWidget::class,
            Widgets\VisitsByDeviceWidget::class,
            Widgets\VisitsByModelListWidget::class,
            Widgets\MostVisitedPagesWidget::class,
            Widgets\TopReferrersListWidget::class,
        ];
    }
}

Note

In order to enable the widgets for the default filament dashboard, you need to set the filament_dashboard option to true in the config file matomo-analytics.php for each widget you want to enable.

Preview

Widgets rendered in a dedicated dashboard (or any other page you create) Demo Demo

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.