PHPackages                             jackfumanchu/cookieless-analytics-bundle - 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. [Admin Panels](/categories/admin)
4. /
5. jackfumanchu/cookieless-analytics-bundle

ActiveSymfony-bundle[Admin Panels](/categories/admin)

jackfumanchu/cookieless-analytics-bundle
========================================

Lightweight, cookieless, GDPR-compliant analytics bundle for Symfony 6.4+

v0.4.0(3mo ago)08[16 issues](https://github.com/jackfumanchu/cookieless-analytics-bundle/issues)MITPHPPHP &gt;=8.2CI passing

Since Apr 13Pushed 3mo agoCompare

[ Source](https://github.com/jackfumanchu/cookieless-analytics-bundle)[ Packagist](https://packagist.org/packages/jackfumanchu/cookieless-analytics-bundle)[ RSS](/packages/jackfumanchu-cookieless-analytics-bundle/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (21)Versions (8)Used By (0)

CookielessAnalytics
===================

[](#cookielessanalytics)

[![CI](https://github.com/jackfumanchu/cookieless-analytics-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/jackfumanchu/cookieless-analytics-bundle/actions/workflows/ci.yml/badge.svg)[![codecov](https://camo.githubusercontent.com/84332c393620bf8f9a3da1c083f6edd1359e6c52498c610560f21e84dd234474/68747470733a2f2f636f6465636f762e696f2f6769746875622f6a61636b66756d616e6368752f636f6f6b69656c6573732d616e616c79746963732d62756e646c652f67726170682f62616467652e7376673f746f6b656e3d4d4a5937493343444837)](https://codecov.io/github/jackfumanchu/cookieless-analytics-bundle)[![Mutation testing badge](https://camo.githubusercontent.com/ea44ec574de53520da56a69cfd6a49155aed8c9054dfb8b153be9c1d64cb684c/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532466a61636b66756d616e636875253246636f6f6b69656c6573732d616e616c79746963732d62756e646c652532466d61696e)](https://dashboard.stryker-mutator.io/reports/github.com/jackfumanchu/cookieless-analytics-bundle/main)[![PHPStan](https://camo.githubusercontent.com/bbb4b88ceed026f420c1d76bc64e1ce076ed7382a9f5bac1cd59d85d807e7af4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230362d627269676874677265656e)](https://camo.githubusercontent.com/bbb4b88ceed026f420c1d76bc64e1ce076ed7382a9f5bac1cd59d85d807e7af4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230362d627269676874677265656e)[![PHP](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)[![Symfony](https://camo.githubusercontent.com/18d244ff55bdd63a6f0a7018b0a5c195c2c1cd904559bf839bc2fa8aff90734a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d372e342532422d626c61636b)](https://camo.githubusercontent.com/18d244ff55bdd63a6f0a7018b0a5c195c2c1cd904559bf839bc2fa8aff90734a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d372e342532422d626c61636b)

A lightweight, self-hosted, **cookieless** analytics bundle for Symfony 7.4+.

No cookies. No consent banner. No external service. Full GDPR compliance out of the box.

Tracks page views, daily visitors, and custom events (e.g. booking clicks) using a daily-rotated anonymous fingerprint — no personal data is ever stored.

---

Features
--------

[](#features)

- ✅ **Cookieless by design** — no consent banner required under GDPR/ePrivacy
- ✅ **Self-hosted** — all data stays on your own server
- ✅ **Multi-database** — supports PostgreSQL, MySQL, and SQLite
- ✅ **Daily visitors per page** — via anonymous daily fingerprint (IP + User-Agent, hashed and rotated)
- ✅ **Referrer tracking** — see where your visitors come from, with domain extraction
- ✅ **Custom event tracking** — track any click or interaction with a `data-` attribute
- ✅ **Standalone dashboard** — built-in analytics UI, no EasyAdmin required
- ✅ **Multi-site ready** — one bundle installation per Symfony app
- ✅ **Lightweight script** — under 1 KB injected into your pages

---

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

[](#requirements)

- PHP 8.2+
- Symfony 6.4, 7.4 or 8.x
- Doctrine ORM 3.x
- PostgreSQL 12+, MySQL 5.7+ / MariaDB 10.3+, or SQLite 3

---

Installation
------------

[](#installation)

```
composer require jackfumanchu/cookieless-analytics-bundle
php bin/console cookieless:install
```

The `cookieless:install` command creates the required database tables. It is safe to run multiple times — on subsequent runs it will apply any schema updates or report that nothing changed.

---

Quick Start
-----------

[](#quick-start)

### 1. Enable the bundle

[](#1-enable-the-bundle)

Register the bundle in your application:

```
// config/bundles.php
return [
    // ...
    Jackfumanchu\CookielessAnalyticsBundle\CookielessAnalyticsBundle::class => ['all' => true],
];
```

### 2. Add the tracking script to your base template

[](#2-add-the-tracking-script-to-your-base-template)

```
{# templates/base.html.twig — before  #}
{{ cookieless_analytics_script() }}
```

This injects a minimal inline script (under 1 KB) that sends a beacon on each page load and listens for custom event attributes.

### 3. Track a custom event (e.g. a booking button)

[](#3-track-a-custom-event-eg-a-booking-button)

Add `data-ca-event` and optionally `data-ca-value` to any HTML element:

```

    Book now →

```

No JavaScript required on your side — the bundle's script handles everything.

---

Configuration
-------------

[](#configuration)

Create `config/packages/cookieless_analytics.yaml`:

```
cookieless_analytics:

    # Exclude paths from tracking (regex patterns)
    exclude_paths:
        - '^/admin'
        - '^/_'
        - '^/api'

    # Enable or disable the built-in dashboard
    dashboard_enabled: true

    # Route prefix for the dashboard (default: /analytics)
    dashboard_prefix: '/analytics'

    # Role required to access the dashboard
    dashboard_role: 'ROLE_ANALYTICS'
```

---

Accessing the Dashboard
-----------------------

[](#accessing-the-dashboard)

Once installed and configured, visit:

```
https://your-site.com/analytics

```

Access is restricted to users with the configured role (default: `ROLE_ANALYTICS`). Assign this role to users who should see analytics, or use Symfony's role hierarchy to link it to `ROLE_ADMIN`.

### Dashboard setup

[](#dashboard-setup)

The dashboard requires Symfony UX Turbo for interactive features (lazy-loading widgets, live search, detail pane navigation). Data collection works without it.

```
composer require symfony/ux-turbo
php bin/console importmap:require uplot
```

To use your own layout (with your app's navbar, footer, etc.), set `dashboard_layout` to your base template:

```
cookieless_analytics:
    dashboard_layout: 'base.html.twig'
```

### What the dashboard shows

[](#what-the-dashboard-shows)

SectionDescription**Overview**Total page views and daily visitors for the selected period**Top pages**Most visited URLs with daily visitor counts**Events**Custom events ranked by count, with distinct value counts**Trends**Daily page view and daily visitor chart for the selected period---

How anonymization works
-----------------------

[](#how-anonymization-works)

No cookie, no session ID, no persistent identifier is ever stored.

Each request generates a **daily fingerprint**:

```
SHA-256( client_ip + user_agent + YYYY-MM-DD )

```

This hash:

- **changes every day** — a returning visitor cannot be tracked across days
- **is not reversible** — the original IP address cannot be recovered
- **is not personal data** under GDPR — no individual can be singled out

Because the fingerprint rotates daily, the "Daily Visitors" metric is deduplicated **within a single day only**. Over a multi-day period, the same person visiting on different days is counted once per day — not once for the entire period. This is a deliberate privacy tradeoff: it prevents long-term tracking at the cost of cross-day deduplication.

This approach is consistent with the CNIL guidelines on cookieless audience measurement (délibération n°2020-091).

---

Custom Event Tracking Reference
-------------------------------

[](#custom-event-tracking-reference)

AttributeRequiredDescription`data-ca-event`✅Event name (e.g. `booking-click`, `download`, `outbound-link`)`data-ca-value`optionalContextual value (e.g. event title, file name, URL)Events are sent via `navigator.sendBeacon()` — non-blocking, fires even if the user navigates away immediately.

---

Privacy &amp; Legal
-------------------

[](#privacy--legal)

This bundle is designed to operate **without a cookie consent banner** under the following conditions:

1. The tracking script does not set any cookie.
2. No personal data (name, email, IP address, persistent identifier) is stored.
3. Data is processed exclusively on your own server.
4. The purpose is strictly limited to anonymous audience measurement.

> **Disclaimer:** This bundle is provided as-is. You remain responsible for your own GDPR compliance. Consult your DPO or legal counsel if you have specific regulatory obligations.

---

Roadmap
-------

[](#roadmap)

- CSV/JSON data export
- Bot and crawler filtering
- UTM campaign parameter tracking
- Weekly summary email report
- Dashboard without Turbo (static fallback)
- Symfony Flex recipe (auto-configure, post-install message)

---

Contributing
------------

[](#contributing)

Contributions are welcome. Please open an issue before submitting a pull request.

```
git clone https://github.com/jackfumanchu/cookieless-analytics-bundle.git
cd cookieless-analytics-bundle
composer install
php vendor/bin/phpunit
```

---

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance81

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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 ~0 days

Total

7

Last Release

101d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29048875?v=4)[Pierre Jacquier](/maintainers/jackfumanchu)[@jackfumanchu](https://github.com/jackfumanchu)

---

Top Contributors

[![jackfumanchu](https://avatars.githubusercontent.com/u/29048875?v=4)](https://github.com/jackfumanchu "jackfumanchu (175 commits)")

---

Tags

symfonyeventstrackingdashboardanalyticsgdprprivacypage viewscookieless

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jackfumanchu-cookieless-analytics-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/jackfumanchu-cookieless-analytics-bundle/health.svg)](https://phpackages.com/packages/jackfumanchu-cookieless-analytics-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M400](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M754](/packages/sylius-sylius)[open-dxp/opendxp

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

9421.6k64](/packages/open-dxp-opendxp)[pimcore/pimcore

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

3.8k3.8M511](/packages/pimcore-pimcore)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

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