"I'm having trouble fetching impression metrics for YouTube videos using the YouTube Analytics API. Despite specifying the 'impressions' metric in my query, the API response does not include impression data. Could this be due to API limitations or incorrect query parameters? Any suggestions on how to successfully retrieve impression metrics would be appreciated.
I have tried this query
$client = new \Google\Client();$client->setApplicationName('Social Media');$client->setAccessToken($account_access_token);$youtubeService = new \Google_Service_YouTubeAnalytics($client);$youtubeAnalyticsImpression = $youtubeService->reports->query(["ids" => 'channel=='.$username,'dimensions' => 'video','startDate' => '2006-01-01','endDate' => Carbon::now()->year . '-12-31','metrics' => 'impressions','filters' => 'video==' . $video_id,]);
But get error
{"error": {"code": 400,"message": "Unknown identifier (impressions) given in field parameters.metrics.","errors": [ {"message": "Unknown identifier (impressions) given in field parameters.metrics.","domain": "global","reason": "invalid" } ] }}