jeffersongoncalves/laravel-metrics-ga4
Laravel package for pulling Google Analytics 4 metrics into your app, making it easy to query GA4 data and surface reports or dashboard stats without writing boilerplate API code.
Release reviewed: 1.0.0 (first public release). This establishes the baseline assessment.
Architecture fit
GA4 facade. No persistence layer beyond spatie/laravel-settings (credentials) and an access-token cache — this is the right shape for a Laravel integration and adds no runtime service to operate.GA4_PROPERTY_ID. Any product need for per-tenant, per-brand, or per-environment property selection is not addressed and would require forking or wrapping.Integration feasibility
GA4_PROPERTY_ID + GA4_SERVICE_ACCOUNT_JSON. Days for a spike, not weeks.pages, sources, countries, browsers, devices, realtimeVisitors) cover most common dashboarding needs out of the box; runReport is the escape hatch for anything else.Technical risk
APP_KEY. Compromise or APP_KEY rotation is a meaningful operational hazard, and the key grants read access to every property the service account can see. Requires a dedicated, least-privilege service account scoped to one property.visitors, visits, pageviews, bounce_rate, visit_duration invites Universal Analytics-era comparisons. GA4's bounce_rate is (1 − engagement rate), users ≠ sessions ≠ pageviews, and thresholds/sampling apply. Reporting built on these names risks being quietly wrong rather than visibly broken.RateLimitException exists, but there is no documented timeout, retry/backoff, throttling, or report-level caching. GA4 quotas are per-property, so every app instance and every user shares one budget.Key questions
(not set) rows surfaced to callers, or silently returned?Laravel 13 genuinely tested, and is the GA4 Data API version pinned?Stack fit
Migration path
Compatibility
APP_KEY stability; a rotation runbook (decrypt → re-seed) is required.Sequencing
Maintenance
Support
AuthenticationException → key/permission/property misconfiguration, RateLimitException → backoff and quota review, GA4Exception → schema or request problem.Scaling
realtimeVisitors polling — it burns quota in proportion to traffic and is the most likely source of self-inflicted rate limiting.Failure modes
GA4_PROPERTY_ID, or Analytics Data API not enabled on the project.APP_KEY rotation breaking encrypted settings decryption.Ramp-up
How can I help you explore Laravel packages today?