天道酬勤,学无止境

google-api-webmasters

如何在 Google API (Ruby) WebmastersV3 中使用身份验证令牌(服务帐户访问)(How to use auth token in Google API (Ruby) WebmastersV3 (service account access))

问题 我无法将这两个部分连接在一起:我能够对我的服务帐户进行身份验证,并且我知道如何为我需要从 API 检索的信息形成请求,但我无法弄清楚如何使该请求通过令牌进行身份验证。 这将从我为服务帐户获得的凭证文件构建一个对象并成功生成令牌: 需要“googleauth” require 'google/apis/webmasters_v3' website = "https://example.com" scope = 'https://www.googleapis.com/auth/webmasters' authorizer = Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: File.open('service-account.json'), scope: scope) token = authorizer.fetch_access_token! 最后的请求就像 wt_service.query_search_analytics(website, { "startDate"=> "2019-12-01", "endDate"=> "2019-12-02", "dimensions"=> [ "query" ] }) 但是网站管理员工具 API 端点的对象不接受任何参数: wt_service =

2021-10-25 20:53:44    分类:技术分享    ruby   google-api   service-accounts   google-api-ruby-client   google-api-webmasters

How to use auth token in Google API (Ruby) WebmastersV3 (service account access)

I cannot connect the two pieces together: I am able to authenticate my service account and I know how to form the request for the information I need to retrieve from the API, but I cannot figure out how to make that request authenticated with the token. This builds an object from the credential file I got for the service account and generates token successfully: require 'googleauth' require 'google/apis/webmasters_v3' website = "https://example.com" scope = 'https://www.googleapis.com/auth/webmasters' authorizer = Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: File.open(

2021-10-21 01:06:34    分类:问答    ruby   google-api   service-accounts   google-api-ruby-client   google-api-webmasters

Search Console API:展示次数不会将总数与包含/不包含关键字相加(Search Console API: Impressions don't add up comparing totals to contains / not contains keywords)

问题 我们正在使用 Search Console(网站管理员工具)API 下载我们网站的搜索性能结果,以比较使用我们公司名称和非公司名称搜索的用户的搜索性能。 我们发现了一个问题,即在将“所有搜索结果”与“通过特定关键字的搜索结果”进行比较时,展示次数不会相加。 例如,如果我们制作一份报告以显示我们网站在特定日期的所有设备的所有网络结果,我们将获得 189,491 次展示。 如果我们然后报告显示关键字“我们的名字”的结果,我们将得到 61,046。 如果我们报告“OurName”(相同的关键字但没有空格),我们会得到 1,086。 如果我们然后报告不包含“我们的名字”并且不包含“我们的名字”,我们将得到 65,827,加起来为 127,959,这意味着我们在某处缺少 61,532 次展示。 有趣的是,如果我们将不包含的过滤器更改为也包含设备等于桌面,它会增加到 65,997,但我预计这等于或小于所有设备展示次数。 从我们掌握的数据来看,这似乎在 2015 年 11 月 27 日停止工作(在此之前,这 3 个数字总是加起来等于总数,在这个日期和之后他们没有)。 如果我们只做一个包含和一个不包含,则印象加起来很好。 点击次数似乎总是正确加起来,所以我想知道这些查询之一是否排除了点击次数为零的数据? 我们使用 .Net 库来访问 Search Console 数据,但在使用 API

2021-10-07 03:07:34    分类:技术分享    google-api   google-webmaster-tools   google-api-webmasters

Search Console API: Impressions don't add up comparing totals to contains / not contains keywords

We are using the Search Console (webmaster tools) API to download search performance results for our site to compare search performance on people searching using our company name vs non company name searches. We have found a problem where the impressions don't add up when comparing "all search results" to "search results via specific keywords". For example, if we do a report to show all web results for all devices for our site on a specific date, we get 189,491 impressions. If we then report to show results with the keyword "Our Name" we get 61,046. If we report on "OurName" (same keyword but

2021-10-07 02:41:40    分类:问答    google-api   google-webmaster-tools   google-api-webmasters

查询站长工具api的维度(Dimensions of query webmasters tools api)

问题 特别是亚历克斯:) 我想知道是否有任何机构有 PHP 代码来从网站管理员工具 api 获取查询的详细信息。 我已经有了查询维度,但我不知道如何使用 PHP 代码来实现它。 $webmastersService = new Google_Service_Webmasters($client); $searchanalytics = $webmastersService->searchanalytics; $request = new Google_Service_Webmasters_SearchAnalyticsQueryRequest; 回答1 假设您拥有所有凭据和令牌。 如果您没有它们,您将收到(401) Login Required错误。 提出请求,您可以通过如下 setter 方法设置startDate, endDate, searchType, rowLimit : $query->setStartDate('2015-11-10'); 但是有些方法需要像setDimensions这样的数组: $query->setDimensions(array('page')); 更复杂的事情setDimensionFilterGroups方法需要Google_Service_Webmasters_ApiDimensionFilterGroup数组。 并且每个Google

2021-09-29 20:42:29    分类:技术分享    google-api-webmasters

Webmasters API - Quota limits

We're trying to download page data for sites using the Webmasters API .NET Client Library, by calling WebmastersService.SearchAnalytics.Query(). To do this we are using Batching and sending approx. 600 requests in one batch. However most of these fail with the error "Quota Exceeded". The amount that fail varies each time but it is only about 10 of the 600 that work (and it varies where they are within the batch). The only way we can get it to work is to reduce the batch size down to 3, and wait 1 second between each call. According to the Developer Console our daily quota is set to 1,000,000

2021-07-29 03:57:49    分类:问答    google-api   google-webmaster-tools   google-api-webmasters

Dimensions of query webmasters tools api

specially Alex :) I want to know if any body have a PHP code to get the details of a query from webmasters tools api. I have already the query dimensions but I dont't know how exactely to make it with PHP code. $webmastersService = new Google_Service_Webmasters($client); $searchanalytics = $webmastersService->searchanalytics; $request = new Google_Service_Webmasters_SearchAnalyticsQueryRequest;

2021-07-10 06:00:34    分类:问答    google-api-webmasters