hi there i'm trying to get the google analytics in my project , i managed to show it on google analytics but i can't show it on my project's admin panel . i have always get this error :
ErrorException in AnalyticsServiceProvider.php line 53:
Undefined index: service_account_credentials_json
and that's my controller :
$analytics= Analytics::fetchMostVisitedPages(
Period::create(Carbon::now()->subMonth(), Carbon::now())
);
dd($analytics);
but i don't know what's the error as i did every thing as in tutorials , can anyone help ?
You're missing the analytics credentials file. Check the readme for instructions.
You then need to place the file in.
storage/app/analytics/service-account-credentials.json
Maybe file /config/laravel-analytics.php or /config/analytics.php (for most recent versions) is missing. Remember to publish this file using the following command:
php artisan vendor:publish --provider="Spatie\Analytics\AnalyticsServiceProvider"
You should also remember to verify if your file /storage/app/analytics/service-account-credentials.json exists. If it doesn't exist generate this file following the steps written on https://github.com/spatie/laravel-analytics.
Hope it helps you! =)