My website is connected to google search console API. I would like to make a query that return the average position on my site in google. Is it possible? i would like to get the average including ALL the keywords? does any one know any query for this? The server side is written with php. I can make a query that return me my website position but only by specific keyword that i need to choose. for example:
$query = new Google_Service_Webmasters_SearchAnalyticsQueryRequest();
$query->setSearchType('web');
$query->setDimensions(array('query', 'country', 'device'));
$query->setStartDate($StartDate);
$query->setEndDate($EndDate);
$filterDevice = new Google_Service_Webmasters_ApiDimensionFilter();
$filterDevice->setDimension('device');
$filterDevice->setOperator('equals');
$filterDevice->setExpression('DESKTOP');
$filterCountry = new Google_Service_Webmasters_ApiDimensionFilter();
$filterCountry->setDimension('country');
$filterCountry->setOperator('equals');
$filterCountry->setExpression('fr');
*******THIS IS FOR A SPECIFIC KEY WORD! ********
$filterQuery = new Google_Service_Webmasters_ApiDimensionFilter();
$filterQuery->setDimension('query');
$filterQuery->setOperator('equals');
$filterQuery->setExpression($keyWord);
************************************************
$filtergroup = new Google_Service_Webmasters_ApiDimensionFilterGroup();
$filtergroup->setGroupType('and');
//$filtergroup->setFilters(array($filterDevice,$filterCountry,$filterQuery));
$filtergroup->setFilters(array($filterDevice,$filterCountry));
$query->setDimensionFilterGroups(array($filtergroup));
$response = $webmaster->searchanalytics->query($clientSite,$query);
If i do not send any keyword (query) the respond is a lot of keywords and the position of each one, as shown
{
"0": {
"clicks": 3164,
"ctr": 0.373686075351,
"impressions": 8467,
"keys": {
"0": "KEYWORD_EXAMPLE",
"1": "fr",
"2": "DESKTOP"
},
"position": 1.00035431676
},
"1": {
"clicks": 267,
"ctr": 0.765042979943,
"impressions": 349,
"keys": {
"0": "KEYWORD_EXAMPLE",
"1": "fr",
"2": "DESKTOP"
},
"position": 1.03438395415
},
"2": {
"clicks": 204,
"ctr": 0.0491684743312,
"impressions": 4149,
"keys": {
"0": "KEYWORD_EXAMPLE",
"1": "fr",
"2": "DESKTOP"
},
"position": 6.57869366112
},
"3": {
"clicks": 135,
"ctr": 0.308924485126,
"impressions": 437,
"keys": {
"0": "KEYWORD_EXAMPLE",
"1": "fr",
"2": "DESKTOP"
},
"position": 1
},
TNX!!! :)