Prerequisites:

  • Client application registered with Google Cloud
  • An access token or refresh token

After you have registered your client application with Google Cloud and obtained the required OAuth information, you may configure the driver to access Google Analytics resources using OAuth 2.0.

To configure the driver, you must provide either the access token or the refresh token.

  • Set the Access Token (AccessToken) option to specify the access token you have obtained from Google. Generally, an access token is available for a short period of time and may only be used for a single session.
  • Set the Refresh Token (RefreshToken) option to specify the refresh token you have obtained from Google. With a valid refresh token, the driver can obtain a new access token. In this way, a refresh token enables application access to Google for multiple sessions over an extended period of time.

The Access Token and Refresh Token options may both be specified. If a value for the Access Token option is not specified, the driver uses the value of the Refresh Token option to make a connection. If both values are not specified, the driver cannot make a successful connection. If both are specified, the driver ignores the Access Token value and uses the Refresh Token value to generate a new Access Token value.

For information on setting up OAuth 2.0 authentication, including obtaining access and refresh tokens, see OAuth 2.0 authentication.

The following examples show the specification of the Access Token and Refresh Token options.

Connection string

DRIVER=Datadirect 8.0 Google Analytics 4;AddTables='{myTableDefinitionString}';
AccessToken=abcDEF123ghi-456Jklmno789-Pqrst01234;
ClientID=ab123c45-def6-7g89-gh1i-m2345no67891.apps.googleusercontent.com;
ClientSecret=12a3=bCD/EfGh4Ijk+Lm5P67qR8s=//TuV+WXy1Zabcd;
RefreshToken=1//12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831;

odbc.ini file

[Google Analytics]
Driver=ODBCHOME/lib/ivgoogleanalytics28.so 
...
Description=DataDirect 8.0 Google Analytics
...
AddTables='{myTableDefinitionString}'
...
AccessToken=abcDEF123ghi-456Jklmno789-Pqrst01234;
...
ClientID=ab123c45-def6-7g89-gh1i-m2345no67891.apps.googleusercontent.com;
...
ClientSecret=12a3=bCD/EfGh4Ijk+Lm5P67qR8s=//TuV+WXy1Zabcd;
...
RefreshToken=1//12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831;
...