fourlabs/gamp-bundle
Symfony bundle for Google Analytics Measurement Protocol, enabling server-side tracking of pageviews, events, and ecommerce hits without client-side JavaScript. Provides simple service integration and configurable tracking IDs for backend analytics.
Architecture fit. Unchanged in substance. Release 2.5.0 adds Symfony 5 support — nothing more. This is still a Symfony bundle, not a Laravel package: it depends on bundle registration, the Symfony DI container, YAML/XML service definitions, and kernel event subscribers. Laravel has no bundle lifecycle, so there is still no supported path to composer require this and have it work. The underlying value — a wrapper over the Google Analytics Measurement Protocol collect endpoint — remains framework-agnostic in principle but is still shipped locked inside Symfony service definitions. Treat it as source material to port, not a dependency to install.
Integration feasibility. Low as-is, moderate as a fork. The 2.5.0 bump marginally improves the dependency-resolution picture — Symfony 5 requires PHP 7.2.5+, so we are no longer guaranteed a hard conflict with a modern PHP runtime — but it does not touch the actual blocker, which is the absence of a Laravel integration surface. The useful logic is still small (build a payload, POST to Google, optionally fire on events) and reimplementing it with Laravel's HTTP client remains a one-to-two-day task that removes the Symfony coupling entirely. A shim (aliasing the container, hand-registering services) still costs more than a rewrite and leaves us maintaining a bridge.
Technical risk — still the headline. 2.5.0 is a single-issue compatibility patch, not a modernization. Two concrete risks persist:
google-analytics.com/collect, v=1, t=pageview|event, tid=UA-XXXXX). UA stopped processing hits in July 2023; anything this package sends today is dropped. GA4 requires /mp/collect, a measurement_id (G-XXXX) plus api_secret, a client_id, and an events array payload — a materially different contract that no release of this bundle has addressed. Adding Symfony 5 support to a UA-era client is maintenance of a component whose wire format is retired.Key questions.
api_secret provisioned per property? (Blocking regardless of this release.)Stack fit. Poor, and 2.5.0 does not move this. There is still no Laravel service provider, facade, config publish, or queue integration. The Symfony event-subscriber model (auto-firing pageviews on kernel events) has no clean Laravel analogue and is arguably an anti-pattern server-side anyway — in a Laravel API we want explicit dispatch at known business boundaries, not ambient pageview mirroring.
Recommended migration path — do not adopt the package. Extract the pattern, not the code:
GoogleAnalyticsClient around Laravel's Http facade, POSTing GA4-shaped payloads to https://www.google-analytics.com/mp/collect?measurement_id=...&api_secret=....services.google_analytics.measurement_id / api_secret in config/services.php; source secrets from env/Vault — never commit them.trackPurchase(), trackSignup()) rather than a generic send(array $params), keeping the GA4 payload shape in one place.Compatibility. Symfony 5 support tells us the package is at least alive enough to track PHP 7.2.5+ runtimes, but it tells us nothing about PHP 8.1+ / Laravel 10–11. Verify against our actual matrix before any spike — but assume it is not a drop-in. If we want a maintained third-party option, evaluate current GA4 Measurement Protocol packages on Packagist with recent releases and non-zero dependents; hold them to the same criteria we're applying here.
Sequencing. Unchanged by this release:
Http::post to the GA4 validation endpoint (/debug/mp/collect) and confirm payload acceptance.Maintenance. Previously characterized as zero upstream; 2.5.0 requires a correction — there is minimal upstream activity, evidenced by a single merged compatibility PR. That is a meaningful distinction for a dependency decision but not a decisive one: one release adding Symfony 5 support is not a maintenance commitment, and there is still no evidence of GA4 work, a security policy, or a published roadmap. Adopting it still converts a dependency into something we effectively own, for a component this small.
Support. Still effectively none. No security response process, no PHP 8 compatibility patch, no GA4 migration. Any CVE in the transitively inherited Symfony tree is ours to remediate or route around.
Scaling. The protocol scales fine — fire-and-forget HTTPS POST, and GA4 accepts batched payloads (up to 25 events per request), which cuts request volume materially for high-traffic events. Note this batching contract is a GA4 feature the bundle does not implement; it is another reason the port is a rewrite rather than a configuration change. The real scaling concern remains architectural: always queue and batch. Inline calls add latency and create a hard dependency on Google's availability inside our request lifecycle. Budget for payload limits (GA4 caps bodies around 130KB) and per-client event volume thresholds.
Failure modes. Unchanged:
/mp/collect returns 2xx even for malformed or rejected payloads. Without validating against /debug/mp/collect in staging, broken tracking goes unnoticed for weeks. Mandate debug-endpoint validation in CI/staging.api_secret in logs or traces is a real exposure; scrub it from exception handlers.Ramp-up. Low for the implementation (a competent Laravel engineer ships the client and job in a day or two), and non-trivial for the GA4 Measurement Protocol spec — payload schema, batching semantics, validation endpoint, consent handling. The learning cost is in the protocol, not the package, which continues to undercut any reason to carry the bundle.
Verdict. Recommend reject for adoption — unchanged. Release 2.5.0 is a narrow Symfony-version compatibility patch; it does not address the framework mismatch, the retired UA wire format, or the absence of a support commitment. The only durable asset remains a pattern we can reimplement in a day. Budget the port as a small internal capability rather than a dependency decision. If the maintainer subsequently ships GA4 support and a stated support policy, re-evaluate then — not on the strength of a single Symfony 5 PR.
How can I help you explore Laravel packages today?