- Can I use benmacha/mousetracker in Laravel instead of Symfony?
- No, this package is designed exclusively for Symfony 5.4–7.x and relies on Symfony’s AbstractController, Doctrine ORM, and Twig. Porting it to Laravel would require rewriting core components like the TrackerBundle, Configuration, and Twig service integration. Consider Laravel alternatives like **spatie/laravel-analytics** or **Hotjar** for session replay.
- What Laravel alternatives exist for mouse/click tracking?
- For Laravel, explore **Hotjar** (SaaS), **Mouseflow** (SaaS), or self-hosted options like **Laravel Analytics** (spatie/laravel-analytics) for basic tracking. For session replay, **Laravel Nova’s built-in analytics** or custom solutions using **Laravel Echo + Pusher** could work. No direct Laravel port of this package exists.
- How do I install benmacha/mousetracker in Symfony?
- Run `composer require benmacha/mousetracker:^2.0`, register the bundle in `config/bundles.php`, set up routes in `config/routes/mouse_tracker.yaml`, configure tracking in `config/packages/mouse_tracker.yaml`, and run `php bin/console doctrine:schema:update` or migrations. Finally, publish assets with `assets:install` and inject the Twig snippet before `</body>`.
- Does benmacha/mousetracker support Laravel’s Eloquent ORM?
- No, the package uses Doctrine ORM entities (Client, Page, Data) with Symfony-specific features like `#[Route]` and `ServiceEntityRepository`. Converting to Eloquent would require rewriting the database schema, migrations, and repository logic, which isn’t officially supported.
- How does benmacha/mousetracker handle GDPR/cookie consent?
- The package lacks built-in GDPR compliance. It uses client-side `UST.settings` for consent but doesn’t integrate with Laravel’s cookie consent tools (e.g., `laravel-cookie-consent`). You’d need to manually sync consent logic or use a third-party solution like **OneTrust** or **Cookiebot**.
- Can I disable tracking for mobile users in Laravel?
- The package supports `disable_mobile: true` in Symfony, but Laravel integration isn’t possible without refactoring. For Laravel, use JavaScript to detect mobile devices and conditionally load tracking scripts, or rely on a SaaS alternative like **Hotjar**, which offers built-in mobile filtering.
- What Laravel versions are compatible with benmacha/mousetracker?
- This package is **not compatible with Laravel**—it’s Symfony-only. Even if you ported it, Symfony 7.x (PHP 8.1+) doesn’t guarantee Laravel 10.x/11.x (PHP 8.3+) parity. For Laravel, target **Laravel 9.x/10.x** with custom solutions or SaaS tools.
- How do I configure sampling (e.g., track 10% of sessions) in Laravel?
- The package’s `percentage_recorded` config works in Symfony, but Laravel lacks native integration. For Laravel, implement sampling via middleware (e.g., `if (rand(0, 99) < 10)`) or use queue jobs with probabilistic processing. Alternatives like **Sentry** or **LogRocket** offer built-in sampling.
- Does benmacha/mousetracker work with Laravel’s Livewire/Inertia?
- No, the package’s frontend relies on Symfony’s Twig `mouse_tracker_service.build()` and vanilla JS fetching `/tracker/createClient`. Livewire/Inertia would conflict with this architecture. For Laravel, use **Alpine.js** to conditionally load tracking scripts or opt for a SaaS solution with Livewire compatibility.
- What’s the performance impact of benmacha/mousetracker in production?
- In Symfony, the package uses Doctrine migrations and `percentage_recorded` to limit data volume. In Laravel, performance depends on your custom implementation. Expect higher overhead for session replay (DOM snapshots, keyboard input) compared to lightweight analytics tools like **Google Analytics** or **Plausible**. Test with tools like **Blackfire** or **Laravel Debugbar**.