matomo/matomo-php-tracker
PHP Client for Matomo Analytics Tracking API
Maintainers
3.4.0
2025-12-20 18:55 UTC
Requires
- php: ~7.2 || ~7.3 || ~7.4 || ~8.0 || ~8.1 || ~8.2 || ~8.3 || ~8.4 || ~8.5
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^8.5 || ^9.3 || ^10.1
Suggests
- ext-curl: Using this extension to issue the HTTPS request to Matomo
Provides
None
Conflicts
None
Replaces
None
BSD-3-Clause 9462dc6eb718c711545ea1b0f590b9ae892a4212
- The Matomo Team <hello.woop@matomo.org>
This package is auto-updated.
Last update: 2026-06-04 22:56:23 UTC
README
The PHP Tracker Client provides all features of the Matomo Javascript Tracker, such as Ecommerce Tracking, Custom Variables, Event Tracking and more.
Documentation and examples
Check out our Matomo-PHP-Tracker developer documentation and Matomo Tracking API guide.
// Required variables $matomoSiteId = 6; // Site ID $matomoUrl = "https://example.tld"; // Your matomo URL $matomoToken = ""; // Your authentication token // Optional variable $matomoPageTitle = ""; // The title of the page // Load object require_once("MatomoTracker.php"); // Matomo object $matomoTracker = new MatomoTracker((int)$matomoSiteId, $matomoUrl); // Set authentication token $matomoTracker->setTokenAuth($matomoToken); // Track page view $matomoTracker->doTrackPageView($matomoPageTitle);
Requirements:
- JSON extension (json_decode, json_encode)
- cURL or stream extension (to issue the HTTPS request to Matomo)
Installation
Composer
composer require matomo/matomo-php-tracker
Manually
Alternatively, you can download the files and require the Matomo tracker manually:
require_once("MatomoTracker.php");
License
Released under the BSD License
