Stars: 187
Forks: 84
Pull Requests: 76
Issues: 46
Watchers: 28
Last Updated: 2023-08-29 19:47:22
PHP Client for Matomo Analytics Tracking API
License: BSD 3-Clause "New" or "Revised" License
Languages: PHP, Shell
The PHP Tracker Client provides all features of the Matomo Javascript Tracker, such as Ecommerce Tracking, Custom Variables, Event Tracking and more.
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);
composer require matomo/matomo-php-tracker
Alternatively, you can download the files and require the Matomo tracker manually:
require_once("MatomoTracker.php");
Released under the BSD License