Settings for Google Sheets/Google Analytics
This topic describes how to set up the Google Sheets and Google Analytics connections for DataSync.
The same procedure applies to these two connections. The only difference is that they use a different CallBack URL address.
Before starting, make sure that you have a Google account.
- In your Web browser, go to https://console.developers.google.com/.
-
In the Email or Phone field, enter your email address or phone number and click Next.
- Enter your password and click Next.
- In order to use Google API, you must have at least one Project created. If you already have a Project, go directly to step 5. Otherwise do as follows:
-
Once your project is selected, in the upper bar, click Enable APIs and Services.
- In the API Library, use the Search Bar to select the API you want to enable:
- Use the search bar to find Google Drive, then click it.
-
Click Enable.
-
In the upper-left hand corner click the navigation menu, mouse over API &Services and select OAuth consent screen.
- Under the User Type section, select External and click Create.
- On the OAuth consent screen:
- In the Application name field, enter a name for the application to better identify it in the list.
- Click Add scopes to define the Permission Level you want to grant to this application.
In the Authorized Domains field, enter the DataSync server and your company domain.
- At the bottom of the page, click Save to finish.
- In the left menu, click Credentials.
-
In the upper bar, click + Credentials and select OAuth Client ID.
- In the Application Type section, select Web Application.
- Enter a name for the application to better identify it in the list.
-
Define the Restrictions section according to your preferences and click Create.
- Under the OAuth 2.0 Client IDs section, click the Client you have created.
- In another browser tab, go to DataSync and create a new Source Connection.
- In the list, select Google Sheets or Google Analytics.
-
Copy the Callback URL address from the field in DataSync.
-
Back to the Google API tab, under the Authorized redirect URI section, click Add URI and paste the Callback URL address into this field.
- In the right section, copy the content in the Client ID and Client Secret fields and paste it into their respective fields in DataSync.
- Come back to the Google API tab and click Save to finish the setting of this client.
-
Come back to the DataSync tab, and in the Description field, enter a name for this source connection. Change the other settings (Tracking type etc.) according to your preferences.
-
Click Save.
-
You will be directed to the Sign in with Google screen in order to authenticate this Source connection with the Google account you used to create the API.
Click Allow to finish.
Extraction with Google Analytics
Once you have also created a Destination connection (refer to Adding a Source and Destination Connection for Google Analytics, you will need to Adding an Extraction and Setting Up the Extraction to retrieve data.
After clicking Create, a pop-up window appears so that you can choose the tables and views you want to retrieve data from.
Regarding the extractions, Google Analytics only allows up to 10 metrics (measures) and seven dimensions in a single query for View type tables.
When adding a view, all columns are selected by default. In order to comply with the limitations imposed by Google, you need to make sure that a maximum of 10 metrics (measures) and seven dimensions are selected.
-
In the Tables list, click on the number under the Fields column to make your selection.
- Select the Sync options of the fields you want to use.
- Once you're done, go back to the Tables list.
For View type tables, a filter specifying a date range needs to be set.
-
In the Tables list, under the Filter column, click the pencil icon on the row of a View type table.
-
Enter the following query as follows by replacing the mention 'DATE_VALUE' with values of a date range:
StartDate='DATE_VALUE' AND EndDate='DATE_VALUE'
- Click Save to finish.
For more information regarding the queries and responses of this API, please refer to the Google official website.