Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Mousetracker

Mousetracker Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Symfony Mouse Tracker

Frequently asked questions about Mousetracker
Can I use this package directly in Laravel without Symfony?
No, this package is a Symfony bundle and requires significant adaptation for Laravel. You’ll need to abstract Symfony-specific code (e.g., Doctrine ORM, Twig templates) into Laravel-compatible layers like Eloquent models, Blade directives, and middleware. Consider forking or building a wrapper.
What Laravel versions does this package support?
This package doesn’t natively support Laravel, but it requires PHP 8.1+, which aligns with Laravel 9+. You’d need to manually integrate it with Laravel’s ecosystem (e.g., Eloquent, Blade, and routing) for compatibility.
How do I install this in Laravel if it’s a Symfony bundle?
Install via Composer (`composer require benmacha/mousetracker`), then manually map Symfony components to Laravel equivalents. Replace Doctrine migrations with Laravel Schema Builder, adapt Twig templates to Blade, and expose Symfony routes as Laravel API endpoints using middleware or facades.
Does this package work with Laravel’s Eloquent ORM?
No, it uses Doctrine ORM by default. You’d need to either port the three tables (`tracker__client`, `tracker__page`, `tracker__data`) to Eloquent models or use Doctrine DBAL as a bridge. Schema drift is a risk if not managed carefully.
How do I integrate the JavaScript tracker in Laravel Blade templates?
Replace the Twig `mouse_tracker_service.build()` function with a Laravel Blade directive or helper (e.g., `@mouseTracker()`). Inject the `tracker.js` file via `@stack('scripts')` or a service provider, ensuring it loads before `</body>` like the Symfony example.
What are the GDPR/privacy risks of storing DOM snapshots and form values?
DOM snapshots and form values may include personally identifiable information (PII). Implement a consent management system (e.g., cookie banners) before loading `tracker.js`, and anonymize or purge data regularly. Consider Laravel’s built-in encryption for sensitive fields.
Is there a built-in replay UI for Laravel, or do I need to rebuild it?
The package includes a Symfony Twig-based replay UI under `/tracker/back/`. You’d need to replace it with Blade templates or use a templating bridge. Alternatively, build a custom Laravel admin panel to visualize the recorded data via Eloquent queries.
What alternatives exist for Laravel if this package requires too much effort?
Consider Laravel-native alternatives like Hotjar API (third-party), Plausible Analytics (lightweight), or building a lightweight tracker using Laravel Echo for real-time event logging. Packages like `spatie/analytics` or `laravel-analytics` may also fit simpler use cases.
How do I configure sampling (e.g., record only 10% of sessions) in Laravel?
The `percentage_recorded` setting in Symfony’s config (e.g., `10`) controls sampling. In Laravel, expose this via `config/mouse_tracker.php` and pass it to the JavaScript tracker using a data attribute (e.g., `data-tracker-config`). Ensure the backend respects this setting during data ingestion.
What testing approach should I use for this integration?
Test the Laravel service layer with PHPUnit (e.g., mocking API endpoints), verify the `/tracker` routes with Pest or Laravel Dusk, and manually check the replay UI (if adapted). Use browser automation tools like Playwright to simulate user interactions and validate recorded data.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor