在 Rails 应用程序中连接到 Google Analytics API [英] Connecting to Google Analytics API in a Rails app

查看:17
本文介绍了在 Rails 应用程序中连接到 Google Analytics API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有关于如何在 Rails 应用中与 Google Analytics API 交互的好教程?我找到了

HTH

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?

解决方案

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

这篇关于在 Rails 应用程序中连接到 Google Analytics API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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