承接 mattitjaab/mattitja-analytics 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mattitjaab/mattitja-analytics

最新稳定版本:v1.1.0

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 key
  • u - Full URL of the visited page
  • r - Referrer URL (if available)
  • ip - Visitor's complete IP address
  • ua - 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

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-30