Connecting to Google Analytics API in a Rails app [closed]

点点圈 提交于 2020-01-11 13:00:14

问题


Is there a good tutorial available re: how to interact with the Google Analytics API within a Rails app? I've found this gist, but I'm not sure if every step listed in that gist is necessary.

If that is a good tutorial to follow, where can I download the "key_file" that's mentioned? I can't seem to find it within https://code.google.com/apis/console/. Also, where do I find out my API client email address / SERVICE ACCOUNT EMAIL?


回答1:


I can certainly help you out with the key file and service account email. Google is really good at changing their documentation and procedures often and usually not in that order.

  1. Create your project in the Google console: https://code.google.com/apis/console

  2. Go to API's & Auth and turn off all but the Analytics API.

  3. Go to Credentials (under API's) and click Create a New Client ID.

  4. Select Service Account from the pop up.

  5. Save the .p12 file it will prompt you to download.

  6. The service account email address will be under the Service Account setting box as Email Address and be in the form of xxxxxxxxxxxxxx@developer.gserviceaccount.com (the really long email)

  7. Add this email to the Google analytics profile(s) as a user with Read & Analyze access.

You should now have all the pieces you need to use service account access once you find that Rails tut.

Setting up OAuth 2

As far as you Rails app goes, I found this (you may have as well): Google Analytics API Client Library for Ruby

HTH




回答2:


Legato may be a good place to start. The wiki has a lot of information: https://github.com/tpitale/legato/wiki but you probably need to do two things to get started:

  1. Get an OAuth2 Token
  2. Walk through the Quick Start Guide

Let me know if you have any question.



来源:https://stackoverflow.com/questions/21120772/connecting-to-google-analytics-api-in-a-rails-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!