Extracting Data from Google Analytics

Prior to setting up data extraction from Google Analytics familiarize yourself with the latest prerequisites and implementation and usage notes at Google Analytics Connector.

To extract data from Google Analytics

1. On the Home page select a space or create a new one. This is the space to which the data will be uploaded.
2. Go to Admin - Define Sources - Application Connectors. Alternatively, click the Use Extractors link on the Admin Navigation page.
3. Click New in the Connections panel. The Connection Details window opens.

4. In Connection Details name the connection.
5. Select Google Analytics as the Connector Type.
6. Set the Connector API Version.

For new spaces, select the latest API version (highest version number). 

For existing spaces, test the latest API version before changing from the default API version to the latest API version.

7. Enter your Google Analytics login information:
  1. Service Account Email ID: Provide your Google service account email address.
  2. Private Key File: Click the Browse button to navigate to and select the private key file on your file system. After selecting it, the filename will appear in the Private Key File field. Click Upload to upload it to Birst.
  3. Source File Prefix: You can provide a Source File Prefix if desired. This is used to avoid conflicts with other sources that have the same name in Birst. For example, if you specify "GA" as the source file prefix, the name of the sources that have been extracted from Google Analytics will begin with "GA_"on the Manage Sources page.
8. Click Test Connection to verify that Birst connects to your Google Analytics account.
9. Click Save Connection to save all the settings.
Tip: Your login credentials will be automatically saved the first time you log in so you won't have to type this information again.
10. To specify a Google Analytics source to extract, click Add Object. The New Object dialog box opens.



Tip: Using this dialog box is similar to using the Google Analytics Query Explorer tool.
11. For Object Label, type the name for the source. This name will be displayed in the Manage Sources tab.
Important: Do not use the same name as an existing saved object from this or any other connector. It must be unique within a Birst space. Using a source file prefix can help to differentiate similarly named objects.
12. For Profile ID, select one or more profiles tied to your Google Analytics service account. A profile is the view from which to request data.

Tip: Instead of selecting Profile IDs from the dropdown list, you can use a Birst variable to provide the Profile IDs. If you have created a variable to use for the Profile IDs, check the Use Variable box. The Profile ID dropdown list will be populated with the variables that have been created in this space; select the variable to use. The variable can be a query variable type or a constant variable type and can be either single value or multi-value. A constant variable should contain only the profile ID; multiple profile IDs should be separated by commas (no spaces), for example: ga:10192242,ga:75854219. See Creating Variables.
13. Optionally, select one or more dimensions to extract from the Dimensions dropdown list. You can select a maximum of 7 dimensions at a time.

Tip: If you do not see any dimensions, make sure that the Google Analytics API has been enabled. See the Prerequisites section at Google Analytics Connector.
14. In the Metrics field, select one or more metrics from the dropdown list.

You can select a maximum of 10 metrics at a time.
15. Optionally, select a segment to extract from the Segment dropdown list. Segments are stored filters within Google Analytics.

Tip: The Google Analytics connector does not support data extraction using custom or advanced segments. This is a limitation of the Google Analytics reporting API which does not support data extraction using custom or advanced segments with service accounts.
16. Optionally, in the Filters field enter an expression to filter the data to be extracted using the following syntax:

ga:[dimension or metric] [operator] [expression]

For example: ga:country==Canada

Filters can be concatenated with OR or AND operators. A comma in a filter expression means OR; a semicolon in a filter expression means AND. Click here for a complete list of the supported filter operators for metrics and dimensions.

Operators must be URL-encoded in order to be included in URL query strings.
17. In the Start Date and End Date fields, select the beginning and ending dates for which to extract the data, or alternatively, select a variable to use for the start date and end date. If any variables have been created in the space, you will see Use Variable check boxes next to the Start Date and End Date fields. To use a variable, check the Use Variable check box next to the Start Date or End Date, then select the variable to use in the dropdown list of variables that appears for the Start Date or End Date. (See Creating Variables for information on how to create a Birst variable.)

Variables for the Start Date and End Date must use the following syntax: YYYY-MM-DD.

After creating a new variable, you may need to process data before running the extraction in order for the variable to be recognized and validated during extraction.
18. Optionally, choose a different sampling level. Sampling can be useful if you have a high volume of data. The DEFAULT sampling level is the default setting.

Choose one of the following:

• DEFAULT— Returns a sample size that balances speed and accuracy.
• FASTER— Returns a fast response with a smaller sample size.
• HIGHER_PRECISION— Returns a more accurate response using a large sample size, but this may result in a slower response.

In the extract log, the ContainsSampledData parameter may be false despite the sampling level selected. Also, the numbers for sample size and sample space may differ slightly for each iteration of the object extraction due to the rules Google applies to sampling. See the Google documentation for information about how sampling is used in Google Analytics.
19. After filling out the dialog box, click Validate to verify the syntax.
Tip: Variables cannot be validated. Variables are replaced with the value at runtime.
20. Click Save. After saving the object, it is added to the list of objects to be extracted in the Data Sources table, and is now ready for extraction.
Tips:
To edit an object, click on its name.
To remove an object from the extraction list, click the icon in the Remove column.
21. In the Extract Group Name(s) field, you can specify the name of one or more extract groups (separated by commas) for each object so that specific objects can be extracted and processed separately from others. Click the Save button after adding extract group names. See Creating Extract Groups for more information.
22. Click Extract to upload the selected objects to Birst. You will be prompted to select the extract group(s) to use.

Selecting All in the Extract Group dialog box will extract all selected objects, even those that do not belong to extract groups.
23. Depending on the size of the data objects, the extraction may take a few minutes. You can safely log out of Birst while the extraction takes place and log back in later.

Tip: To cancel the extraction, click the Cancel Extract link under the progress bar.

24. When the extraction is finished, the objects you extracted will be displayed in the Data Sources table with an updated date and time under Last Updated.
25. Click Last Extract Log to view the logs from the data extraction and check for errors.

If an object contains multiple profiles, the extraction is performed for each profile one by one and the results are consolidated. If your object extraction contains more than one Profile ID, check the last extract log to see if all Profile IDs extracted successfully. As long as one Profile ID can be extracted, the extraction will be performed for that Profile ID even if the extraction fails for one or more of the other Profile IDs. Errors will be logged for the Profile IDs that were not successfully extracted. If you are extracting an object using only one Profile ID and the Profile ID fails, the extraction will fail.

The connector appends the profile name in every record extracted from Google Analytics.

Next Steps

Click the Manage Sources page at the top to view the columns and raw data from the extracted objects.

When you are ready to process the extracted data, go to the Process New Data page under the Process Data tab.

To schedule extractions from Google Analytics, use the Schedule Data Processing page under the Process Data tab.

See Also
Scheduling Extraction and Data Processing for Cloud Applications
Processing Data
Creating Extract Groups
Filters for Google Analytics