Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 谷歌分析API和Rails_Ruby On Rails 4_Service_Google Analytics Api - Fatal编程技术网

Ruby on rails 4 谷歌分析API和Rails

Ruby on rails 4 谷歌分析API和Rails,ruby-on-rails-4,service,google-analytics-api,Ruby On Rails 4,Service,Google Analytics Api,我正在使用google-api-client-0.8.2和rails4.2.3。我正在使用的服务代码就是。环境变量都设置好了,我从 # these from https://www.google.com/analytics/ GA_VIEW_ID: Admin > Select Site > View Tab > View Settings GA_APP_NAME: Home > name of folder with code in parenthesis # th

我正在使用
google-api-client-0.8.2
rails4.2.3
。我正在使用的服务代码就是。环境变量都设置好了,我从

# these from https://www.google.com/analytics/
GA_VIEW_ID: Admin > Select Site > View Tab > View Settings 
GA_APP_NAME: Home > name of folder with code in parenthesis

# these from https://console.developers.google.com/
GA_SERVICE_ACCOUNT_EMAIL: Project > API > Credentials > 123@developer.gserviceaccount.com
GA_KEY_FILE_NAME: Same path above > P12 Key
我也变了

service_account = Google::APIClient::JWTAsserter.new(
  ENV['GA_SERVICE_ACCOUNT_EMAIL'], key)

Due
ArgumentError:jwt_asserter上的参数数目错误(3..4为2)。rb:66:在“初始化”中

每次我尝试使用
#visitors
方法进行查询时,我都会收到
权限不足
。我做错了什么

编辑: 我变了

'https://www.googleapis.com/auth/prediction' -> https://www.googleapis.com/auth/analytics.readonly
消息变了


用户没有任何Google Analytics帐户

我只需要授予
123@developer.gservice...
在屏幕上

Manage > User Management tab
Manage > User Management tab