This is a Jitsu.Classic documentation. For the lastest version, please visit docs.jitsu.com. Read about differences here.
Google Analytics
Overview
The Google Analytics connector pulls data from Google Analytics API. The connector is highly configurable and can be used to pull data from Google Ads too (if Google Analytics account is liked to Google Ads). Full list of parameters can be found hereGoogle Analytics exposes following collections: report
How to connect
Following authorization methods are available for Google Analytics- OAuth β you'll need to provide Client Secret / Client Id (you can obtain in in Google Cloud Console) and get a refresh token. Jitsu developed a small CLI utility for obtaining the token
- Service Account β you'll a) create a service account in Google Cloud Console b) share google resource (such as document or analytics property) with this account (account email look like
[username]@jitsu-customers.iam.gserviceaccount.com
) c) put Service Account Key JSON (available in Google Cloud Console) in the field below
1. Obtaining access through OAuth
Jitsu requires 3 parameters for accessing Google Analytics:client_id
- An unique client identifier that is obtained from Google Cloud Consoleclient_secret
- A client secret string that is obtained from Google Cloud Consolerefresh_token
- Access token. It could be generated by jitsucom/oauthcli
Getting client_id
and client_secret
- Go to the API Credentials page
- Click "+ Create Credentials" β "OAuth client ID" β select Desktop app as application type
- Note: If you haven't configured OAuth Consent Screen yet, Google asks to configure it. The screen type should be 'External'
Getting refresh_token
Copy Client ID and Client Secret parameters, use them for generating refresh token with jitsucom/oauthcli tool:./authorizer.py --client_id=<YOUR CLIENT ID> --client_secret=<YOUR CLIENT SECRET> --scope='https://www.googleapis.com/auth/analytics.readonly'
2. Obtaining access through Service Account
At first, create or select Google project. There is a good manual on how to do that
Then create a new Google Service Account:
- Go to the Service Accounts page
- Click "+ Create Service Account"
- Fill Service account name and press DONE
- Click on the Email of created account in Service Accounts table, go to "KEYS" tab
- Click "ADD KEY" β "Create new key" β Select JSON β "CREATE"
- Service Account JSON (private key) will be in downloaded file
Connection Parameters
Parameter | Documentation |
---|---|
auth.type *One of: OAuth , Service Account (required; default: OAuth ) | Jitsu provides two types for authorizing access to Google Services:
|
auth.client_id oauthSecret (not required) | Use Jitsu OAuth CLI Util to obtain oauth credentials |
auth.client_secret oauthSecret (not required) | Use Jitsu OAuth CLI Util to obtain oauth credentials |
auth.refresh_token *string (required) | Use Jitsu OAuth CLI Util to obtain oauth credentials |
auth.service_account_key *json (required) | Use Google Cloud Console to create Service Account get Service Key JSON |
view_id *string (required) | Read about how to find Google Analytics View ID |
Collection parameters
Collection is a set of objects that have the same structure and will be mapped to the same table in destination database. Collection may be configurable, and connector can synchronize several collection of the same type. If you're familiar with object-oriented programming, think of collection as class which can have multiple instances.Google Analytics exposes following collections: report
Collection configuration: report
#
Parameter | Documentation |
---|---|
dimensions Multiple selection (up to 7): ga:userType , ga:visitorType , ga:sessionCount , ga:visitCount ...and 268 more (not required) | Use this tool to check dimensions compatibility |
metrics Multiple selection (up to 10): ga:users , ga:visitors , ga:newUsers , ga:newVisits ...and 256 more (not required) | Use this tool to check metrics compatibility |