mattitjaab/mattitja-analytics
Composer 安装命令:
composer require mattitjaab/mattitja-analytics
包简介
Laravel middleware package for sending analytics data to Mattitja Analytics API
README 文档
README
A Laravel middleware package for sending analytics data to the Mattitja Analytics API. The package automatically registers middleware for web routes and sends data synchronously to the analytics service.
Installation
composer require mattitjaab/mattitja-analytics
Configuration
Publish the configuration file (optional):
php artisan vendor:publish --tag=mattitja-analytics-config
Add your site key to your .env file:
MATTITJA_ANALYTICS_SITE_KEY=your-site-key MATTITJA_ANALYTICS_ENABLED=true
Usage
The package automatically registers middleware for the web group and starts collecting analytics data immediately after installation and configuration.
Manual middleware registration
You can also add the middleware manually for specific routes:
// In routes/web.php Route::middleware(['mattitja-analytics'])->group(function () { // Your routes here });
Configuration Options
Basic Settings
MATTITJA_ANALYTICS_SITE_KEY- Your site key from Mattitja Analytics (required)MATTITJA_ANALYTICS_ENABLED- Enable/disable tracking (default: true)MATTITJA_ANALYTICS_BOTS- Track bots (default: false)
Privacy Settings
MATTITJA_ANALYTICS_RESPECT_DNT- Respect Do Not Track header (default: true)
Filtering
You can configure paths and IP addresses to ignore in the config file.
Data Sent
The package sends the following data to https://analytics.mattitja.cloud/api/send:
k- Site keyu- Full URL of the visited pager- Referrer URL (if available)ip- Visitor's complete IP addressua- User agent string
Security
- Data is sent synchronously directly from middleware
- IP addresses are NOT anonymized (needed for geolocation)
- Bot traffic is filtered out by default
- Do Not Track header is respected by default
Development
Run tests:
composer test
License
MIT License
mattitjaab/mattitja-analytics 适用场景与选型建议
mattitjaab/mattitja-analytics 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mattitjaab/mattitja-analytics 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mattitjaab/mattitja-analytics 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-30