matomo / matomo-php-tracker
Matomo Analytics Tracking API 的 PHP 客户端
3.3.1
2024-05-21 15:08 UTC
Requires
- php: ^7.2 || ^8.0
- 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
README
PHP 跟踪客户端提供了 Matomo Javascript 跟踪器的所有功能,例如电子商务跟踪、自定义变量、事件跟踪等。
文档和示例
查看我们的 Matomo-PHP-Tracker 开发者文档 和 Matomo 跟踪 API 指南。
// 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);
要求
- JSON 扩展(json_decode, json_encode)
- cURL 或 stream 扩展(用于向 Matomo 发送 HTTPS 请求)
安装
Composer
composer require matomo/matomo-php-tracker
手动
或者,您可以下载文件并手动要求 Matomo 跟踪器
require_once("MatomoTracker.php");
许可证
在 BSD 许可证 下发布