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 Gamp

Laravel Gamp Laravel Package

irazasyed/laravel-gamp

Laravel GAMP is a Laravel wrapper for Google Analytics Measurement Protocol, enabling server-side tracking of events, page views, and ecommerce transactions. It offers a simple, fluent API to send analytics hits from your backend without client-side JavaScript.

View on GitHub
Deep Wiki
Context7

📊 Laravel Google Analytics Measurement Protocol Package

Frequently asked questions about Laravel Gamp
How do I install irazasyed/laravel-gamp in a Laravel app?
Install it with Composer using composer require irazasyed/laravel-gamp. Laravel's package auto-discovery registers the service provider and facade, then you publish the config file and set your Google Analytics tracking ID. From there you can call the facade to dispatch page views, events, or ecommerce hits from server-side code. Integration effort is low, but confirm the package targets the endpoint your property actually uses before wiring it into production.
Does laravel-gamp support GA4 and the Measurement Protocol v2?
Treat this as unverified until you read the tagged source. The package was built around the Universal Analytics Measurement Protocol using the google-analytics.com/collect endpoint, v=1, and a UA- tracking ID, and Universal Analytics stopped processing hits in July 2023. GA4 requires the /mp/collect endpoint plus api_secret and client_id, so a Laravel 10 compatibility release does not by itself prove GA4 support. Inspect composer.json and the service provider in v1.10 before assuming hits will register in a GA4 property.
Which Laravel and PHP versions does laravel-gamp v1.10 support?
Version 1.10 is a Laravel 10 compatibility release driven by a single pull request, so expect Laravel 10 support and PHP 8.1 or newer. Check composer.json to see whether the illuminate/support constraint was widened to include Laravel 9 or replaced with ^10.0, because a replacement is effectively a breaking change despite the patch version number. If any service still runs PHP 8.0 or Laravel 9, you may need to stay on v1.9.
How do I send a server-side event or page view with laravel-gamp?
The package exposes a fluent facade-style API for dispatching Measurement Protocol hits from your backend. Typical usage is to call the facade with an event category, action, label, or a page view payload, then send it during a request or from a queued job. The exact method names and payload shape should be confirmed against the README and source for your installed version. The package is a thin convenience wrapper, so the underlying HTTP call is simple to reproduce yourself if needed.
Why are my Google Analytics hits not showing up in GA4 reports?
The Measurement Protocol returns HTTP 204 with no body even when a payload is rejected, so misconfiguration looks like silence rather than an error. The most common cause is sending Universal Analytics v=1 hits to the dead collect endpoint instead of GA4's /mp/collect with api_secret and client_id. Use the GA4 debug endpoint and Realtime reports to confirm hits are accepted before relying on standard reports. Also verify that engagement_time_msec and session attribution fields are present when you expect session-level reporting.
Is irazasyed/laravel-gamp actively maintained?
The project is effectively single-maintainer with a low release cadence, and v1.10 consists of one pull request that bumps Laravel compatibility. That is a bus factor of one, with no visible test matrix beyond what is needed to merge. It can still be a reasonable convenience wrapper, but plan for the possibility that you will maintain a fork or replace it with a few lines of Laravel's HTTP client. Avoid making it the only path for business-critical analytics.
Can laravel-gamp queue analytics hits instead of sending them inline?
The package is a thin wrapper around outbound HTTP calls, so whether hits are queued depends on how you invoke it rather than on a built-in queue pipeline. The safer pattern is to dispatch your own Laravel job that calls the package, which keeps Google latency out of the request cycle and gives you retries. Confirm in the source whether any queue integration is provided in your installed version. If not, wrapping the call in a job is straightforward.
How does laravel-gamp handle the GA4 api_secret and client_id?
This is a key question to answer from the tagged source before adopting. GA4 Measurement Protocol v2 requires an api_secret tied to a data stream and a client_id that identifies the user or device, and session attribution also needs engagement_time_msec. If the v1.10 code still builds Universal Analytics v=1 payloads with a UA tracking ID, it does not handle api_secret or client_id at all. In that case, send GA4 hits directly with Http::post to /mp/collect and keep the secret in config or environment variables with a rotation plan.
What are the alternatives to laravel-gamp for server-side Google Analytics?
The most direct alternative is Laravel's HTTP client posting to the GA4 Measurement Protocol endpoint yourself, which removes a dependency and gives you full control over api_secret, client_id, and payload validation. Reporting-focused packages such as spatie/laravel-analytics solve a different problem and are not a drop-in replacement for sending hits. For higher-volume or warehouse-based analytics, an event pipeline outside Google Analytics is usually more robust than Measurement Protocol calls from the request cycle. Choose the wrapper only if you value the facade convenience more than the added dependency.
Is laravel-gamp safe for production ecommerce tracking?
Use it as a supplement to client-side tagging or a warehouse event stream, not as your primary analytics pipeline. Because rejected hits return 204 with no body, you get no validation signal, so consent handling, PII scrubbing, and deduplication against client-side gtag hits are your responsibility. Test with the GA4 debug endpoint and Realtime reports before trusting purchase or subscription events. Given the single-maintainer cadence and unresolved GA4 questions, keep a fallback path that does not depend on the package.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core