一键导入
ranetrace-event-tracking
Track custom application events like sales, signups, and user actions with Ranetrace's privacy-first event system.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Track custom application events like sales, signups, and user actions with Ranetrace's privacy-first event system.
用 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.
Capture client-side JavaScript errors with breadcrumbs, deduplication, and sampling using Ranetrace's Blade directive.
Set up and configure Ranetrace's privacy-first website analytics with bot detection, path filtering, and custom request filters.
Track, investigate, and manage application errors with Ranetrace, including MCP tools for AI-assisted debugging.
| name | ranetrace-event-tracking |
| description | Track custom application events like sales, signups, and user actions with Ranetrace's privacy-first event system. |
Use this skill when implementing custom event tracking for analytics, e-commerce metrics, user behavior tracking, or any application-specific events.
Ranetrace::trackEvent(string $eventName, array $properties = [], int|string|null $userId = null, bool $validate = true) — low-level tracking ($userId accepts int or string for UUID models; $validate: false skips snake_case name validation)RanetraceEvents — convenience methods with built-in validationThe EventTracker class provides constants for common events:
use Ranetrace\Laravel\Events\EventTracker;
EventTracker::PRODUCT_ADDED_TO_CART // 'product_added_to_cart'
EventTracker::PRODUCT_REMOVED_FROM_CART
EventTracker::CART_VIEWED
EventTracker::CHECKOUT_STARTED
EventTracker::CHECKOUT_COMPLETED
EventTracker::SALE // 'sale'
EventTracker::USER_REGISTERED // 'user_registered'
EventTracker::USER_LOGGED_IN
EventTracker::USER_LOGGED_OUT
EventTracker::PAGE_VIEW
EventTracker::SEARCH
EventTracker::NEWSLETTER_SIGNUP
EventTracker::CONTACT_FORM_SUBMITTED
use Ranetrace\Laravel\Facades\RanetraceEvents;
// Track a sale
RanetraceEvents::sale(
orderId: 'ORD-123',
totalAmount: 99.99,
products: [['id' => 'PROD-1', 'name' => 'Widget', 'price' => 49.99]],
currency: 'EUR',
);
// Track product added to cart
RanetraceEvents::productAddedToCart(
productId: 'PROD-1',
productName: 'Widget',
price: 49.99,
quantity: 2,
category: 'Electronics',
);
// Track user registration (auto-detects authenticated user if $userId is null)
RanetraceEvents::userRegistered(userId: $user->id);
// Track user login
RanetraceEvents::userLoggedIn();
// Track a specific page view (distinct from website analytics)
RanetraceEvents::pageView('pricing-page');
// Custom event with validation (enforces naming rules)
RanetraceEvents::custom('feature_toggled', [
'feature' => 'dark_mode',
'enabled' => true,
]);
// Custom event without validation (advanced use only)
RanetraceEvents::customUnsafe('My.Custom.Event', $properties);
Event names are validated by default and must:
snake_case format (lowercase with underscores)Valid: user_registered, checkout_completed, feature_toggled
Invalid: UserRegistered, a, 123_event, my-event
// config/ranetrace.php
'events' => [
'enabled' => env('RANETRACE_EVENTS_ENABLED', true),
'queue' => env('RANETRACE_EVENTS_QUEUE', true),
'queue_name' => env('RANETRACE_EVENTS_QUEUE_NAME', 'default'),
'timeout' => env('RANETRACE_EVENTS_TIMEOUT', 10),
],
Each event includes:
php artisan ranetrace:test-events