获取效果数据
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
通过每天查询一天的数据,您可以快速查询性能数据,且不会超出配额。
您必须选择要在数据中提供哪些信息:哪些搜索类型(网页、图片、视频等)
和维度(网页、查询、国家/地区或设备),以及是否按网页或媒体资源对结果进行分组。在查询网页和/或查询字符串时,部分数据可能会被丢弃(查看原因)。
概览
- 我们建议使用下述查询样式之一每天运行查询,以获取一天的数据。对一天的数据运行每日查询不应超出您的每日配额。数据通常会在 2-3 天后提供;您可以通过针对过去 10 天运行按日期分组的简单查询来了解最新的可用数据。在编写查询时:
- 选择是按网页还是资源对结果进行分组。
- 选择是希望在查询中使用更完整的计数还是更多维度。注意:您必须使用两步流程查询搜索结果呈现数据(AMP、蓝色链接、富媒体搜索结果等)。
- 通过重新运行同一查询来逐页浏览结果,将请求中的
startRow
值增加 25,000,直到看到最后一页(包含 0 行的响应)。
- (可选)使用另一个
type
参数运行同一查询。
以下是单个查询的伪代码示例。您可以每天针对需要数据的
每个 type
值运行一次此操作。
int maxRows = 25000; // Current max response size
int i = 0;
do {
response = Request(startDate = 3_days_ago,
endDate = 3_days_ago,
... add dimensions, type ...
rowLimit = maxRows,
startRow = i * maxRows);
i++;
… // Do something with the response data.
} while (response.rows.count() != 0); // Page through all result rows
数据量限制
除了 API 用量配额之外,“搜索分析”方法每天最多提供 5 万行数据,每种搜索类型(网页、图片等,按点击次数排序)。
查询详情
您可以查询按网页或媒体资源分组的数据。
按网页分组
为了获得准确的计数,您必须省略网页和查询维度,例如:
"startDate": "2018-06-01",
"endDate": "2018-06-01",
"dimensions": ["country", "device"],
"type": "web",
"aggregationType": "byPage"
startDate
/ endDate
:通过选择同一日期来选择一个 1 天时间段。
dimensions
:可以选择添加 country
和/或 device
。
type
:根据需要在单独的查询中枚举
每个 type
值。
aggregationType
:必须为 byPage
。
如需获取更多详细信息(包括网页和/或查询信息),但代价是会丢失一些数据,请运行如下查询:
"startDate": "2018-06-01",
"endDate": "2018-06-01",
"dimensions": ["page", "query", "country", "device"],
"type": "web"
startDate
/ endDate
:通过选择同一日期来选择一个 1 天时间段。
dimensions
:包含 page
。可以选择包含 query
、country
或 device
的任意组合。
type
:根据需要在单独的查询中枚举
每个 type
值。
按资源分组
为了获得准确的计数,您必须省略网页和查询维度,例如:
"startDate": "2018-06-01",
"endDate": "2018-06-01",
"dimensions": ["country", "device"],
"type": "web"
startDate
/ endDate
:通过选择同一日期来选择一个 1 天时间段。
dimensions
:可以选择添加 country
和/或 device
。
type
:根据需要在单独的查询中枚举
每个 type
值。
如需获取更多详细信息(包括查询、国家/地区和/或设备信息),但会丢失一些数据,您可以运行如下所示的查询:
"startDate": "2018-06-01",
"endDate": "2018-06-01",
"dimensions": ["query", "country", "device"],
"type": "web"
startDate
/ endDate
:通过选择同一日期来选择一个 1 天时间段。
dimensions
:可以选择添加 query
、country
或 device
的任意组合。
type
:根据需要在单独的查询中枚举
每个 type
值。
按网页或属性对结果进行分组
当您按网页(而非资源)对结果进行分组时,展示次数、点击次数、排名和点击率的计算方式会有所不同。了解详情。
请求更多详细信息时,为什么会丢失数据?
当您按网页和/或查询分组时,我们的系统可能会丢弃一些数据,以便能够在合理的时间内使用合理数量的计算资源计算结果。
获取搜索结果呈现数据
搜索结果呈现不能以列与任何其他维度一起提供。因此,如果您想查看自己网站的搜索结果呈现信息,必须遵循以下流程:
- 指定
searchAppearance
作为唯一的维度,该维度将按搜索结果呈现类型对所有数据进行分组,而不包含其他维度。
- (可选)运行第二个查询,按第 1 步中列出的某个搜索结果呈现类型进行过滤,然后向该查询添加任何所需的维度(网页、国家/地区、查询等)。
若要检索有关多种搜索结果呈现类型的数据,您必须针对第 1 步中列出的每种搜索结果呈现类型运行一次第二步。
第一个查询:
获取您网站上的搜索结果呈现类型列表。
{
"startDate": "2018-05-01",
"endDate": "2018-05-31",
"type": "web",
"dimensions": [
"searchAppearance"
]
}
成效:
您的网站类型为 INSTANT_APP、AMP_BLUE_LINK 等。
"rows": [
{
"keys": [
"INSTANT_APP"
],
"clicks": 443024.0,
"impressions": 4109826.0,
"ctr": 0.10779629113251997,
"position": 1.088168452873674
},
{
"keys": [
"AMP_BLUE_LINK"
],
"clicks": 429887.0,
"impressions": 1.7090884E7,
"ctr": 0.025152999692701676,
"position": 7.313451603790653
},...
第二个查询:
按第 1 步中找到的某种搜索结果呈现类型以及您喜欢的任何维度(网页、设备等)进行过滤。在这里,我们按 AMP_BLUE_LINK 进行过滤。
{
"startDate": "2018-05-01",
"endDate": "2018-05-31",
"type": "web",
"dimensions": [
"device" // and/or page, country, ...
],
"dimensionFilterGroups": [
{
"filters": [
{
"dimension": "searchAppearance",
"operator": "equals",
"expression": "AMP_BLUE_LINK"
}
]
}
]
}
成效:
按设备类型细分的 AMP_BLUE_LINK。
"rows": [
{
"keys": [
"MOBILE"
],
"clicks": 429887.0,
"impressions": 1.7090783E7,
"ctr": 0.025153148337323107,
"position": 7.31339517914422
},
{
"keys": [
"DESKTOP"
],
"clicks": 0.0,
"impressions": 66.0,
"ctr": 0.0,
"position": 12.257575757575758
},
...
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-07-23。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-07-23。"],[[["\u003cp\u003eQuery performance data daily for one day's worth of data to avoid exceeding quota and retrieve data for web, image, or video searches.\u003c/p\u003e\n"],["\u003cp\u003eChoose to group results by page or property, understanding that grouping by page with page/query dimensions may result in some data loss.\u003c/p\u003e\n"],["\u003cp\u003eSearch appearance data requires a two-step query process, first identifying search appearance types and then filtering by a specific type for detailed analysis.\u003c/p\u003e\n"],["\u003cp\u003eWhen grouping by page or property, metrics like impressions, clicks, and position are calculated differently, impacting the interpretation of results.\u003c/p\u003e\n"],["\u003cp\u003eTo retrieve comprehensive data, paginate through results by increasing the \u003ccode\u003estartRow\u003c/code\u003e value in subsequent queries until all rows are retrieved.\u003c/p\u003e\n"]]],["To retrieve performance data, run daily queries for one day's data, specifying search types (web, image, etc.) and dimensions (page, query, country, device). Choose to group by page or property. For detailed data (page/query), some data loss may occur. Page through results by incrementing `startRow`. To obtain search appearance data, first query for search appearance types, then query again, filtering by a specific type and desired dimensions. Daily queries must stay under 50K rows per search type.\n"],null,["# Getting your performance data\n\nYou can query your performance data quickly, and without exceeding your quota, by\nrunning a daily query for one day's worth of data.\n\nYou must choose what information you want in your data: which search types (web, image, video, etc.)\nand which dimensions (page, query, country, or device), as well as whether to\n[group results by page\nor property](https://support.google.com/webmasters/answer/7576553#urlorsite). When querying for page and/or query string, some data may be dropped ([*here's why*](#lose_data)).\n\nOverview\n--------\n\n1. We recommend running a query each day for one day's worth of data using one of the [query\n styles described below](#queries). Running a daily query for one day of data should not exceed your daily quota. Data is typically available after 2-3 days; you can learn what is the most recently available data by running a [simple query grouped by date](/webmaster-tools/v1/how-tos/search_analytics#verify--the-presence-of-data) for the past 10 days. In writing your query:\n - Choose whether to group results by page or property.\n - Choose whether you want more complete counts or more dimensions in your query. **Note:** search appearance data (AMP, blue link, rich result, and so on) must be queried using a [two-step process](#search-appearance-data).\n2. Page through results by re-running the same query, increasing the `startRow` value by 25,000 in the request until you reach the last page (a response with 0 rows).\n3. Optionally run the same query with another `type` parameter.\n\nHere is a pseudocode example for a single query. You can run this once per day [for each `type` value](/webmaster-tools/v1/searchanalytics/query#type) that you want data for. \n\n```carbon\nint maxRows = 25000; // Current max response size\nint i = 0;\ndo {\n response = Request(startDate = 3_days_ago,\n endDate = 3_days_ago,\n ... add dimensions, type ...\n rowLimit = maxRows,\n startRow = i * maxRows);\n i++;\n ... // Do something with the response data.\n} while (response.rows.count() != 0); // Page through all result rows\n```\n\nData limits\n-----------\n\nIn addition to [API usage quota, the Search Analytics method](/webmaster-tools/limits)\nexposes a maximum of 50K rows of data per day per search type (web, image, and so on--sorted\nby clicks).\n\nQuery details\n-------------\n\nYou can query data grouped by [page](#by_page) or [property](#by-property).\n\n### Grouped by page\n\n**For accurate counts,** you must omit the page and query dimensions, like this: \n\n```carbon\n\"startDate\": \"2018-06-01\",\n\"endDate\": \"2018-06-01\",\n\"dimensions\": [\"country\", \"device\"],\n\"type\": \"web\",\n\"aggregationType\": \"byPage\"\n```\n\n- `startDate` / `endDate`: Choose a one-day window by selecting the same date.\n- `dimensions`: Optionally include `country` and/or `device`.\n- `type`: Enumerate over [each `type` value](/webmaster-tools/v1/searchanalytics/query#type) as desired in a separate query.\n- `aggregationType`: Must be `byPage`.\n\n**For greater detail, including page and/or query information**, at the expense of losing some data, run a query like this: \n\n```carbon\n\"startDate\": \"2018-06-01\",\n\"endDate\": \"2018-06-01\",\n\"dimensions\": [\"page\", \"query\", \"country\", \"device\"],\n\"type\": \"web\"\n```\n\n- `startDate` / `endDate`: Choose a one-day window by selecting the same date.\n- `dimensions`: Include `page`. Optionally include any combination of `query`, `country`, or `device`.\n- `type`: Enumerate over [each `type` value](/webmaster-tools/v1/searchanalytics/query#type) as desired in a separate query.\n\n### Grouped by property\n\n**For accurate counts,** you must omit the page and query dimensions, like this: \n\n```carbon\n\"startDate\": \"2018-06-01\",\n\"endDate\": \"2018-06-01\",\n\"dimensions\": [\"country\", \"device\"],\n\"type\": \"web\"\n```\n\n- `startDate` / `endDate`: Choose a one-day window by selecting the same date.\n- `dimensions`: Optionally include `country` and/or `device`.\n- `type`: Optionally enumerate over [each `type` value](/webmaster-tools/v1/searchanalytics/query#type) as desired in a separate query.\n\n**For greater detail, including query, country, and/or device information**, at the expense of losing some data, run a query like this: \n\n```carbon\n\"startDate\": \"2018-06-01\",\n\"endDate\": \"2018-06-01\",\n\"dimensions\": [\"query\", \"country\", \"device\"],\n\"type\": \"web\"\n```\n\n- `startDate` / `endDate`: Choose a one-day window by selecting the same date.\n- `dimensions`: Optionally include any combination of `query`, `country`, or `device`.\n- `type`: Enumerate over [each `type` value](/webmaster-tools/v1/searchanalytics/query#type) as desired in a separate query.\n\nGrouping results by page or property\n------------------------------------\n\nImpressions, clicks, position, and click-through-rate are are calculated differently when grouping results by page rather than by property. [Learn more.](https://support.google.com/webmasters/answer/7576553#urlorsite)\n\nWhy do I lose data when asking for more detail?\n-----------------------------------------------\n\nWhen you group by page and/or query, our system may drop some data in order to be able to calculate results in a reasonable time using a reasonable amount of computing resources.\n\nGetting search appearance data\n------------------------------\n\nSearch appearance is not available as a column along with any other dimensions. Therefore, if you want to see search appearance information for your site, you must follow this process:\n\n1. Specify `searchAppearance` as the only dimension, which will group all data by search appearance type with no other dimensions.\n2. Optionally run a second query, filtering by one of the search appearance types listed in step 1, adding any desired dimensions to the query (page, country, query, etc).\n\nTo retrieve data about multiple search appearance types, you must run the second step once per search appearance type listed step 1.\n\n**First query:**\n\nGet list of search appearance types on your site. \n\n```carbon\n{\n \"startDate\": \"2018-05-01\",\n \"endDate\": \"2018-05-31\",\n \"type\": \"web\",\n \"dimensions\": [\n \"searchAppearance\"\n ]\n}\n```\n\n**Results:**\n\nYour site has type INSTANT_APP, AMP_BLUE_LINK, and so on. \n\n```scdoc\n \"rows\": [\n {\n \"keys\": [\n \"INSTANT_APP\"\n ],\n \"clicks\": 443024.0,\n \"impressions\": 4109826.0,\n \"ctr\": 0.10779629113251997,\n \"position\": 1.088168452873674\n },\n {\n \"keys\": [\n \"AMP_BLUE_LINK\"\n ],\n \"clicks\": 429887.0,\n \"impressions\": 1.7090884E7,\n \"ctr\": 0.025152999692701676,\n \"position\": 7.313451603790653\n },...\n```\n\n**Second query:**\n\nFilter by one of the search appearance types found in step 1, along with any dimensions that you like (page, device, etc). Here we filter by AMP_BLUE_LINK. \n\n```carbon\n{\n \"startDate\": \"2018-05-01\",\n \"endDate\": \"2018-05-31\",\n \"type\": \"web\",\n \"dimensions\": [\n \"device\" // and/or page, country, ...\n ],\n \"dimensionFilterGroups\": [\n {\n \"filters\": [\n {\n \"dimension\": \"searchAppearance\",\n \"operator\": \"equals\",\n \"expression\": \"AMP_BLUE_LINK\"\n }\n ]\n }\n ]\n}\n```\n\n**Results:**\n\nBreakdown of AMP_BLUE_LINK by device types. \n\n```text\n\"rows\": [\n {\n \"keys\": [\n \"MOBILE\"\n ],\n \"clicks\": 429887.0,\n \"impressions\": 1.7090783E7,\n \"ctr\": 0.025153148337323107,\n \"position\": 7.31339517914422\n },\n {\n \"keys\": [\n \"DESKTOP\"\n ],\n \"clicks\": 0.0,\n \"impressions\": 66.0,\n \"ctr\": 0.0,\n \"position\": 12.257575757575758\n },\n...\n```"]]