异常:配额错误:超出用户速率限制 [英] Exception: Quota Error: User Rate Limit Exceeded

查看:71
本文介绍了异常:配额错误:超出用户速率限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Apps脚本,可以在其中循环通过我的Google Analytics(分析)帐户,直到进入某个配置文件.
if(profileItems [i] .getName()=="Dev Test")
与另一个函数相比(请参见下文),我调用了Google Analytics(分析)API,并始终引发了异常:异常:配额错误:超出了用户速率限制

I have a Apps Script where I Loop trough my Google Analytics Account till I get to a certain Profile.
if (profileItems[i].getName() == "Dev Test" )
Than in another function (see bellow) I make the call to the Google Analytics API and always get the Exception thrown: Exception: Quota Error: User Rate Limit Exceeded

function getReportDataForProfile(profileId) {
var tableId = 'ga:' + profileId;
var startDate = getLastNdays(14);   // 2 weeks (a fortnight) ago.
var endDate = getLastNdays(0);      // Today.

var optArgs = {
  'dimensions': 'ga:keyword',              // Comma separated list of dimensions.
  'sort': '-ga:visits,ga:keyword',         // Sort by visits descending, then keyword.
  'segment': 'dynamic::ga:isMobile==Yes',  // Process only mobile traffic.
  'filters': 'ga:source==google',          // Display only google traffic.
  'start-index': '1',
  'max-results': '250'                     // Display the first 250 results.
};

//
//Exponential Backoff
//
for (var n=0; n<6; n++) {
try {
     var results = Analytics.Data.Ga.get(
     tableId,                  // Table id (format ga:xxxxxx).
     startDate,                // Start-date (format yyyy-MM-dd).
     endDate,                  // End-date (format yyyy-MM-dd).
     'ga:visits,ga:pageviews', // Comma seperated list of metrics.
     optArgs);
 } catch(e) {
   if (n == 5) {
     //var results = e;
     //throw new Error('Quota ERROR');
     throw (e) 
   } 
   Utilities.sleep((Math.pow(2,n)*1000) + (Math.round(Math.random() * 1000)));
  }    
}   
 return results;
}   

  • 我将API控制台中的每用户限制"数量增加到10.0
  • 使用的Porcentage为6%
  • 然后我应用了指数补偿
  • 我还相信,仅要求访问和网页浏览量并不是夸大了我的电话数量.
  • 完整代码

    任何想法发生了什么事?

    Any ideias what is going on?

    推荐答案

    也许您超出了每个配置文件每秒的最大请求数.看起来它设置为10( https://developers.google.com/analytics/devguides/reporting/core/v3/limits-quotas )

    Maybe you are exceeding the max request per profile per second. That looks like it's set to 10 (https://developers.google.com/analytics/devguides/reporting/core/v3/limits-quotas)

    这篇关于异常:配额错误:超出用户速率限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆