benmacha/mousetracker
Self-hosted mouse/click/scroll tracker for Symfony 5.4–7.x. Records mouse moves, clicks, scroll, keyboard, form-blur values, and DOM snapshots, storing sessions in your own DB for Mouseflow-style heatmaps and replay. No jQuery.
tracker__client, tracker__page, tracker__data) via Doctrine migrations. Laravel’s Eloquent and migrations would need to be mapped to these tables, which could introduce schema drift if not carefully managed./tracker/back/, which would need to be replaced or adapted for Laravel’s Blade templating system.tracker.js) must be injected into Laravel Blade templates (e.g., via @stack('scripts') or a service provider).mouse_tracker_service.build() Twig function would need a Laravel equivalent (e.g., a Blade directive or helper)./tracker/createClient and /tracker/addData endpoints must be exposed as Laravel routes (e.g., via Route::post('/tracker/createClient', ...)).Client, Page, Data) would need to be ported to Laravel Eloquent models.mouse_tracker: YAML config would need to be mapped to Laravel’s config/mouse_tracker.php.UST.settings JavaScript configuration would need to be exposed via Laravel’s asset pipeline (e.g., via a data-tracker-config attribute).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony-Laravel Gap | High | Abstract Symfony-specific code (e.g., AbstractController, #[Route]) into middleware or a facade layer. |
| Doctrine Migration | Medium | Use Laravel Schema Builder or Doctrine DBAL to replicate the three tables. |
| Twig → Blade | Medium | Replace Twig templates with Blade equivalents or use a templating bridge. |
| Security Misconfig | High | Ensure /tracker/back/* is gated behind Laravel middleware (e.g., auth:admin). |
| GDPR Compliance | High | Implement consent management (e.g., via a cookie banner) before loading tracker.js. |
| Performance Impact | Medium | Sample recordings (percentage_recorded) to avoid overwhelming the database. |
| JavaScript Conflicts | Low | Test tracker.js in Laravel’s asset pipeline for conflicts with existing JS. |
MouseTrackerServiceProvider)./tracker API endpoints.| Laravel Component | Compatibility Notes |
|---|---|
| PHP 8.1+ | ✅ Supported (Laravel 9+ requires PHP 8.1+). |
| Doctrine ORM | ⚠️ Partial: Laravel uses Eloquent by default. Can use Doctrine DBAL or port entities to Eloquent. |
| Symfony Bundle | ❌ Not natively supported. Requires abstraction (e.g., middleware, facade) or a fork. |
| Twig → Blade | ⚠️ Manual migration needed for /tracker/back/ UI. |
| Asset Pipeline | ✅ tracker.js can be published to public/js/ via Laravel Mix or Vite. |
| Routing | ✅ Laravel’s Route::post() can replicate Symfony’s #[Route] endpoints. |
| Middleware | ✅ Can gate /tracker/back/* with Laravel’s auth or custom middleware. |
| Configuration | ✅ Convert mouse_tracker.yaml to config/mouse_tracker.php. |
| JavaScript | ✅ Vanilla JS (no jQuery) should work in Laravel’s frontend. |
Phase 1: Proof of Concept (2-3 weeks)
AbstractController, #[Route]) with Laravel equivalents.Client, Page, and Data./tracker/createClient and /tracker/addData endpoints with a mock frontend.Phase 2: Frontend Integration (1 week)
tracker.js to Laravel’s public/js/ directory.@mouseTracker) to replace {{ mouse_tracker_service.build() }}.</body> in Laravel’s app.blade.php.Phase 3: Backend UI Adaptation (2 weeks)
/tracker/back/ with Blade equivalents./tracker/back/*.Phase 4: GDPR & Compliance (1 week)
Request object.Phase 5: Testing & Optimization (2 weeks)
tracker__data table.| Component | Compatibility Status | Notes |
|---|---|---|
| Symfony 5.4/6.4/7.x | ❌ No | Laravel is not Symfony, but the core logic (event batching, storage) can be ported. |
| Doctrine ORM | ⚠️ Partial | Use Eloquent or Doctrine DBAL for database operations. |
| Twig | ❌ No | Replace with Blade. The /tracker/back/ UI will need manual adaptation. |
| JavaScript | ✅ Yes | Vanilla JS with fetch is compatible with Laravel’s frontend. |
| Asset Pipeline | ✅ Yes | tracker.js can be compiled with Laravel Mix/Vite. |
| Security | ✅ Adaptable | Laravel’s middleware can replicate Symfony’s access_control. |
1
How can I help you explore Laravel packages today?