'Google Analytics 4 API - runReport() give empty result : "source" Dimension not working
I'm working with the new Google Analytics API (GA4) on a PHP script. My API requests were working well since yesterday, one of the runReport() query suddenly start returning empty result :
$globalTrendData = $client->runReport([
'property' => 'properties/' . $property_id,
'dateRanges' => [
new DateRange([
'start_date' => '20daysAgo',
'end_date' => 'yesterday',
]),
],
'dimensions' => [
new Dimension(['name' => 'pagePath',]),
new Dimension(['name' => 'pageTitle',]),
new Dimension(['name' => 'city',]),
new Dimension(['name' => 'source',]),
new Dimension(['name' => 'date',])
],
'metrics' => [
new Metric(['name' => 'screenPageViews',]),
new Metric(['name' => 'userEngagementDuration',]),
new Metric(['name' => 'activeUsers',]),
]
]);
Why this query stopped working ? Is Google making some change on the API ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
