Connecting to Google Analytics
Google Analytics (GA) is a service offered by Google that compiles statistics regarding visitors to a website.
This article shows you how to set up a data connector to extract data from your Google Analytics account.
2. Google Analytics account
You must have a Google Analytics account in order to create this data connector in Dundas BI.
To sign up, go to: http://www.google.com/analytics/
3.1. Developers Console Project
You need to create or use an existing project in the Google Developers Console as a first step.
Go to https://console.developers.google.com/project and sign in to your Google/Gmail account.
Once signed in, you'll see a list of existing projects (if there are any) or you can click Create project to create a new one.
In the New Project dialog, enter a name for your project and then click Create.
3.2. Enable the Analytics API
Make sure you are logged into the Developers Console and your project is selected as the current project.
Then click the menu button in the top-left corner.
In the left menu, click API Manager.
Click the Google APIs tab to see the available APIs.
Click the Analytics API link.
Click Enable to enable the Analytics API.
3.3. Service Account Credentials
This section shows you how to generate Service account credentials which will allow Dundas BI to access your Google Analytics data.
In the API Manager, click Credentials in the left navigation. On the right, click Create credentials and select the Service account key option.
Set the Service account dropdown to New service account. Then enter the Name for your service account.
Click Create to generate a certificate file. This file will be needed later to set up a data connector in Dundas BI.
3.3.1. P12 file type
If you require the P12 file type instead of the default JSON, you will require some additional information.
The Service account created dialog is displayed and shows the password for the private key. Copy and paste this password into Notepad for later use.
Close the dialog to see the list of service account keys which includes the one you just created.
Click Manage service accounts in the top-right corner.
Copy and paste the Service account email address into Notepad for later use. You'll need to enter this email address when setting up the data connector in Dundas BI.
Now that the client credentials have been generated, sign in to your Google Analytics account in order to give authorization to these credentials.
Go to the Admin area and click User Management on the left.
In the Add permissions for box, paste the Service account email address that you recorded earlier. Then click Add.
4. Dundas BI Data Connector
From the main menu, click New, and then select Data Connector.
In the New Data Connector dialog, click inside the Name box. Enter a name for your data connector.
Click the Data Provider dropdown and choose Google Analytics.
Click Choose File and select the certificate file.
If the certificate file is of a P12 file type, you have to provide the client credential information that you generated previously:
- Paste the Service Account E-Mail Address that you recorded previously.
- Enter the private key password for the certificate file.
Click Define Structure to define a data connector table that will hold the Google Analytics information you are interested in. Google Analytics provides a lot of data/statistics but you may not need all of it. Using Define Structure allows you to choose specific metrics and dimensions only.
In the Define Data Structure dialog, click Add Table.
Select New Table 1 in the TABLES list and scroll down to the TABLE DETAILS section.
Click the Profile box and select your Google Analytics profile from the dropdown menu.
Click the Metrics box and enter a comma-separated list of metrics. The auto-complete dropdown menu shows you the available choices such as ga:users or ga:visits.
Click the Dimensions box and enter a comma-separated list of dimensions such as ga:city or ga:country.
Specify a start and end date.
Click Submit to return to the New Data Connector dialog.
Click Test Connection to check the connection to your GA account.
If the test is OK, click Submit to create the data connector and perform data discovery.
5. Displaying Google Analytics data
To see the Google Analytics data, create a new dashboard, go to the Explore window, expand your data connector, and drag New Table 1 to the dashboard canvas.