- Is fourlabs/gamp-bundle compatible with Laravel?
- No. fourlabs/gamp-bundle is a Symfony bundle that depends on bundle registration, the Symfony DI container, YAML or XML service definitions, and kernel event subscribers. Laravel has no bundle lifecycle, so there is no supported path to composer require it and have it work in a Laravel application. Treat it as source material to port, not a dependency to install.
- Does fourlabs/gamp-bundle support Google Analytics 4?
- No. Every release, including 2.5.0, still targets Universal Analytics using google-analytics.com/collect, v=1, t=pageview or event, and a tid value like UA-XXXXX. Universal Analytics stopped processing hits in July 2023, so anything this package sends today is dropped. GA4 requires a different contract: /mp/collect, a G-XXXX measurement_id plus api_secret, a client_id, and an events array payload.
- How do I install fourlabs/gamp-bundle in a Laravel app?
- You cannot install it cleanly in Laravel. Composer may resolve the Symfony packages it depends on, but without bundle registration and the Symfony service container the bundle has no integration surface in Laravel. Hand-registering services or aliasing the container costs more than rewriting the small amount of useful logic. The practical approach is to extract the pattern and build your own client.
- What changed in fourlabs/gamp-bundle 2.5.0?
- Release 2.5.0 adds Symfony 5 support and nothing more in substance. It is a single-issue compatibility patch, not a modernization. It marginally improves dependency resolution because Symfony 5 requires PHP 7.2.5 or newer, but it does not touch the main blocker, which is the absence of a Laravel integration surface or GA4 support.
- Can I use fourlabs/gamp-bundle for server-side Google Analytics tracking?
- Only for the retired Universal Analytics wire format. The bundle does provide a Symfony service for server-side hits, which is useful for background jobs, APIs, and backend workflows, but it sends UA-era payloads to google-analytics.com/collect. Since UA stopped processing hits in July 2023, that tracking no longer produces usable data. For GA4 server-side tracking you need a different client that posts to /mp/collect with a measurement_id, api_secret, client_id, and events array.
- What are the Laravel alternatives to fourlabs/gamp-bundle for server-side analytics?
- The recommended alternative is not another Composer package but a small in-house GoogleAnalyticsClient built around Laravel's Http facade. It should POST GA4-shaped payloads to https://www.google-analytics.com/mp/collect?measurement_id=...&api_secret=..., bind as a singleton, and read services.google_analytics.measurement_id and api_secret from config/services.php with secrets sourced from env or Vault. Expose narrow domain methods such as trackPurchase() and trackSignup() instead of a generic send(array $params). This removes the Symfony coupling entirely and takes roughly one to two days.
- Does fourlabs/gamp-bundle send Universal Analytics or GA4 hits?
- It sends Universal Analytics hits. The bundle still uses the UA collect endpoint with v=1, t=pageview or event, and a tid property ID such as UA-XXXXX. GA4 uses a materially different contract: the /mp/collect endpoint with a G-XXXX measurement_id, api_secret, client_id, and an events array. No release of this bundle has addressed that GA4 migration.
- How do I send Google Analytics 4 Measurement Protocol events from Laravel?
- Do not use fourlabs/gamp-bundle for this. Use Laravel's Http facade to POST to https://www.google-analytics.com/mp/collect?measurement_id=...&api_secret=... with a GA4 payload containing client_id and an events array. Keep measurement_id and api_secret in config/services.php, sourced from environment variables or a secrets manager, and bind the client as a singleton. Wrap the calls in domain-specific methods so controllers and jobs dispatch events at explicit business boundaries.
- Is fourlabs/gamp-bundle production-ready and maintained?
- Treat it as high risk for production. The headline issue is protocol obsolescence: the bundle targets Universal Analytics, which stopped processing hits in July 2023, and no release has addressed GA4. The 2.5.0 Symfony 5 patch is a one-off compatibility merge, not evidence of a support roadmap for GA4 migration. If you fork it, you inherit patching responsibility for an unmaintained branch of an ecosystem you likely do not run.
- What is the migration path from fourlabs/gamp-bundle to Laravel?
- Do not adopt the package. Extract the pattern instead: build a small GoogleAnalyticsClient around Laravel's Http facade that posts GA4-shaped payloads to https://www.google-analytics.com/mp/collect?measurement_id=...&api_secret=.... Bind it as a singleton, add services.google_analytics.measurement_id and api_secret to config/services.php, source secrets from env or Vault, and expose narrow methods like trackPurchase() and trackSignup(). This is a one-to-two-day task and removes the Symfony coupling entirely.