PHPackages                             fyrndly/laravel-matomo-tracker - 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. [API Development](/categories/api)
4. /
5. fyrndly/laravel-matomo-tracker

ActiveLibrary[API Development](/categories/api)

fyrndly/laravel-matomo-tracker
==============================

A seamless Matomo Analytics integration for Laravel app tracking.

v1.2.0(1mo ago)193↓50%MITPHPPHP ^7.3|^8.0

Since Apr 30Pushed 1mo agoCompare

[ Source](https://github.com/FyrnDly/laravel-matomo-tracker)[ Packagist](https://packagist.org/packages/fyrndly/laravel-matomo-tracker)[ RSS](/packages/fyrndly-laravel-matomo-tracker/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

Laravel Matomo Tracker
======================

[](#laravel-matomo-tracker)

A seamless and lightweight Matomo Analytics integration for Laravel application tracking. This package wraps the [official Matomo PHP Tracker](https://github.com/matomo-org/matomo-php-tracker) to provide a Laravel-friendly syntax, including Facades, auto-configuration, and background processing.

Features
--------

[](#features)

- **Auto-configuration**: Automatically detects Client IP, User-Agent, and Browser Language.
- **Queue Support**: Dispatch tracking requests to the background for high-performance applications.
- **User Tracking**: Automatically links Matomo User ID with Laravel Auth (configurable attribute).
- **Smart Event Tracking**: Supports strings, arrays, or objects as payloads (automatically encoded).
- **Flexible Tracking**: Supports Page Views, Custom Events, Site Search, and Goals.
- **Custom Dimensions**: Easily set custom dimensions for your tracking data.
- **Laravel Integration**: Includes a Facade and Service Provider with auto-discovery.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require fyrndly/laravel-matomo-tracker
```

The package will automatically register its service provider and facade.

Configuration
-------------

[](#configuration)

First, publish the configuration file:

```
php artisan vendor:publish --tag="matomo-config"
```

Then, add your Matomo details to your `.env` file:

```
MATOMO_URL=https://your-matomo-domain.com
MATOMO_SITE_ID=1
MATOMO_TOKEN=your_auth_token_here
MATOMO_USER_ID_ATTRIBUTE=email

# Enable Queue for high-traffic apps
MATOMO_QUEUE=false
```

### Configuration Options

[](#configuration-options)

- `url`: Your Matomo server URL.
- `site_id`: Your Matomo site ID.
- `token`: Required for manual IP tracking or administrative features.
- `user_id_attribute`: The attribute from the User model to use as the Matomo User ID (e.g., `email`, `id`).
- `queue`: Set to `true` to handle tracking in the background. Requires a working [Laravel Queue](https://laravel.com/docs/queues) worker.

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use FyrnDly\Matomo\Facades\Matomo;

// Track a Page View
Matomo::pageView('Home Page');

// Track a Goal
Matomo::goal(1, 50.0);

// Track Site Search
Matomo::search('search keyword', 'category', 10);
```

### Enhanced Event Tracking

[](#enhanced-event-tracking)

The `event` method supports complex data. If you pass an array or object to the `$payload` parameter, it will be automatically JSON-encoded and Base64-encoded for safe storage in Matomo.

```
// Simple Event
Matomo::event('Category', 'Action', 'Simple Name');

// Event with Payload (Array/Object)
$data = [
    'user_type' => 'premium',
    'source' => 'referral',
    'step' => 3
];

Matomo::event('Onboarding', 'StepCompleted', $data);
```

### Livewire &amp; Filament Auto-Tracking

[](#livewire--filament-auto-tracking)

You can effortlessly track page views in your Livewire components or Filament pages by simply including the `MatomoTrackView` trait. It hooks into the component's lifecycle and automatically resolves the page title.

```
use Livewire\Component;
use FyrnDly\Matomo\Traits\MatomoTrackView;

class Dashboard extends Component
{
    use MatomoTrackView;

    public $pageTitle = 'Main Dashboard'; // Automatically tracked as "Go to page Main Dashboard"
}
```

> Note: This trait smartly looks for $pageTitle, $title, $heading properties, or getTitle(), getHeading(), getRecordTitle() methods (perfect for Filament v3).

### High Traffic Handling (Queue)

[](#high-traffic-handling-queue)

For high-traffic applications, it is highly recommended to enable the queue to prevent API latency from affecting the user experience.

1. Set `MATOMO_QUEUE=true` in your `.env`.
2. Ensure your `QUEUE_CONNECTION` is not set to `sync`.
3. Run your queue worker: `php artisan queue:work`.

### Custom Dimensions

[](#custom-dimensions)

You can set custom dimensions before tracking:

```
Matomo::setCustomDimension(1, 'Premium User')
    ->pageView('Dashboard');
```

### Manual User ID

[](#manual-user-id)

If you need to manually set or override the User ID for a specific request:

```
Matomo::setUserId('custom-user-id')->pageView('Profile Page');
```

### Accessing the Raw Tracker

[](#accessing-the-raw-tracker)

If you need to access methods directly from the underlying `MatomoTracker` instance:

```
$rawTracker = Matomo::getRawTracker();
```

Credits
-------

[](#credits)

- [FyrnDly](https://github.com/FyrnDly)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance93

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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 ~2 days

Total

4

Last Release

35d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88b934a530d367733dd5588a75c1b45a3117ae06176606614fa1cd87e8297c72?d=identicon)[FyrnDly](/maintainers/FyrnDly)

---

Tags

laravellaravel-trackmatomomatomo-analyticslaravelmatomotrackinganalytics

### Embed Badge

![Health badge](/badges/fyrndly-laravel-matomo-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/fyrndly-laravel-matomo-tracker/health.svg)](https://phpackages.com/packages/fyrndly-laravel-matomo-tracker)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[riclep/laravel-storyblok

A Laravel wrapper around the Storyblok API to provide a familiar experience for Laravel devs

6277.0k5](/packages/riclep-laravel-storyblok)[qodenl/laravel-posthog

Laravel implementation for Posthog

3591.8k](/packages/qodenl-laravel-posthog)

PHPackages © 2026

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