cancel
Showing results for 
Search instead for 
Did you mean: 
antonvolov
Sisense Team Member
Sisense Team Member

Google Analytics CDATA Connector

 

What You’ll Learn:

In this course users will learn how to:

  • Download a CDATA Google Analytics (GA) driver
  • Install a CDATA GA driver
  • Configure a CDATA GA driver
  • How to connect using a CDATA GA driver

 

Prerequisites:

This article will be helpful for users with basic knowledge of the following: 

  • Familiarity with Sisense UI
  • Familiarity with the concept of data connectors
  • Basic knowledge of Linux/ Windows

 

Introduction:

In May 2022, after Google’s April announcement deprecating an old API, Sisense announced that they will also be deprecating the native Google Analytics connector. 

For existing customers, the native connector will continue to work until early August 2023. Despite these hurdles, users can still use CDATA drivers as a workaround in order to connect. 

 

Instructions On How To Connect To Google Analytics Using A CDATA Driver:

There are 2 ways to use a CDATA connector:

  1. Option 1, involves using the CDATA connector's internal generic clientId and clientSecret. It takes less effort but is also less customizable.
  2. Option 2, requires creating an app in Google to generate credentials (clientId and clientSecret). Although this option is more customizable, it also takes more effort.

Option 1: Less Customized, Less Effort:

  1. Download the driver from Sisense Connectors | Sisense Data Connectivity | CData Software.
  2. Install it locally in the customer’s environment.
  3. Navigate to (if installed in the default location):
    1. /Applications/CData/CData JDBC Driver for Google Analytics 2022/lib if using MacOS.
    2. C:\Program Files\CData\CData JDBC Driver for Google Analytics 2022\lib if using Windows.
  4. Execute cdata.jdbc.googleanalytics.jar
  5. Add the following parameters to make it work:
    1. AuthScheme=OAuth;
    2. OAuth=GETANDREFRESH;
    3. Resulting connection string looks as follows: jdbc:googleanalytics:AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH
  6. Hit “Test Connection”. You will be redirected to the web browser to log in to your Google account.
  7. Once authenticated, the connection successful message will appear in the jar and the connection string will be updated. Click “Copy to Clipboard” to copy the connection string.
  8. antonvolov_0-1669830884902.png

     

    OAuthSettings.txt will be generated containing the connection parameters in the following location:
    1. %APPDATA%\\CData\\GoogleAnalytics Data Provider\\OAuthSettings.txt for Windows
    2. ~/Library/Application Support for macOS.
    3. If you can’t find the file, I recommend setting the OAuthSettingsLocation in the jar itself.
  9. Copy OAuthSettings.txt to the Sisense server:
    1. C:\OAuthSettings.txt for Windows deployments.
    2. /opt/sisense/storage/data/OAuthSettings.txt for Linux deployments.
  10. Copy cdata.jdbc.googleanalytics.jar to the Sisense server. You can check the following documentation for an exact step-by-step guide. For example:
    1. /opt/sisense/storage/data/GoogleAnalytics - for Linux
    2. C:\Program Files\Sisense\DataConnectors\JVMContainer\Connectors\CData JDBC Driver for Google Analytics 2022\lib - for Windows
  11. Connect to Google Analytics using Sisense:
    1. Use the connection string from step 7 but change the OAuthSettingsLocation: jdbc:googleanalytics:AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthSettingsLocation="/opt/sisense/storage/data/OAuthsettings.txt";_persist_oauthrefreshtoken=oauthRefreshToken;_persist_oauthexpiresin=3599;_persist_oauthaccesstoken=oauthAccessToken;_persist_oauthtokentimestamp=XXXXXXXXXXXXX;
    2. Jar’s folder (the one you copied the jar file into in step 10):
      1. /opt/sisense/storage/data/GoogleAnalytics
      2. C:\Program Files\Sisense\DataConnectors\JVMContainer\Connectors\CData JDBC Driver for Google Analytics 2022\lib
    3. Driver class name: cdata.jdbc.googleanalytics.GoogleAnalyticsDriverantonvolov_1-1669830884870.png 

       

Option 2: More Customized, More Effort:

  1. Download the driver from Sisense Connectors | Sisense Data Connectivity | CData Software page.
  2. Install it locally in the customer’s environment.
  3. Navigate to (if installed in the default location):
    1. /Applications/CData/CData JDBC Driver for Google Analytics 2022/lib if using MacOS.
    2. C:\Program Files\CData\CData JDBC Driver for Google Analytics 2022\lib if using Windows.
  4. Execute cdata.jdbc.googleanalytics.jar
  5. You will need to add the following parameters to make it work:
    1. AuthScheme=OAuth;
    2. OAuth=GETANDREFRESH;
    3. OAuthClientId=clientId; NOTE: If the customer is new, use this documentation to create a google app. For customers who already use our native Google Analytics driver, you will need to specify the clientId which can be retrieved from manifest.json from the old connector. Possible locations:
      1. /opt/sisense/storage/connectors/googleanalytics/manifest.json
      2. C:\Program Files\Sisense\DataConnectors\DotNetContainer\Connectors\GoogleAnalytics\manifest.json
      3. C:\Program Files\Sisense\DataConnectors\JVMContainer\Connectors\GoogleAnalytics\manifest.json

OAuthClientSecret=clientSecret; NOTE: The same as OAuthClientId retrieved from manifest.json.antonvolov_2-1669830884859.png

  1. The resulting connection string should look like the following: jdbc:googleanalytics:AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=clientId;OAuthClientSecret=clientSecret;slosada_0-1669833737749.png

     

6. Before hitting “Test connection” in the jar file you will need to navigate to your Google application using Google API Console and add “http://localhost:33333” to the ‘Authorized redirect URIs’ field.

antonvolov_4-1669830884786.png7. Hit “Test Connection”. You will be redirected to the web browser to log in to your Google account.

8. Once authenticated the connection successful message will appear in the jar.

9. The connection string will be updated to incorporate tokens obtained from Google. Click “Copy to Clipboard” to copy the connection string. You will need it to set up the connection in Sisense:

antonvolov_5-1669830884972.png

10. OAuthSettings.txt will be generated containing the connection parameters in the following location:

    1. %APPDATA%\\CData\\GoogleAnalytics Data Provider\\OAuthSettings.txt for Windows
    2. ~/Library/Application Support for MacOS
    3. If you can’t find the file, I recommend setting the OAuthSettingsLocation in the jar itself.

11. Copy OAuthSettings.txt to the Sisense server:

    1. C:\OAuthSettings.txt for Windows deployments.
    2. /opt/sisense/storage/data/OAuthSettings.txt for Linux deployments.

12. Copy cdata.jdbc.googleanalytics.jar to the Sisense server. You can check the following documentation for an exact step-by-step guide. For example:

    1. /opt/sisense/storage/data/GoogleAnalytics - for Linux
    2. C:\Program Files\Sisense\DataConnectors\JVMContainer\Connectors\CData JDBC Driver for Google Analytics 2022\lib - for Windows

13. Connect to Google Analytics using Sisense:

    1. Use the connection string from step 9, but change the OAuthSettingsLocation: jdbc:googleanalytics:AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=clientId;OAuthClientSecret=clientSecret;OAuthSettingsLocation="/opt/sisense/storage/data/OAuthsettings.txt";_persist_oauthrefreshtoken=oauthRefreshToken;_persist_oauthexpiresin=3599;_persist_oauthaccesstoken=oauthAccessToken;_persist_oauthtokentimestamp=XXXXXXXXXXXXX;
    2. Jar’s folder (the one you copied the jar file into in the step 12):
      1. /opt/sisense/storage/data/GoogleAnalytics
      2. C:\Program Files\Sisense\DataConnectors\JVMContainer\Connectors\CData JDBC Driver for Google Analytics 2022\lib
    3. Driver class name: cdata.jdbc.googleanalytics.GoogleAnalyticsDriverantonvolov_6-1669830884886.png

       

Please keep in mind that the CDATA table/column structure is different from Sisense’s native drivers which means that you might need to redesign your data models.

To learn about the CDATA table/column structure and the nuances of using the connector, I highly recommend checking out the following CDATA documentation:

CData JDBC Driver for Google Analytics - CData JDBC Driver for Google Analytics

 

Conclusion:

If you were worried about Sisense’s announcement deprecating the native Google Analytics connector, don’t worry! This practical article shows users how to use the CDATA driver to connect to and keep using Google Analytics as a data source. 

Rate this article:
Version history
Last update:
‎02-13-2024 11:44 AM
Updated by: