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

Backend Google Analytics Bundle Laravel Package

modera/backend-google-analytics-bundle

A backend bundle for Modera applications that integrates Google Analytics into the admin panel, providing configuration and reporting widgets so teams can view traffic and site metrics alongside their existing management tools.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — a cataloging mismatch that gates everything. The package is listed as a Laravel/PHP package, but modera/backend-google-analytics-bundle is a Symfony bundle (the "-bundle" suffix, the Modera vendor namespace, and the DI/HttpKernel assumptions are all Symfony idioms). It cannot be dropped into a Laravel app via composer require and used as intended: there is no Laravel service provider, facade, config publish, or middleware. Its admin UI components also depend on Modera's backend-bundle shell, which has no Laravel counterpart. As a TPM, the first thing to kill is the assumption that "it's a PHP package, so it's a candidate." It is not a candidate for a Laravel stack; it is a reference pattern at best.

What is actually portable. The idea — emit a server-side pageview for authenticated admin routes so the team can see which back-office screens get used, rather than relying on front-end JS in an admin template — is sound and small. In Laravel that is a route-middleware filter plus a queued job, roughly 100–200 lines. That is the deliverable worth funding; the repository is not.

Integration feasibility — low as a dependency, moderate as a pattern source. Three blockers beyond the framework mismatch:

  1. GA protocol vintage. Modera bundles of this generation typically target Universal Analytics (UA-* property, ga() snippet or /collect GIF). UA stopped processing standard hits in July 2023. If so, the package is functionally dead regardless of framework — it would emit hits into a void with no error surfaced.
  2. Modera coupling. Detecting "is this a backend pageview" likely relies on Modera's layout, security context, and asset pipeline — none of which exist in a Laravel app.
  3. Zero validation. 0 stars, 0 dependents, single-maintainer origin, no visible security response process. No evidence anyone outside Modera runs this in production.

Technical risk — high. Unaudited third-party code, and if it injects JS into admin pages it is a CSP and XSS surface in the most privileged part of the application.

Key questions to resolve in a 1–2 day timeboxed spike (if we spike at all):

  • Which GA protocol does it emit — UA /collect, gtag.js, or GA4 Measurement Protocol v2 with measurement_id/api_secret?
  • Client-side or server-side dispatch? Synchronous in the request path or async?
  • Hard dependencies: Symfony version ceiling, Modera bundles, PHP version.
  • License and provenance: maintained Modera product or archived side-bundle?
  • Does it collect user identifiers, strip IPs, or support consent gating?
  • Note the score split: opportunity 45.79 vs. package 0.09 — the problem scores well; the artifact does not. Fund the problem, not the artifact.

Integration Approach

Stack fit — do not integrate; reimplement the pattern. Recommendation: do not add this dependency to a Laravel codebase. The vendor mismatch makes it non-idiomatic and the GA-version risk makes the outcome uncertain even if it were ported. Frame the decision as "build, don't buy," and document the rationale in the ticket so it doesn't get re-litigated.

Migration path — port the pattern, not the code. Sequence:

  1. Middleware or event listener on the web group, filtered to authenticated admin routes, that enqueues a pageview job onto a dedicated queue. Laravel's middleware and queue abstractions replace the Symfony listener wiring entirely.
  2. GA4 Measurement Protocol v2 client (POST https://www.google-analytics.com/mp/collect?measurement_id=…&api_secret=…) — a short Guzzle call, or a maintained Laravel analytics package if we prefer an off-the-shelf path. Validate the payload shape (client_id, events[].name = page_view, page_location) against GA4's debug endpoint.
  3. Config + secrets via config/analytics.php and env vars; measurement_id and api_secret in the secret manager, never committed.
  4. Feature flag gated off by default and enabled per environment.

Compatibility notes. GA4 differs structurally from UA: client_id must be synthesized and persisted (a hashed Laravel session ID is a reasonable proxy), custom dimensions must be pre-registered in the GA4 property or they are silently dropped, and MP hits do not accept IP addresses — geo is derived from the request's origin IP, which is a privacy consideration. If anyone expects UA-parity reporting, that reporting model no longer exists.

Sequencing and effort. (a) Timeboxed 1–2 day spike to confirm protocol and dependencies — optional, and mostly valuable as cover for a "we checked" decision record; (b) decision gate — build, don't buy; (c) build middleware + queued job behind a flag; (d) validate against GA4 DebugView; (e) privacy review before production enable. Realistic total: 3–5 engineering days, none of which depends on this repository. Success criteria: we can answer "top 20 admin routes by weekly active users, last 90 days" without asking an engineer.

Operational Impact

Maintenance — worst case. Adopting it means the team owns a frozen, unidiomatic Symfony artifact inside a Laravel app, with no path to security patches. Vendoring or forking transfers 100% of maintenance to us for a feature we could own outright in a fraction of the surface area.

Support. No community, no documentation beyond the repo, no known production users to consult. Escalation path is "read the source." If the maintainer's GA assumptions (UA-era dimensions, event naming) are wrong, there is no one to ask.

Scaling. Pageview volume from backend routes is negligible — this is not a throughput concern. The real scaling concerns are:

  • Cardinality. High-cardinality custom dimensions (user ID, raw route params) will blow up GA4 reporting; cheap to send, expensive to analyze. Attach role or team, never email or record ID.
  • Queue pressure. Use a separate queue/connection so analytics dispatch cannot starve transactional jobs.
  • Sampling. Cap or sample once volume grows; admin hits are low-value individually.

Failure modes to design against:

  • Silent total data loss — the dominant risk. A sunset UA property, revoked api_secret, or renamed measurement ID returns HTTP 2xx with no body. Mitigation: route a fraction of hits to /debug/mp/collect, alert on validation errors, keep a canary counter.
  • Request-path coupling. If hits dispatch synchronously, a slow or hanging Google endpoint adds latency to every admin page load. Mitigation: queued jobs only, short timeouts, drop-on-failure.
  • Duplicate or inflated hits. Livewire/Inertia partial reloads, Turbo-style navigation, prefetch, and multi-tab sessions all inflate pageviews. Mitigation: dedupe key on (session, route, timestamp bucket).
  • Blocked by policy. CSP connect-src/script-src restrictions or an internal-only network kill client-side dispatch; server-side egress to google-analytics.com may be firewalled. Mitigation: server-side dispatch, allowlist the endpoint explicitly.
  • Privacy/consent. Internal admin traffic still carries employee PII in URLs and query strings. Send route templates rather than full URLs, strip query strings, and confirm data residency, DPA, and works-council posture before enabling — this is a prerequisite, not a follow-up.

Ramp-up. Low technical ramp (the replacement code is small) but a non-trivial governance ramp: legal/privacy sign-off, a CSP/egress change, and a decision on GA4-vs-self-hosted (Matomo, Plausible, or PostHog are the likely alternatives; a first-party events table plus a BI dashboard beats GA on privacy and flexibility). Budget the TPM time against those approvals, not against the coding, and treat "we adopted a 0-star Symfony bundle into a Laravel app" as the outcome to avoid.

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.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log