How to connect Google Analytics to Redash?
⏱ Время чтения текста – 4 минутыIn this article we will take a look at how to connect the data source Google Analytic to the service Redash [We have already examined Redash and its opportunities more thoroughly in the previous notes].
Creating service account in Google
Moving to console of service accounts.
In the window of account creating we insert the name, forming a new key afterwards. We select that we need JSON key and then press “Create”.
Integrating Analytics API
For the service account we’ve created, we need to integrate Analytics API.
Adding service user to Google Analytics
Next, we need to create the service user we’ve created to Google Analytics. The user will look approximately as follows:
user@PROJECT-ID.iam.gserviceaccount.com.
It is necessary to add the user with rights to Reading and View.
Creating new data source in Redash
Moving to settings (Settings) -> Adding new data source
We are interested in data source Google Analytics, therefore we search “google”:
Let’s recall where we’ve saved JSON file, we are going to need it now
Writing a query to the new data source
The query in Redash looks as follows:
{
"ids": "ga:128886640",
"start_date": "30daysAgo",
"end_date": "yesterday",
"metrics": "ga:users,ga:newUsers,ga:goal1Starts,ga:goal2Completions,ga:goal3Starts,ga:transactions,ga:transactionRevenue",
"dimensions": "ga:date"
}
How to know parameters for query execution?
Google has a great resource Query Explorer, in which one can find all the required metrics and measurements, that are available in Google Analytics.
I hope, this instruction was useful for you, further on we will find out how to make a goals funnel in Redash, basing on the data from Google Analytics.