Download the PHP package tourze/user-track-bundle without Composer
On this page you can find all versions of the php package tourze/user-track-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/user-track-bundle
More information about tourze/user-track-bundle
Files in tourze/user-track-bundle
Package user-track-bundle
Short Description A Symfony bundle for tracking and recording user behavior across your application
License MIT
Informations about the package user-track-bundle
UserTrackBundle
中文
A Symfony bundle for tracking and recording user behavior across your application. Provides automatic event tracking, manual tracking via JSON-RPC, and built-in log rotation.
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Advanced Usage
- Configuration
- JSON-RPC API Reference
- Use Cases
- Testing
- Security
- Contributing
- License
Features
- Automatic Event Tracking: Automatically captures
UserInteractionEventevents - Asynchronous Storage: Uses async insertion to avoid impacting main business performance
- JSON-RPC Interface: Manual behavior tracking through RPC endpoint
- Automatic Log Cleanup: Built-in scheduled cleanup of expired logs (configurable retention period)
- Customer Radar Support: Provides data foundation for CRM customer radar functionality
- Flexible Event Parameters: Support for custom tracking parameters through interfaces
- Distributed Lock Support: Prevents duplicate submissions in distributed environments
Requirements
- PHP 8.1+
- Symfony 6.4+
- tourze/user-event-bundle
- tourze/doctrine-snowflake-bundle
- tourze/doctrine-ip-bundle
Installation
Quick Start
1. Register the Bundle
2. Automatic Event Tracking
Any UserInteractionEvent dispatched in your application will be automatically tracked:
3. Manual Tracking via JSON-RPC
Advanced Usage
Custom Tracking Parameters
Implement TrackContextInterface in your events to provide additional tracking parameters:
Extending RPC Response
Listen to TrackLogReportEvent to modify the RPC response:
Configuration
Environment Variables
Automatic Cleanup
Logs are automatically cleaned up daily at 2:20 AM. The retention period can be configured
via the CLEAN_TRACK_LOG_DAY_NUM environment variable.
JSON-RPC API Reference
SubmitCrmTrackLog
Submit a user behavior tracking log.
Parameters:
event(string, required): Event name (e.g., "page.view", "button.click")params(array, optional): Event parameters as key-value pairs
Response:
Authentication: Requires authenticated user (IS_AUTHENTICATED)
Use Cases
- User Behavior Analytics: Track page views, clicks, feature usage
- Customer Radar: Real-time customer activity tracking for CRM
- Marketing Automation: Trigger marketing campaigns based on user behavior
- Security Auditing: Record audit logs for sensitive operations
- Product Optimization: Analyze user behavior data to improve features
Testing
Run tests from the monorepo root:
Test Coverage
- [x] Entity tests - Complete coverage of TrackLog entity
- [x] Event tests - TrackLogReportEvent and TrackContext interface
- [x] Event Subscriber tests - UserTrackListener behavior
- [x] RPC Procedure tests - SubmitCrmTrackLog endpoint
- [x] DI Extension tests - Service registration and configuration
- [x] Bundle tests - Bundle initialization
Security
Authentication
All JSON-RPC endpoints require authenticated users. User tracking data is stored with IP address information for security auditing purposes.
Data Protection
- User tracking data is automatically cleaned up based on configured retention period
- IP addresses are stored for security purposes and follow the same retention policy
- All user input is validated before storage
Best Practices
- Review tracking parameters to avoid storing sensitive information
- Use appropriate retention periods for compliance requirements
- Monitor tracking data for unusual patterns that might indicate security issues
Contributing
Contributions are welcome! Please ensure:
- All tests pass
- Code follows PSR-12 standards
- New features include tests
- Documentation is updated
License
The MIT License (MIT). Please see License File for more information.
All versions of user-track-bundle with dependencies
doctrine/doctrine-bundle Version ^2.13
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
easycorp/easyadmin-bundle Version ^4
knplabs/knp-menu Version ^3.7
monolog/monolog Version ^3.1
nesbot/carbon Version ^2.72 || ^3
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/event-dispatcher-contracts Version ^3
symfony/framework-bundle Version ^7.3
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/routing Version ^7.3
symfony/security-bundle Version ^7.3
symfony/security-core Version ^7.3
symfony/security-http Version ^7.3
symfony/yaml Version ^7.3
tourze/arrayable Version 1.*
tourze/bundle-dependency Version 1.*
tourze/doctrine-async-insert-bundle Version 1.0.*
tourze/doctrine-indexed-bundle Version 1.0.*
tourze/doctrine-ip-bundle Version 1.1.*
tourze/doctrine-snowflake-bundle Version 1.1.*
tourze/easy-admin-menu-bundle Version 1.0.*
tourze/json-rpc-core Version 1.0.*
tourze/json-rpc-lock-bundle Version 1.0.*
tourze/symfony-dependency-service-loader Version 1.0.*
tourze/symfony-routing-auto-loader-bundle Version 1.0.*
tourze/symfony-schedule-entity-clean-bundle Version 1.1.*
tourze/user-event-bundle Version 1.0.*
tourze/user-id-bundle Version 1.0.*
yiisoft/json Version ^1.0