PHPackages                             benmacha/mousetracker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. benmacha/mousetracker

ActiveSymfony-bundle[Framework](/categories/framework)

benmacha/mousetracker
=====================

Self-hosted mouse, click and scroll tracker for Symfony. Mouseflow-style heatmaps and session replay.

v2.1.0(1mo ago)2581[2 PRs](https://github.com/BenMacha/mouseTracker/pulls)MITJavaScriptPHP &gt;=8.1CI passing

Since Mar 10Pushed 4w ago1 watchersCompare

[ Source](https://github.com/BenMacha/mouseTracker)[ Packagist](https://packagist.org/packages/benmacha/mousetracker)[ RSS](/packages/benmacha-mousetracker/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (24)Versions (7)Used By (0)

MouseTrackerBundle
==================

[](#mousetrackerbundle)

[![CI](https://github.com/BenMacha/mouseTracker/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/BenMacha/mouseTracker/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/295a77744eb7d71d0185fd2573a5bec0afc758fc15bdac5a6ed0be80cc0b031e/68747470733a2f2f706f7365722e707567782e6f72672f62656e6d616368612f6d6f757365747261636b65722f76657273696f6e)](https://packagist.org/packages/benmacha/mousetracker)[![Total Downloads](https://camo.githubusercontent.com/5b53c8d54ee67869e497326150b5ceeaebc48cc86e5e0d8cc19b2b6069af1f65/68747470733a2f2f706f7365722e707567782e6f72672f62656e6d616368612f6d6f757365747261636b65722f646f776e6c6f616473)](https://packagist.org/packages/benmacha/mousetracker)[![License](https://camo.githubusercontent.com/0eba22693576c6ad5650b675f6d0a4542e72a4a1f01f7f93dc1595769030b851/68747470733a2f2f706f7365722e707567782e6f72672f62656e6d616368612f6d6f757365747261636b65722f6c6963656e7365)](https://packagist.org/packages/benmacha/mousetracker)

Self-hosted mouse, click and scroll tracker for **Symfony 5.4 / 6.4 / 7.x**. Captures mousemoves, clicks, scroll positions, form-blur values and DOM snapshots, then ships them to your own database for Mouseflow-style heatmaps and session replay. **No jQuery.**

Requirements
------------

[](#requirements)

PackageVersionPHP`>=8.1`Symfony`^5.4 | ^6.4 | ^7.0`Doctrine ORM`^2.14 | ^3.0`Installation
------------

[](#installation)

```
composer require benmacha/mousetracker:^2.0
```

If you don't use Symfony Flex, register the bundle in `config/bundles.php`:

```
return [
    // ...
    benmacha\mousetracker\TrackerBundle::class => ['all' => true],
];
```

### Routing

[](#routing)

`config/routes/mouse_tracker.yaml`:

```
mouse_tracker:
    resource: '@TrackerBundle/Resources/config/routes.yaml'
    prefix: /tracker
```

### Configuration (optional)

[](#configuration-optional)

`config/packages/mouse_tracker.yaml`:

```
mouse_tracker:
    record_click: true
    record_move: true
    record_keyboard: true
    percentage_recorded: 100
    disable_mobile: false
    ignore_ips: []
```

### Database

[](#database)

```
php bin/console doctrine:schema:update --force
# or, with migrations:
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
```

This creates three tables: `tracker__client`, `tracker__page`, `tracker__data`.

### Publish assets

[](#publish-assets)

```
php bin/console assets:install --symlink public/
```

Copies the tracker JavaScript to `public/bundles/tracker/js/tracker.js`.

Usage
-----

[](#usage)

Inject the tracker snippet right before the closing `` tag of any page you want to record:

```
{# templates/base.html.twig #}
        {{ mouse_tracker_service.build()|raw }}

```

Expose the service as a Twig global in `config/packages/twig.yaml`:

```
twig:
    globals:
        mouse_tracker_service: '@mouse_tracker'
```

That's it — the tracker boots on `DOMContentLoaded` and starts batching events to `/tracker/createClient` and `/tracker/addData`.

Backend (replay UI)
-------------------

[](#backend-replay-ui)

The bundle ships a basic backend at `/tracker/back/` for listing sessions and replaying recordings.

> ⚠️ **Security — read this before deploying.**The `/tracker/back/*` routes (replay UI + `getPages`/`getClients`/`getData` JSON endpoints) are **public by default**. Anyone who can reach your app can browse every recorded session, including form values, click coordinates, and DOM snapshots — which often contain PII.
>
> Gate them behind your `security.yaml` firewall before you ship. Example:
>
> ```
> # config/packages/security.yaml
> security:
>     access_control:
>         - { path: ^/tracker/back, roles: ROLE_ADMIN }
>         # the ingest endpoints below must stay reachable from the public site
>         - { path: ^/tracker, roles: PUBLIC_ACCESS }
> ```
>
>
>
> The same goes for GDPR/consent: `/tracker/createClient` and `/tracker/addData` are intentionally public so the tracker can post from any page, but you are responsible for getting visitor consent before loading `tracker.js`.

Settings
--------

[](#settings)

Client-side settings are forwarded from PHP config into a `window.MouseTrackerConfig.settings` blob. You can also override them after the script loads via `UST.settings`:

```

    window.UST && (UST.settings.delay = 100);

```

KeyDefaultDescription`record_click``true`Record left/right clicks`record_move``true`Record mousemove heatmap data`record_keyboard``true`Capture input/textarea values on blur (never `password`)`percentage_recorded``100`% of visitors to sample`disable_mobile``false`Skip recording on mobile UAs`ignore_ips``[]`IP allowlist via `l2.io/ip.js` (opt-in)Upgrading from 1.x
------------------

[](#upgrading-from-1x)

v2 is a breaking rewrite. See [`CHANGELOG.md`](CHANGELOG.md) for the migration path. Highlights:

- Drops Symfony 2.8, Assetic, Sensio Framework Extra Bundle, jQuery
- Doctrine/route annotations replaced with PHP 8 attributes
- `services.yml` → `services.yaml`; new `routes.yaml` resource
- `mousetrackerService` global → `mouse_tracker_service`
- Tracker JS is now plain vanilla — no jQuery to load first

License
-------

[](#license)

MIT — see [`Resources/meta/LICENSE`](Resources/meta/LICENSE).

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance94

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1120 days

Total

4

Last Release

31d ago

Major Versions

1.0.0 → v2.0.02026-05-19

PHP version history (2 changes)1.0.0PHP &gt;=5.3.9

v2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d129db1925fcb94a290ff38ccd08cd4cb14074d013b94a23b01f0f506a47709?d=identicon)[BenMacha](/maintainers/BenMacha)

---

Top Contributors

[![BenMacha](https://avatars.githubusercontent.com/u/5999976?v=4)](https://github.com/BenMacha "BenMacha (43 commits)")

---

Tags

flowframeworkheatmapmouse-eventsmouse-trackingsymfonysymfony-bundlesymfony2symfonyanalyticsSymfony BundlegdprprivacyuxtrackerSession Replaymouseself hostedheatmapuser-behaviorhotjarmouseflowclick-trackingscroll-trackingsession-recording

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/benmacha-mousetracker/health.svg)

```
[![Health](https://phpackages.com/badges/benmacha-mousetracker/health.svg)](https://phpackages.com/packages/benmacha-mousetracker)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M373](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M462](/packages/pimcore-pimcore)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)[oro/platform

Business Application Platform (BAP)

642140.7k104](/packages/oro-platform)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
