- How do I install and configure luketowers/laravel-ga4-event-tracking?
- Install it with Composer using composer require luketowers/laravel-ga4-event-tracking, then publish the package config file. You supply a GA4 measurement ID and a Measurement Protocol API secret per environment, typically via your .env file, and then dispatch events through the package's fluent API. There are no migrations or schema changes, so a first working event is usually well under a day of work, with most of that time spent verifying payloads in GA4 DebugView.
- Which Laravel and PHP versions does this package support?
- Version 2.2.1 is a Laravel 13 compatibility release, so it is the version to use if you are upgrading to Laravel 13. Because patch releases sometimes widen the illuminate/* constraint without dropping older majors, read the composer.json constraints directly to confirm whether Laravel 10, 11 and 12 are still supported and what the PHP floor is. Check that matrix against your runtime before committing to the dependency.
- Can I send server-side GA4 events for refunds, webhooks and offline conversions?
- Yes, that is the primary use case. The package sits at the outbound edge of your application and sends events straight to the GA4 Measurement Protocol, so it works for things that never touch a pageview: refunds, subscription changes, back-office actions, webhook-driven conversions and other offline events. It is also a good fallback when client-side gtag is unreliable due to ad blockers or consent-gated browsers.
- Are events sent inline on the request or can they be queued?
- Verify this in the source for your version, because the Measurement Protocol itself is fire-and-forget with no delivery receipt. In practice you should wrap event dispatch in a queued job so a slow or failing GA4 endpoint never blocks your request path or a webhook response. Running sends on a queue also gives you a natural place to add your own logging, validation and retry policy.
- How do I test GA4 event payloads without hitting the real Measurement Protocol?
- The package sends over Laravel's HTTP client, so Http::fake() is the natural way to intercept outbound calls and assert the exact payload shape in your test suite. Confirm in the code whether the underlying client is injectable so you can swap it cleanly in unit tests. For end-to-end verification, send a real event to GA4 DebugView and validate the payload before you rely on the numbers in reports.
- Does it support user_id, client_id and timestamp_micros?
- These fields matter because server-side events are otherwise treated as anonymous and dated to the moment of sending. Check the package's payload builder and documentation for whether you can set user_id and client_id for stitching to a known user or session, and timestamp_micros for backdating offline events. If a field is not exposed, you can typically extend the payload or vendor-patch the small surface area.
- Is there retry or backoff, and how do I avoid double-counting conversions?
- The Measurement Protocol does not return a meaningful delivery receipt, and malformed payloads are often rejected silently or with a bare 2xx or 4xx, so delivery guarantees are your responsibility rather than the package's. If you add retries around the send, include your own idempotency or deduplication key in the event parameters and reconcile against GA4 reporting. Keep validation of required parameters strict on your side, since analytics correctness depends on it.
- Does server-side GA4 tracking respect cookie consent and GDPR?
- No, and it cannot: events fired from your backend are invisible to client-side consent tooling, so the package cannot enforce consent for you. You must gate dispatch on your own consent resolution logic before the event is sent, particularly for purchase, signup and identify-style events. Also keep personally identifiable information out of the payload, since server-side sends bypass the browser entirely.
- Is the package safe to depend on if it has only one maintainer?
- It is a small, single-maintainer community package, so bus factor is the main supply-chain risk. The mitigation is that the surface area is tiny: it is a thin adapter with no schema, no auth surface and no long-lived state, so it can be forked or vendor-patched in an afternoon if maintenance stalls. Recent releases tracking Laravel 13 show it is still alive, but note that your upgrade calendar becomes partly gated on this maintainer's release cadence.
- What are the alternatives to this package for GA4 Measurement Protocol in Laravel?
- The main alternative is a hand-rolled wrapper around Laravel's HTTP client that posts directly to the Measurement Protocol endpoint, which gives you full control over payloads, queuing and retries at the cost of writing and maintaining it yourself. Staying on client-side gtag is the other option, but it breaks down for webhooks, offline events and ad-blocked clients. Because this package is a thin single-purpose adapter, adopting it for one event and switching away later is cheap.