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)
到
DueArgumentError: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