This extractor allows you to integrate your Google Analytics data into the Keboola Connection environment. To do that, you will need a Google Analytics account.
The Google Analytics extractor works with the newest version of the Google Analytics Reporting API - V4 and provides the following key features:
Metric expressions — The API allows you to request not only built-in metrics but also combinations of metrics expressed in mathematical operations. For example, you can use the expression
ga:goal1completions/ga:sessions to request the goal completions per number of sessions.
Multiple date ranges — The API allows you to get data in two date ranges in a single request.
Multiple segments — The API enables you to get multiple segments in a single request.
Important: Data is always imported incrementally.
Create a new configuration of the Google Analytics extractor. Then click Authorize Account to authorize the configuration. Select the desired Google Analytics account and profiles (views) from which you would like to extract data.
Each query consists of metrics, dimensions and a date range. Optionally, it can be filtered by a filter expression or a segment. Let’s create a simple query with some basic metrics such as Sessions, Users and Pageviews.
Name your query, for example, “Audience”.
From the metrics selector, choose the following metrics:
From the dimensions selector, choose the
Leave the date range on default (last 4 days).
See the query results by hitting the
Test query button.
Now you see sessions, users, and pageviews of the last five days sliced by date.
When you are happy with the results, save your query.
To store the results to Storage, click the “play” icon on the query list page.
A date range specifies a time window from which the data will be extracted. You can use any expression compatible with the PHP strtotime() function.
Multiple date ranges are useful, for example, when you want to compare metric performance to the previous date range. Let’s say you want to see Sessions by month, compared to the same month last year. Of course, you can download all the data from last year, but with this approach, you can download just the data you need.
The Google Analytics API does not always return precise data. Under certain circumstances, the data returned is sampled. To work around this problem and get more precise results, choose either the DailyWalk or Adaptive anti-sampling algorithm. Both divide the wanted date range into smaller chunks. You can configure anti-sampling in the query detail.
DailyWalk, as the name suggests, divides the date range by days. It means that the extractor needs to make as many requests as there are days in the date range. Even though this algorithm might be more precise in some cases, you usually get the same results faster with the Adaptive algorithm.
The Adaptive algorithm uses a more sophisticated approach, splitting the original date range into few smaller date sections. To learn more about it, read this in-depth explanation.
Filters allow you to limit and modify the data that is included in a view. For example, you can use filters to exclude traffic from particular IP addresses, focus on a specific subdomain or directory, or convert dynamic page URLs into readable text strings. If interested, read more about how to use filters.
Learn how to construct a filter expression.
A segment is a subset of your Analytics data. For example, of your entire set of users, one segment might be users from a particular country or city. Another segment might be users who purchase a particular line of products or who visit a specific part of your site. Read more.
Important: When you want to use segments, use the
You will have to type it in, however, because it is not in the option list of dimensions.
It is possible to use custom dimensions and metrics.
Although they are not listed in the selector options, you can type them in manually.
Insert the dimension or metric ID in the format of
ga:dimensionXX where XX is a number, for example
You can find the IDs on the Google Analytics page:
To avoid hitting quota limits, you can use your own OAuth Client ID and Secret:
Select an existing project or create a new one.
Enable the Google Analytics Reporting API.
Select the Credentials section from the menu on the left, click the Create credentials button and select OAuth client ID.
Choose Web Application. Into Authorized redirect URIs insert
The second one is needed for the EU region.
Find your credentials in the list of available credentials. You should see something like this:
You can now use these credentials in the Custom Authorization tab when authorizing the Google Analytics Extractor.