简体   繁体   English

数据范围提取问题的 Google Analytics API 限制

[英]Google Analytics API limit of Data range extraction issue

I'm trying to extract some dimensions and metrics data from Google Analytics API using the Java client library.我正在尝试使用 Java 客户端库从 Google Analytics API 中提取一些维度和指标数据。

For a specific viewID I see that I cannot extract more than 14 months & 2 days of data starting from today.对于特定的 viewID,我发现从今天开始我无法提取超过 14 个月和 2 天的数据。 I am faced this problem only with the Java client library and the API and for some specific views.我只在 Java 客户端库和 API 以及某些特定视图中遇到此问题。 In the Google interface I can see all reports without the 14 months limits.在 Google 界面中,我可以查看没有 14 个月限制的所有报告。

This Java code :此 Java 代码:

DateRange dateRange = new DateRange().setStartDate(startDate).setEndDate(endDate);

    DimensionFilter dimensionFilter = new DimensionFilter();
    dimensionFilter.setDimensionName("ga:medium");
    dimensionFilter.setOperator("EXACT");
    dimensionFilter.setExpressions(Collections.singletonList("organic"));
    DimensionFilterClause dimensionFilterClause = new DimensionFilterClause();
    dimensionFilterClause.setFilters(Collections.singletonList(dimensionFilter));

    MetricFilter metricFilter = new MetricFilter();
    metricFilter.setMetricName("ga:sessions");
    metricFilter.setNot(true);
    metricFilter.setComparisonValue("0");
    MetricFilterClause metricFilterClause = new MetricFilterClause();
    metricFilterClause.setFilters(Collections.singletonList(metricFilter));

    ReportRequest reportRequest = new ReportRequest()
            .setViewId(viewID)
            .setDateRanges(Collections.singletonList(dateRange))
            .setSamplingLevel(samplinglevel.name())
            .setPageSize(100000)
            .setDimensionFilterClauses(Collections.singletonList(dimensionFilterClause))
            .setMetricFilterClauses(Collections.singletonList(metricFilterClause))
            .setDimensions(dimensionList)
            .setMetrics(metricList)
            .setIncludeEmptyRows(false);

I can extract normally all others views without a limit, but for a specific client a found this problem.我通常可以无限制地提取所有其他视图,但是对于特定客户,发现了这个问题。

Do you have any idea about this limits issue ?你对这个限制问题有什么想法吗?

I can't find any information on these limit in Java.我在 Java 中找不到有关这些限制的任何信息。

Quota Issue配额问题

there are a number of quotas for the Google Analytics api. Google Analytics api 有许多配额。 Limits and Quotas 限制和配额

General quota limits一般配额限制

  • 50,000 requests per project per day, which can be increased.每个项目每天 50,000 个请求,可以增加。
  • 10 queries per second (QPS) per IP address.每个 IP 地址每秒 10 个查询 (QPS)。 In the API Console, there is a similar quota referred to as Requests per 100 seconds per user.在 API 控制台中,有一个类似的配额,称为每个用户每 100 秒的请求数。 By default, it is set to 100 requests per 100 seconds per user and can be adjusted to a maximum value of 1,000.默认情况下,它设置为每个用户每 100 秒 100 个请求,并且可以调整为最大值 1,000。 But the number of requests to the API is restricted to a maximum of 10 requests per second per user.但是对 API 的请求数量限制为每个用户每秒最多 10 个请求。
  • If your application makes all API requests from a single IP address (ie, on behalf of your users), use the userIP or quotaUser parameter with each request to get full QPS quota for each user.如果您的应用程序从单个 IP 地址(即代表您的用户)发出所有 API 请求,请在每个请求中使用 userIP 或 quotaUser 参数以获得每个用户的完整 QPS 配额。 See the standard query parameters summary for details.有关详细信息,请参阅标准查询参数摘要。

Reporting APIs报告 API

The following quotas apply to all Reporting APIs, including the Core Reporting API v3, Analytics Reporting API v4, Real Time API v3, and Multi-channel Funnel API v3:以下配额适用于所有报告 API,包括 Core Reporting API v3、Analytics Reporting API v4、Real Time API v3 和 Multi-channel Funnel API v3:

  • 10,000 requests per view (profile) per day (cannot be increased)每天每个视图(配置文件)10,000 个请求(不能增加)
  • 10 concurrent requests per view (profile) (cannot be increased)每个视图(配置文件)10 个并发请求(不能增加)

Its hard for me to know which quota you are hitting as you have not posted the message.由于您还没有发布消息,我很难知道您达到了哪个配额。 However if you are saying its a single view then i would suggest to me that it is the 10000 requests a data quota and that this view must have more data than your other views.但是,如果您说它是一个单一视图,那么我会向我建议它是 10000 个请求的数据配额,并且该视图必须比您的其他视图具有更多的数据。 There is nothing you can do to extend this quota.您无法扩展此配额。 You can only tune your requests so that you make fewer requests.您只能调整请求以减少请求。

Note: google is not using the same client id as you are so they are not bound by the limits that your client is.注意:google 使用的客户端 ID 与您不同,因此它们不受您的客户端限制的约束。 If your client runs itself out of quota then its not going to work.如果您的客户端用完配额,则无法正常工作。 This will not effect the google analytics website.这不会影响谷歌分析网站。

NO DATA没有数据

If a request returns zero rows then this is not a quota issue there is simply no data for the dates and metadata you are requesting.如果请求返回零行,则这不是配额问题,您请求的日期和元数据根本没有数据。

I would suspect there is an issue with all those filters you are using.我怀疑您使用的所有过滤器都存在问题。

Run a request with just ga:date dimension and the ga:sessions metric.仅使用 ga:date 维度和 ga:sessions 指标运行请求。 Dont add your filters.不要添加过滤器。 Run it for 2010-01-01 - 2019-01-01 this should help you find out where the data started being recorded or if its an issue with all those filters you have added.在 2010-01-01 - 2019-01-01 运行它,这应该可以帮助您找出数据开始记录的位置,或者您添加的所有过滤器是否存在问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM