moirei / event-tracking
将应用事件发送到分析服务和数据仓库。
0.3.0
2023-06-07 23:05 UTC
Requires
- php: ^8.0
- illuminate/contracts: ^7|^8|^9
- illuminate/support: ^7|^8|^9
- laravel/helpers: ^1.5
- sinergi/browser-detector: ^6.1
Requires (Dev)
- illuminate/contracts: ^7|^8|^9
- laravel/pint: ^1.2
- mixpanel/mixpanel-php: ^2.10
- orchestra/testbench: ^7.5
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.2
- phpunit/phpunit: ^9.5
- posthog/posthog-php: ^3.0
- spatie/invade: ^1.1
- theiconic/php-ga-measurement-protocol: ^2.9
- thled/pest-plugin-shorthands: ^1.1
Suggests
- mixpanel/mixpanel-php: Required to use in-built Mixpanel Channel
- theiconic/php-ga-measurement-protocol: Required to use in-built GA Channel
README
此包允许您将应用事件发送到分析服务和您选择的任何数据仓库。虽然受到Analytics.io和Segment的启发,但它应该为您提供对事件及其手动或自动处理方式的更多灵活性。
文档
所有文档均可在文档网站找到。
特性
- 轻松发送事件到多个分析渠道
- 每个渠道每个事件灵活的事件名称和属性映射
- 自动捕获和跟踪本地和供应商事件
- 捕获和跟踪可观察模型事件
- 使用PHP枚举作为事件名称
- 使用队列异步发送事件
示例
跟踪事件
Events::track('Purchase', $order); // or auto track app events // Somewhere in your app Events::listen(OrderPlacedEvent::class); // Elsewhere in your app OrderPlacedEvent::dispatch($order);
识别和更新用户配置文件
Events::identify($user->id, [ 'name' => $user->name, 'email' => $user->email, 'phone' => $user->phone, 'city' => $user->city, 'country' => $user->country, "Favorite Color" => $user->favoriteColor, ]);
安装
composer require moirei/event-tracking
发布配置
php artisan vendor:publish --tag="event-tracking"
测试
composer test