Skip to main content Link Search Menu Expand Document (external link)

Google Analytics

Setup The Datasource

Create a Service Account

  1. Open the Service accounts page. If prompted, select a project.
  2. Click Create service account.
  3. In the Create service account window, type a name for the service account, and select Furnish a new private key. When prompted, select JSON key file type. Then click Create.

Your new public/private key pair is generated and downloaded to your machine; it serves as the only copy of this key. You are responsible for storing it securely.

Enable the API

You will need to enable “Analytics API” for your Google Cloud project.

Add service account to the Google Analytics account

The newly created service account will have an email address that looks similar to quickstart@PROJECT-ID.iam.gserviceaccount.com Use this email address to add a user to the Google Analytics view you want to access via the API. For Redash only Read & Analyze permissions are needed.

Create Datasource in Cast

Create Datasource of “Google Analytics” type with the JSON file generated in the “Create a Service Account” step.

Queries

Google Analytics uses JSON document-style queries. You can get an idea of possible field types and dimensions using the Query Explorer tool. Once you’ve imported data into Redash, you can use the Query Results Data Source to examine the output with SQL syntax.