Weave Code
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
Analytics Reports

Analytics Reports Laravel Package

spatie/analytics-reports

Abandoned Laravel 4 package by Spatie to retrieve Google Analytics data via service provider/facade. Includes config publishing and depends on google/apiclient and thujohn/analytics. For Laravel 5+, use spatie/laravel-analytics.

View on GitHub
Deep Wiki
Context7

An opinionated Laravel 4 package to retrieve Google Analytics data

Frequently asked questions about Analytics Reports
Is this package still maintained or safe to use in production?
No, this package is officially abandoned by Spatie and not recommended for new projects. It’s designed for Laravel 4 (EOL since 2018) and relies on deprecated Google Analytics v3 API. Use at your own risk or fork it for maintenance.
Can I use this package with Laravel 5, 6, 7, or 8+?
No, this package is explicitly for Laravel 4. Integration with newer Laravel versions would require significant refactoring, including dependency updates and compatibility fixes. Spatie recommends using **spatie/laravel-analytics** for Laravel 5+.
How do I install and configure this package?
Run `composer require spatie/analytics-reports`, register the `AnalyticsReportsServiceProvider` in `config/app.php`, and optionally add the `AnalyticsReports` facade. Publish the config with `php artisan config:publish spatie/analytics-reports`. Note: Manually add `google/apiclient` and `thujohn/analytics` to `composer.json` if dependencies fail to auto-install.
What Google Analytics API version does this package support?
This package uses the deprecated **Google Analytics Core Reporting API (v3)**, which is no longer supported. For modern analytics, migrate to **GA4’s Data API** or use alternatives like `shuhei/laravel-ga4`.
How do I fetch a basic report (e.g., daily users) with this package?
Use the facade: `AnalyticsReports::get('ga:users', ['ids' => 'ga:123456', 'start-date' => '7daysAgo', 'end-date' => 'today'])` or the service container. Note: Queries must follow GA v3 syntax, which differs from GA4.
Are there alternatives for Laravel 5+ or GA4 support?
Yes. For Laravel 5+, use **spatie/laravel-analytics**. For GA4, consider **shuhei/laravel-ga4**, direct API integration with `google-analytics-data`, or Google’s **BigQuery Export**. These support modern metrics and dimensions.
Will this package work with PHP 8.x or modern Laravel?
No. This package assumes PHP 5.5–5.6 and Laravel 4. Upgrading to PHP 8.x or newer Laravel versions would require fixing deprecated functions (e.g., `array_merge_recursive`) and updating dependencies like `google/apiclient` to v2+.
How do I handle OAuth2 authentication for Google Analytics?
The package uses `google/apiclient` for OAuth2. Configure credentials in the published config file (e.g., `client_id`, `client_secret`, and `redirect_uri`). Ensure your Google Cloud project has the **Analytics API enabled** and scopes set to `https://www.googleapis.com/auth/analytics.readonly`.
Can I cache or store reports in a database?
The package doesn’t include built-in caching, but you can manually cache results using Laravel’s cache system (e.g., `Cache::put()`) or store reports in a database table. For GA4, consider **BigQuery** for scalable storage and analysis.
What are the risks of using this package in a production environment?
Key risks include: **breaking changes** from GA v3 → GA4 migration, **security vulnerabilities** in outdated dependencies, and **maintenance burden** if you fork it. The package lacks extensibility for modern analytics use cases like event tracking or user journeys. Test thoroughly before deployment.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport