Easysoft ODBC-Google-Analytics Driver User's Guide - Configuration

Configuring the Easysoft ODBC-Google-Analytics Driver

The Easysoft ODBC-Google-Analytics Driver is installed on the computer where your applications are running. ODBC applications access ODBC drivers through the ODBC Driver Manager and a data source. The data source tells the Driver Manager which ODBC driver to load and pass connection details to. This chapter describes how to create data sources, use DSN-less connections and configure the Easysoft ODBC-Google-Analytics Driver.

Before setting up a data source, you must have successfully installed the Easysoft ODBC-Google-Analytics Driver.

For Easysoft ODBC-Google-Analytics Driver installation instructions, see Installation.

Chapter Guide

Configuring the Easysoft ODBC-Google-Analytics Driver

This section describes how to configure the Easysoft ODBC-Google-Analytics Driver to retrieve Google Analytics data by using a data source or a DSN-less connection string.

Setting Up Data Sources on Unix

There are two ways to set up a data source to your Google Analytics data:

¯ OR ¯

By default, the Easysoft ODBC-Google-Analytics Driver installation creates a SYSTEM data source named [GOOGLE_ANALYTICS_SAMPLE]. If you are using the unixODBC included in the Easysoft ODBC-Google-Analytics Driver distribution, the SYSTEM odbc.ini file is in /etc.

If you built unixODBC yourself, or installed it from some other source, SYSTEM data sources are stored in the path specified with the configure option --sysconfdir=directory. If sysconfdir was not specified when unixODBC was configured and built, it defaults to /usr/local/etc.

If you accepted the default choices when installing the Easysoft ODBC-Google-Analytics Driver, USER data sources must be created and edited in $HOME/.odbc.ini.


Note

To display the directory where unixODBC stores SYSTEM and USER data sources, type odbcinst -j.

By default, you must be logged in as root to edit a SYSTEM data source defined in /etc/odbc.ini.


You can either edit the sample data source or create new data sources.

Each section of the odbc.ini file starts with a data source name in square brackets [ ] followed by a number of attribute=value pairs.


Note

Attribute names in odbc.ini are not case sensitive.


The Driver attribute identifies the ODBC driver in the odbcinst.ini file to use for a data source.

When the Easysoft ODBC-Google-Analytics Driver is installed into unixODBC, it places an Easysoft ODBC-Google-Analytics entry in odbcinst.ini. For Easysoft ODBC-Google-Analytics Driver data sources therefore, you need to include a Driver = Easysoft ODBC-Google-Analytics entry.

To configure a Google Analytics data source, in your odbc.ini file, you need to specify:

For example:

 [Google-Analytics]

 Driver = Easysoft ODBC-Google-Analytics

 refresh_token = /home/myuser/Quickstart-cb43e1f66976.json

Environment

The Easysoft ODBC-Google-Analytics Driver must be able to find the following shared objects, which are installed during the Easysoft ODBC-Google-Analytics Driver installation:

By default, this is located in /usr/local/easysoft/unixODBC/lib.

By default, this is located in /usr/local/easysoft/lib.

By default, this is located in /usr/local/easysoft/lib.

You may need to set and export LD_LIBRARY_PATH, SHLIB_PATH or LIBPATH (depending on your operating system and run-time linker) to include the directories where libodbcinst.so, libeslicshr.so and libessupp.so are located.


Note

The shared object file extension (.so) may vary depending on the operating system (.so, .a or .sl).


Establishing a Test Connection

The isql query tool lets you test your Easysoft ODBC-Google-Analytics Driver data sources.

To test the Easysoft ODBC-Google-Analytics Driver connection

1.  Change directory into /usr/local/easysoft/unixODBC/bin.

2.  Type ./isql.sh -v data_source, where data_source is the name of the target data source.

3.  At the prompt, type an SQL query. For example:

 SQL> select * from Users;

¯ OR ¯

 Type help to return a list of tables:

 SQL> help

 

Setting Up Data Sources on Windows

To connect an ODBC application on a Windows machine to Google Analytics database:

1.  Open ODBC Data Source Administrator:

 The ODBC Data Source Administrator dialog box is displayed:

2.  Select the User DSN tab to set up a data source that only you can access.

¯ OR ¯

 Select the System DSN tab to create a data source which is available to anyone who logs on to this Windows machine.

3.  Click Add... to add a new data source.

 The Create New Data Source dialog box displays a list of drivers:

4.  Select Easysoft ODBC-Google-Analytics Driver and click Finish.

 The Easysoft ODBC-Google-Analytics Driver DSN Setup dialog box is displayed:

For details of the attributes that can be set on this dialog box, see Attribute Fields.

You need to have created a Google Service Account and enabled the Google Analytics API. For more information, see:

https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries

Download the Service Account key to the machine where you want to install the Easysoft ODBC-Google-Analytics Driver. The key needs to be in JSON format.

Attribute Fields

This section lists the attributes which can be set for the Easysoft ODBC-Google-Analytics Driver in a table showing:

Attributes which are text fields are displayed as value.

Attributes which are logical fields can contain either 0 (to set to off) or 1 (to set to on) and are displayed as "0|1". If an attribute can contain one of several specific values then each possible entry is displayed and separated by a pipe symbol. For example, in the statement: DIALECT=1|2|3 the value entered may be "1", "2" or "3".

DSN

The name of the User or System data source to be created, as used by the application when calling the SQLConnect or SQLDriverConnect functions

Interface Value

DSN Dialog Box (Windows)

DSN

odbc.ini file (Unix)

[value]

Connect String

DSN=value

.

Description

Descriptive text that may be retrieved by certain applications to describe the data source

Interface Value

DSN Dialog Box (Windows)

Description

odbc.ini file (Unix)

Description=value

Connect String

Not Used

.

Service Acct File

The Google Service Account Key file (.json). For example, C:\Temp\Quickstart-cb43e1f66976.json. For more information about enabling the Google Analytics API and accessing this API with a Service Account, see: https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries



Interface Value

DSN Dialog Box (Windows)

Service Acct File

odbc.ini file (Unix)

SAKeyFile=value

Connect String

SAKEYFILE=value

Proxy

If you use a proxy server connect to the internet, use the Proxy attribute to specify this server's details. The Proxy attribute has the following format: http://address:port

where addess is the host name or IP address of the proxy server and port is the proxy server port. For example, http://squid.example.com:8080



Interface Value

DSN Dialog Box (Windows)

Proxy

odbc.ini file (Unix)

Proxy=value

Connect String

PROXY=value

Proxy User

If your proxy server has authentication enabled, use this attribute to supply a user name that can connect to the proxy server.

The Easysoft ODBC-Google-Analytics Driver supports the Basic and Digest proxy authentication schemes.



Interface Value

DSN Dialog Box (Windows)

Proxy User

odbc.ini file (Unix)

Proxy_User = value

Connect String

PROXY_USER=value

Proxy Password

The password for the user you specified with Proxy User.



Interface Value

DSN Dialog Box (Windows)

Proxy Password

odbc.ini file (Unix)

Proxy_Password = value

Connect String

PROXY_PASSWORD=value

Allow Updates

Whether you can use the Easysoft ODBC-Google-Analytics Driver to update your Google Analytics data via the Management API. By default, Allow Updates is OFF (set to NO), which means you can use the Easysoft ODBC-Google-Analytics Driver to retrieve Google Analytics data via the Core Reporting API.



Interface Value

DSN Dialog Box (Windows)

Allow Updates

odbc.ini file (Unix)

Allow_Updates=YES|NO

Connect String

Not Used

DSN-less Connections

In addition to using a data source, you can also connect to a database by using a DSN-less connection string of the form:

SQLDriverConnect(..."DRIVER={Easysoft ODBC-Google-Analytics};SAKeyFile=/home/myuser/Quickstart-cb43e1f66976.json"...)

You need to use the Easysoft ODBC-Google-Analytics DRIVER keyword to identify the Easysoft ODBC-Google-Analytics Driver.

Other Easysoft ODBC-Google-Analytics Driver attribute settings, as described in Setting Up Data Sources on Unix, can be added to the connection string using the same PARAMETER=value; format.

Table Definitions

The Easysoft ODBC-Google-Analytics Driver distribution includes a number of definition files (.def) that expose Google Analytics data as tables. For example, MobileTraffic.def, which enables you to work with this Google Analytics data subset by using SQL:

select * from MobileTraffic

The default location for the definition files on 64-bit Windows is:

drive:\Program Files (x86)\Easysoft Limited\Easysoft Google Analytics ODBC Driver\Definitions

The default location for the definition files on 32-bit Windows is:

drive:\Program Files\Easysoft Limited\Easysoft Google Analytics ODBC Driver\Definitions

The default location for the definition files on Linux and UNIX is:

/usr/local/easysoft/ganalytics/definitions