Settings for Google Sheets/Google Analytics

This topic describes how to set up the Google Sheets and Google Analytics connections for DataSync.

Note

The same procedure applies to these two connections. The only difference is that they use a different CallBack URL address.

Important

Before starting, make sure that you have a Google account.

  1. In your Web browser, go to https://console.developers.google.com/.
  2. In the Email or Phone field, enter your email address or phone number and click Next.

  3. Enter your password and click Next.
  4. 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:
    1. In the Dashboard tab, click Create project.

    2. Enter a Name for your project, select the Location where you want the project to be created and click Create.

  5. Once your project is selected, in the upper bar, click Enable APIs and Services.

  6. In the API Library, use the Search Bar to select the API you want to enable:
    1. Enter Google Sheets or Google Analytics depending on the one you want to activate and click it.

    2. Click Enable.
  1. Use the search bar to find Google Drive, then click it.
  2. Click Enable.

    Important

    The Google Drive API must also be enabled, or the following error message will be displayed:

  1. In the upper-left hand corner click the navigation menu, mouse over API &Services and select OAuth consent screen.

  2. Under the User Type section, select External and click Create.
  3. On the OAuth consent screen:
    1. In the Application name field, enter a name for the application to better identify it in the list.
    2. Click Add scopes to define the Permission Level you want to grant to this application.
    3. In the Authorized Domains field, enter the DataSync server and your company domain.

    4. At the bottom of the page, click Save to finish.
  4. In the left menu, click Credentials.
  5. In the upper bar, click + Credentials and select OAuth Client ID.

  6. In the Application Type section, select Web Application.
  7. Enter a name for the application to better identify it in the list.
  8. Define the Restrictions section according to your preferences and click Create.

    Note

    The following window confirms your credentials are created. Click OK to close this window.

  1. Under the OAuth 2.0 Client IDs section, click the Client you have created.
  2. In another browser tab, go to DataSync and create a new Source Connection.
  3. In the list, select Google Sheets or Google Analytics.
  4. Copy the Callback URL address from the field in DataSync.


  5. Back to the Google API tab, under the Authorized redirect URI section, click Add URI and paste the Callback URL address into this field.

  6. In the right section, copy the content in the Client ID and Client Secret fields and paste it into their respective fields in DataSync.
  7. Come back to the Google API tab and click Save to finish the setting of this client.
  8. 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.

  9. Click Save.

  10. 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.

    Note

    This window confirms that the Google Sheets/Google Analytics connection is successfully created.

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.

  1. Select the tables and views you want to use.

  2. Click Save.

Important

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.

  1. In the Tables list, click on the number under the Fields column to make your selection.

  2. Select the Sync options of the fields you want to use.
  3. Once you're done, go back to the Tables list.

For View type tables, a filter specifying a date range needs to be set.

  1. In the Tables list, under the Filter column, click the pencil icon on the row of a View type table.

  2. 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'

  3. Click Save to finish.
Note

For more information regarding the queries and responses of this API, please refer to the Google official website.