Closed veneliniliev closed 3 years ago
same here
Not 100% if thats it but i think this error is occuring when you just setup your analytics and Spatie's Package retrieves only one or no datasets. The Metrics card then throws the error because it expects to have values which it doesnt have on the first day.
It worked for me on the 2nd Day without changing anything.
if you dd($analyticsData) in a test for this code which is the same in the metric, you'll see that it throws an empty array which is why it cant have the offset. So im not sure if its a mistake in spaties package or if this has another meaning to it. But if you add more days to Period::days(3) it worked randomely, which unfortunately doesnt help for the metrics error ;-)
$analyticsData = app(Analytics::class)
->fetchTotalVisitorsAndPageViews(Period::days(1));
dd($analyticsData)
yes. on 2nd day working perfectly...
Trying to access array offset on value of type null {"userId":1,"exception":"[object] (ErrorException(code: 0): Trying to access array offset on value of type null at /.../vendor/tightenco/nova-google-analytics/src/PageViewsMetric.php:42)