一键导入
ranetrace-analytics
Set up and configure Ranetrace's privacy-first website analytics with bot detection, path filtering, and custom request filters.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Set up and configure Ranetrace's privacy-first website analytics with bot detection, path filtering, and custom request filters.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Send application logs to Ranetrace via the auto-registered logging channel, and integrate it with Laravel's logging stack.
Set up and schedule the Ranetrace worker to flush buffered errors, events, logs, analytics, and JavaScript errors to the API.
Track custom application events like sales, signups, and user actions with Ranetrace's privacy-first event system.
Capture client-side JavaScript errors with breadcrumbs, deduplication, and sampling using Ranetrace's Blade directive.
Track, investigate, and manage application errors with Ranetrace, including MCP tools for AI-assisted debugging.
| name | ranetrace-analytics |
| description | Set up and configure Ranetrace's privacy-first website analytics with bot detection, path filtering, and custom request filters. |
Use this skill when setting up website analytics, configuring bot detection, excluding paths from tracking, or implementing custom request filters.
The TrackPageVisit middleware is auto-registered on the web middleware group when both RANETRACE_ENABLED and RANETRACE_WEBSITE_ANALYTICS_ENABLED are true. No manual middleware registration is needed.
Analytics is privacy-first: no cookies and no client-side scripts. Visitors are identified only by salted, one-way HMAC hashes — a user-agent hash and a daily-rotating session-id hash (IP + user agent + date, keyed by a per-install salt) — never raw identifiers, and never across sites. The raw IP and user agent are used transiently on the server and are not sent (unless debug.preserve_user_agent is enabled for local debugging).
// config/ranetrace.php
'website_analytics' => [
'enabled' => env('RANETRACE_WEBSITE_ANALYTICS_ENABLED', false),
'queue' => env('RANETRACE_WEBSITE_ANALYTICS_QUEUE', true),
'queue_name' => env('RANETRACE_WEBSITE_ANALYTICS_QUEUE_NAME', 'default'),
'timeout' => env('RANETRACE_WEBSITE_ANALYTICS_TIMEOUT', 10),
'excluded_paths' => [
'horizon', 'nova', 'telescope', 'admin', 'filament',
'api', 'debugbar', 'storage', 'livewire', '_debugbar',
],
'request_filter' => null, // Custom filter class (FQCN)
'user_agent' => [
'min_length' => env('RANETRACE_WEBSITE_ANALYTICS_UA_MIN_LENGTH', 10),
'max_length' => env('RANETRACE_WEBSITE_ANALYTICS_UA_MAX_LENGTH', 1000),
],
'throttle_seconds' => env('RANETRACE_WEBSITE_ANALYTICS_THROTTLE_SECONDS', 30),
],
The excluded_paths config array matches the first URL segment. To exclude /admin/users, add 'admin' (this excludes all /admin/* routes).
Add more paths directly in the config:
'excluded_paths' => [
'horizon', 'nova', 'telescope', 'admin', 'filament',
'api', 'debugbar', 'storage', 'livewire', '_debugbar',
'webhooks', // custom addition
'health', // custom addition
],
For advanced filtering logic, implement the RequestFilter contract:
use Illuminate\Http\Request;
use Ranetrace\Laravel\Analytics\Contracts\RequestFilter;
class MyRequestFilter implements RequestFilter
{
public function shouldSkip(Request $request): bool
{
// Skip tracking for internal API consumers
if ($request->header('X-Internal-Client')) {
return true;
}
// Skip tracking for specific IP ranges
if (str_starts_with($request->ip(), '10.0.')) {
return true;
}
return false;
}
}
Register in config:
'request_filter' => \App\Analytics\MyRequestFilter::class,
The middleware uses a multi-layer bot detection system:
Accept-Language and meaningful Accept headersRequests from the same IP to the same path are throttled to prevent duplicate tracking. Default: 30 seconds between tracked visits per IP/path combination. Configure with RANETRACE_WEBSITE_ANALYTICS_THROTTLE_SECONDS.
Each page visit includes:
php artisan ranetrace:test-analytics