PHPackages                             mzaman/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. mzaman/laravel-matomo-tracker

ActiveLibrary[API Development](/categories/api)

mzaman/laravel-matomo-tracker
=============================

A Laravel facade/wrapper for the matomo/matomo-php-tracker for server-side Matomo tracking.

2.1.0(10mo ago)1357↓40.9%BSD-3-ClausePHPPHP ^8.0|^8.1

Since Aug 2Pushed 4mo ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (6)Used By (0)

LaravelMatomoTracker
====================

[](#laravelmatomotracker)

[![Latest Version on Packagist](https://camo.githubusercontent.com/306ddc27141f64d6c119cd713e4151a24f2fe29885e878af2433f8e5cfef0d32/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7a616d616e2f6c61726176656c2d6d61746f6d6f2d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mzaman/laravel-matomo-tracker)[![Total Downloads](https://camo.githubusercontent.com/50fa0916569beae86c1d56b6b2b03abb8ca41b1693ea884d675a24a27beb8a70/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7a616d616e2f6c61726176656c2d6d61746f6d6f2d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mzaman/laravel-matomo-tracker)

About
-----

[](#about)

The `mzaman\laravel-matomo-tracker` Laravel package is a wrapper for the `piwik\piwik-php-tracker`. The Piwik PHP tracker allows server-side tracking with Matomo.

Compatibility
-------------

[](#compatibility)

This package is compatible with Laravel 9.x, 10.x and later. Ensure that your Laravel version meets the required version before proceeding with the installation.

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

[](#installation)

### Via Composer

[](#via-composer)

Require the `mzaman/laravel-matomo-tracker` package in your `composer.json` and update your dependencies:

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

### Publish the Config File (Optional)

[](#publish-the-config-file-optional)

Run `php artisan vendor:publish` to publish the config file if needed.

```
php artisan vendor:publish
```

### Update Your `.env`

[](#update-your-env)

Add the following variables to your `.env` file and configure them to fit your environment:

```
MATOMO_URL="https://your.matomo-install.com"  # The URL of your Matomo server
MATOMO_SITE_ID=1  # Your Matomo Site ID
MATOMO_AUTH_TOKEN="00112233445566778899aabbccddeeff"  # Your Matomo Authentication Token
MATOMO_QUEUE="matomotracker"  # The name of the queue to use for tracking (default is 'matomotracker')
MATOMO_QUEUE_CONNECTION="default"  # The queue connection to use (default is 'default')
```

Usage
-----

[](#usage)

You can use the facade to track.

```
LaravelMatomoTracker::doTrackPageView('Page Title')
```

For tracking other events, such as downloads or outlinks, you can use:

```
LaravelMatomoTracker::doTrackDownload($actionUrl);
LaravelMatomoTracker::doTrackOutlink($actionUrl);
```

### Queue Setup

[](#queue-setup)

To enable queued tracking, you need to configure your queue settings in `config/queue.php` for the specified `MATOMO_QUEUE_CONNECTION`.

For example, to use the `database` queue driver, your `.env` file should look like this:

```
QUEUE_CONNECTION=database
```

Make sure to run the necessary migrations to set up your database queue:

```
php artisan queue:table
php artisan migrate
```

### Queue Functions

[](#queue-functions)

For queuing, you can use these functions:

```
LaravelMatomoTracker::queuePageView(string $documentTitle);
LaravelMatomoTracker::queueEvent(string $category, string $action, $name = false, $value = false);
LaravelMatomoTracker::queueContentImpression(string $contentName, string $contentPiece = 'Unknown', $contentTarget = false);
LaravelMatomoTracker::queueContentInteraction(string $interaction, string $contentName, string $contentPiece = 'Unknown', $contentTarget = false);
LaravelMatomoTracker::queueSiteSearch(string $keyword, string $category = '',  $countResults = false);
LaravelMatomoTracker::queueGoal($idGoal, $revenue = 0.0);
LaravelMatomoTracker::queueDownload(string $actionUrl);
LaravelMatomoTracker::queueOutlink(string $actionUrl);
LaravelMatomoTracker::queueEcommerceCartUpdate(float $grandTotal);
LaravelMatomoTracker::queueEcommerceOrder(float $orderId, float $grandTotal, float $subTotal = 0.0, float $tax = 0.0, float $shipping = 0.0,  float $discount = 0.0);
LaravelMatomoTracker::queueBulkTrack();
```

### Troubleshooting

[](#troubleshooting)

If you're experiencing issues with the package, ensure that:

1. You have correctly set up the `.env` variables for `MATOMO_URL`, `MATOMO_SITE_ID`, and `MATOMO_AUTH_TOKEN`.
2. Your queue system is configured correctly. Check the Laravel queue documentation for more details: [Laravel Queue Docs](https://laravel.com/docs/9.x/queues).
3. You are using the correct version of `matomo/matomo-php-tracker` that is compatible with your Matomo installation.
4. Check the `storage/logs/laravel.log` file for any related errors or issues.

Tracking
--------

[](#tracking)

### Basic Functionality

[](#basic-functionality)

You can also use the following methods to simplify tracking actions:

```
// Instead of using
LaravelMatomoTracker::doTrackAction($actionUrl, 'download'); // or
LaravelMatomoTracker::doTrackAction($actionUrl, 'link');

// You can use these simplified methods:
LaravelMatomoTracker::doTrackDownload($actionUrl);
LaravelMatomoTracker::doTrackOutlink($actionUrl);
```

### Advanced Tracking

[](#advanced-tracking)

Here are additional methods for tracking specific events and actions:

```
LaravelMatomoTracker::setCustomDimension(int $id, string $value);
LaravelMatomoTracker::setCustomDimensions([]); // bulk insert of custom dimensions
LaravelMatomoTracker::setCustomVariables([]);  // bulk insert of custom variables
```

For more advanced Matomo tracking capabilities, refer to the [Matomo PHP Tracker API Documentation](https://developer.matomo.org/api-reference/PHP-Piwik-Tracker).

Change Log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a to-do list.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [All Contributors](../../contributors)

License
-------

[](#license)

BSD-3-Clause. Please see the [license file](license.md) for more information.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance65

Regular maintenance activity

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

328d ago

Major Versions

1.0.0 → 2.0.02025-08-02

PHP version history (3 changes)1.0.0PHP ^8.0

2.0.0PHP ^8.1

2.0.1PHP ^8.0|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/579865dec2d7a9eae23c2039fb91415356d6d348cbac3ebfae0ea53a560a18a4?d=identicon)[mzaman](/maintainers/mzaman)

---

Top Contributors

[![mzaman](https://avatars.githubusercontent.com/u/154233?v=4)](https://github.com/mzaman "mzaman (22 commits)")

---

Tags

laravelpiwikserver side trackingMatomo TrackerPiwik Laravel Tracker

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[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)[alfrasc/laravel-matomo-tracker

A Laravel facade/wrapper for the matomo/matomo-php-tracker for server side Matomo tracking.

2124.2k](/packages/alfrasc-laravel-matomo-tracker)

PHPackages © 2026

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