Google Analytic’s API Using Python and a Service Account

Ramblings on startups, NYC, advertising and hacking (mostly Python)

I’m currently building out a metrics dashboard and I wanted to incorporate Google Analytics data along with my own data. Google maintains a Python client so I figured this would be easy. Grab some OAuth 2 keys and away we go.

Sadly that’s not the case. It took a bit of digging and piecing together numerous articles and blog posts to get everything working.

So here’s how to do it…

1) First you’ll need to login to the Google Developers Console and create a new project. If you’ve already got a project to use, you can skip this step.

2) Next, activate the Google Analytics API for your project.

3) Then create your credentials by creating a new service account.

4) When you create the credentials, you will automatically download a P12 key file (.p12). Save this with your Python application as you’ll be using it shortly.


View original post 609 more words