- How do I install akki-io/laravel-google-analytics in a Laravel app?
- Install it with composer require akki-io/laravel-google-analytics; the service provider and facade are auto-discovered on supported Laravel versions. Publish the config file with the vendor:publish command, then supply your Google Analytics credentials and property details. A mid-level developer should be able to go from install to a verified query against a dev property in under a day.
- Does this package work with Google Analytics 4 or only Universal Analytics?
- The package is described as retrieving data from Google Analytics 4 via the GA4 Query Explorer surface, so its reporting path is GA4 metrics and dimensions rather than legacy Universal Analytics reports. Universal Analytics stopped processing data in July 2023, so a UA code path would be functionally dead anyway. Confirm the GA4 Data API path in the source before adopting if you have an unusual reporting requirement.
- Which Laravel and PHP versions are supported?
- The v12.0 release lines up with Laravel 12, which suggests the package now tracks Laravel's major version numbering. Earlier majors are pinned to Laravel 10 and 11 constraints, so if you are not on Laravel 12 you should expect to stay on v11 and off the actively supported line. Check the composer.json on the tagged release for the exact illuminate/support range and PHP floor, which for Laravel 12 is PHP 8.2 or newer.
- How do I configure Google Analytics credentials for this package?
- You need a Google Cloud service account with access granted to the GA4 property, its JSON key file, and the GA4 property ID. Keep the JSON out of version control and reference it from your environment file rather than committing it. If the config file changes between major versions, re-publish and diff instead of overwriting it, since credential keys are the usual casualty of a blind overwrite.
- What is the difference between this package and spatie/laravel-analytics?
- Both are thin Laravel wrappers around GA4 reporting, exposing metrics and dimensions behind a service provider and facade. spatie/laravel-analytics has a much larger install base and contributor pool, while this package is single-maintainer with modest download volume. Choose based on your appetite for maintenance and bus-factor risk rather than on feature differences, which are small.
- How do I fetch metrics and dimensions from Google Analytics 4 in Laravel?
- Resolve the bound interface or facade, specify the GA4 property, the metrics, dimensions and date range you want, and read the returned rows. Keep query definitions in one place, such as a small reporting service, so you are not scattering property IDs and metric strings through controllers. Cache or queue the calls if the reports are expensive or hit rate limits.
- Can I use this package to send server-side events like signups and checkouts?
- No. This package is for retrieving GA4 report data, not for emitting events; server-side event emission is the Measurement Protocol, which is a different surface. Be explicit about which problem you are solving before selecting it, because a reporting client will not replace client-side gtag tracking. For dashboards and reports it is the right shape; for event emission look elsewhere.
- What changed between v11 and v12, and is the upgrade safe?
- The v12.0 release coincides with Laravel 12 and appears to be a constraint update rather than new API behaviour, but treat it as constraint-only until you have proven otherwise. Read the composer.json diff on the tagged release, confirm the Laravel floor, then bump in a branch and run your test suite plus a manual smoke query against a dev GA4 property. There are no expected database migrations, but re-publish the config and diff it in case credential keys changed.
- How do I test Google Analytics queries without hitting production data?
- Point the package at a separate GA4 property used only for development or testing, and smoke test a single known query there. For unit tests, mock the client behind the bound interface so assertions do not require network access or real credentials. Watch for rate limits if your test suite issues many report requests.
- Is this package actively maintained, and what happens when Laravel 13 ships?
- It is a single-maintainer package with a small contributor base and download volume well below spatie/laravel-analytics, so bus-factor risk is real for anything on a critical path. The versioning convention implies a mandatory major bump roughly every twelve months to track Laravel, so expect to be nudged to upgrade annually. Ask the maintainer whether they will patch the current major for the life of Laravel 12, check the transitive dependencies (historically google/apiclient, which brings audit noise and upgrade tax), and wrap the package behind your own interface so it stays cheap to swap out.