Configuring Service Account Authentication for Google Analytics
The Google Analytics connector allows you to track and report website traffic using the Google Analytics service.
Before using this connector, the following general steps must be performed:
-
Configure the Google Analytics Service Account Authentication
-
Enable the Analytics API
-
Set Edit Permissions to the Service Account ID
-
Extract Profile ID from the URL
Each step is discussed in details below.
Steps:
The authentication mode needs to be enabled from the account email that you will use.
-
Go to http://console.developers.google.com and log-on using your credentials.
The Google APIs page is displayed:
The Google Analytics connector works on a service account authentication mode. To create a service account, you must first create a project.
-
On the API Manager section (left of the page), click Credentials.
The Credentials page displays
-
Click Create Credentials and choose Service Account Key to create credentials for the service account authentication:
The Credentials page is refreshed to display:
-
Create Service Account credentials by selecting New Service Account.
You are asked to supply Service Account credentials:
-
Enter the Service Account Name. This is appended in the Service Account ID box. Select the P12 Key Type and click Create.
A Service Account Has No Role prompt is displayed. You may opt to select a role or add one or more later in the IAM & Admin section.
-
For now, click Create without a role.
Once the service account is created, it will download a file that contains the private key. Note: You need to save a copy of this key file.
Enabling the Analytics API
Steps:
-
In the API Manager, click Library to display the Library page and select Analytics API.
-
The Analytics API page is displayed.
-
Click Enable.
Setting edit permissions for the Service Account ID
Before using the Google Analytics connector, users must request for their service provider account access from the administrator.
Steps:
-
Send the generated service account ID to the Google Analytics administrator.
-
The administrator grants permissions to the user in the Admin > User Management page in their Google Analytics account.
-
The administrator must ensure to give Edit permission to the user.
Extracting profile IDs from the URL
Aside from the Service Account ID and the key file, you also need to extract the Profile ID from the URL in order to connect to the Google Analytics connector in Monarch Data Prep Studio.
Steps:
-
Go to http://analytics.google.com and sign in.
The Google Analytics account page is displayed.
-
Check the URL and extract the Profile ID.
For example, in: https://analytics.google.com/analytics/web/#report/visitors-network/a80671637w119952643p125500546/
All of the digits that follow p is the Profile ID (e.g., 125500546)
Using the Google Analytics Connector in Monarch Data Prep Studio
How the Google Analytics connector is used in Monarch Data Prep Studio is discussed in Connector Dialog for Google Analytics