Weave 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
Laravel Analytics Event Tracking

Laravel Analytics Event Tracking Laravel Package

protonemedia/laravel-analytics-event-tracking

Laravel Analytics Event Tracking lets you track user events and page views in your Laravel app, storing them locally or sending them to Google Analytics. Simple configuration, middleware support, and a clean API for logging custom events.

View on GitHub
Deep Wiki
Context7

Laravel package to easily send events to Google Analytics

Frequently asked questions about Laravel Analytics Event Tracking
How do I install protonemedia/laravel-analytics-event-tracking in a Laravel app?
Install it with composer require protonemedia/laravel-analytics-event-tracking. Laravel's package auto-discovery registers the service provider and the Analytics facade, so there is no manual wiring in config/app.php. Publish the config file with the vendor:publish command and add your Google Analytics credentials there. There are no migrations or schema changes to run, which makes the package easy to add and easy to remove.
Which Laravel and PHP versions does this package support?
The final release, 1.6.0 from February 2023, targets Laravel 10 and requires PHP 8.1 or newer; PHP 8.0 support was dropped in what was published as a minor version, which is worth noting for semver expectations. Laravel 11 and 12 shipped after the repository was archived, so they will never be officially supported. Inspect the composer.json constraints on illuminate/support before installing to see whether a newer major is hard-blocked or simply untested.
Does laravel-analytics-event-tracking work with Google Analytics 4 and Measurement Protocol v2?
This is unverified and is the single biggest risk in adopting the package. It was released before the Universal Analytics sunset in July 2023, and GA4 uses Measurement Protocol v2 with a materially different payload shape than UA-era events. Measurement Protocol accepts invalid events and silently discards them, so a 2xx response is not proof of success. Run a spike against a live GA4 property and inspect the emitted payload before committing to the dependency.
Is protonemedia/laravel-analytics-event-tracking still maintained?
No. The GitHub repository is archived, the last tagged release is 1.6.0 from 2023-02-21, and no further releases, security patches, or framework alignment updates will be published. It also has zero dependents, meaning nobody downstream is surfacing bugs or maintaining a de facto fork. Treat it as frozen source code you would own, not as a maintained upstream dependency.
How do I track a custom event with the Analytics facade?
Resolve the Analytics facade or inject it, then log an event by name with an array of parameters describing the action. The package includes an event-mapping layer so you can keep application-specific event names decoupled from what is sent to Google Analytics. Dispatch goes through the queue, so the call returns immediately rather than blocking the request. Wrap the facade behind your own interface if you want the ability to swap or fake it later.
Can it track page views automatically with middleware?
Yes. The package ships middleware support so page views can be captured without adding tracking calls to every controller, and you register it globally or on a route group. The same configuration controls whether events are recorded locally or forwarded to Google Analytics. Because it hooks into the HTTP layer, be deliberate about which routes the middleware covers to avoid noise from health checks or API endpoints.
Does analytics event tracking slow down my Laravel requests?
Event dispatch is queued, so the outbound call to Google Analytics does not sit on the request's critical path and the user response is not waiting on it. You still need a running queue worker, and any network latency or failures happen there rather than in the request. If the queue backs up, events are delayed rather than delivered instantly, so monitor worker health if measurement freshness matters.
Will this package work on Laravel 11 or Laravel 12?
Not officially, and it never will be, because the repository is archived with no further releases planned. Composer may or may not block the install depending on the constraint in composer.json, but passing the dependency resolver is not the same as being supported. Your realistic options are pinning the application to Laravel 10, running the package unsupported on a newer major, or forking it.
How can I verify that events are actually reaching Google Analytics?
Do not rely on HTTP status codes, because Measurement Protocol returns success even when it silently drops an invalid payload. Validate the payload shape against the Measurement Protocol v2 documentation and confirm delivery in GA4 DebugView using the debug endpoint against a test property. Add assertions on the generated payload in your own test suite so future framework or config changes are caught. Backing the facade with your own interface makes it trivial to fake in tests and to swap implementations later.
Is there a maintained alternative or should I fork this package?
There is no known maintained community fork, and the package has zero dependents, so you would be the sole QA for it. The upside is that it is a thin wrapper around server-side analytics transport, so the underlying Measurement Protocol client is likely only a few hundred lines to reimplement. For most teams the cheaper path is building a small GA4-native implementation behind your own interface, or forking this one and naming an internal owner with a documented trigger for replacement.
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.
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle