Guide to set-up credentials in RGoogleAnalytics API

This is a walkthrough for creating the project and generating the client id and client secret that you will need to set-up SEO split testing.

This implementation Guide will help you using Google Analytics with R so you can extract your Data in RStudio

Create your first Google API project (Step-By-Step)

It is your first time using a Google API, or even using an API? Don’t worry, this step-by-step guide will walk you through the way to create your RGoogleAnalytics project.


Subscribe to my Newsletter


Step 1: Create your Own Project in Google API Console

Go to Google’s developers console, and go through the sign-in process if it is your first time using it.

In Google Cloud’s console, we will set-up our credentials as you can see in the video. Here, I will add credentials called r-seo-split-test.

Click Select a project > New Project

set up credentials

Step 2: Activate the Google Analytics Reporting API

  1. Go to Dashboard
  2. Click Enable APIs and Services
  3. Search for “analytics”
  4. Select Google Analytics Reporting API
  5. Enable

enable apiIf you are a beginner with R and you want to import your Google Analytics Data with RGoogleAnalytics package, you will need to set up your project in Google Analytics API.

Step 3: Create your credentials

Now that you activated the reporting API, you get a message from Google telling you that you need credentials

To use this API, you may need credentials. Click ‘Create credentials’ to get started.

Indeed, you will need to store your client.id and your client.secret which you now need to generate.

At this point, I find it easier to go in the credential tab on the left instead of only clicking “create credentials”.

1. Create credentials

create your credentials

2. Select OAuth client ID

auth client id

3. Set product name on consent screen

At this step, click on Configure consent screen and give your product a name.

configure consent screen

Here, I will call my product name “r-studio-credentials” and leave the rest of it blank since it is all optional. Click Save.

create google analytics api a name

4. Choose Application Type

For the application type, select other and name it. I will call it rstudio-client.

 creat oauth client ID 

Step 3: Save your client.id and client.secret

You now have generated your client.id and your client.secret, congratulations. Store it somewhere safe, you will need it to make your API call from RStudio and import Google Analytics Data.

copy client id and client secret

This is the end of the tutorial to help you create your project in Google Analytics API. Next. I will show you how to make your first API call from RStudio using RGoogleAnalytics Package.

Other APIs You Might Be Interested In

Looking for the next steps to improve your skills using APIs?

3/5 - (2 votes)