> For the complete documentation index, see [llms.txt](https://docs.caoanalytics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.caoanalytics.com/user-guide/google-analytics.md).

# Google Analytics

## **Establish Connection Between Kodda and Google Analytics**

### **1.** Create **API** Project

Create or use an existing project in the Google Developers Console as a first step.

Go to <https://console.developers.google.com/project> and sign in to your Google/Gmail account. Once signed in, you'll see a list of existing projects (if there are any) or you can click **Create project** to create a new one.

![](https://1682448182-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO8vUiMZbKjefXbyOes%2Fsync%2Fd7b25968c82eec897845815f533b6138b8a74440.png?generation=1607558967982010\&alt=media)

### 2. Enable APIs

The following api's are required in order to retrieve Google Analytics data.

* Universal Analytics
  * Google Analytics API&#x20;
  * Google Analytics Reporting&#x20;
* Google Analytics 4
  * Google Analytics Data API
  * Google Analytics Admin API

To enable APIs after account is created, select "Explore and enable APIs"

![](https://1682448182-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO8vUiMZbKjefXbyOes%2Fsync%2Fc3870ac9f6e62ec20abde2746e97aa082f9708e5.png?generation=1607558967894352\&alt=media)

Search for the "Google Analytics Reporting API" and select Enable. Follow same steps for the Google Analytics API.

![](https://1682448182-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO8vUiMZbKjefXbyOes%2Fsync%2Fa6679bc42f9a1bc9a2cbc5fb3b02c4d24e740517.png?generation=1607558967546509\&alt=media)

<div><figure><img src="https://1682448182-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MO8vUiMZbKjefXbyOes%2Fuploads%2FMfSKMUVJ8ZYROQyqM6Vq%2Fimage.png?alt=media&amp;token=1ca977ae-eb25-45f0-a6d5-3b52c52adcc8" alt=""><figcaption></figcaption></figure> <figure><img src="https://1682448182-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MO8vUiMZbKjefXbyOes%2Fuploads%2FUFB5MgK5UoLWhb9w2yel%2Fimage.png?alt=media&amp;token=1743f20e-7fcd-4f68-ad01-9bd2e0543639" alt=""><figcaption></figcaption></figure></div>

### **3. Generate A Service Account**

This section shows you how to generate Service account credentials which will allow Kodda access your Google Analytics data.

From the left navigation, click **Credentials**. Click **Create credentials** and select the **Service account** option. Enter name. Role is optional.

![](https://1682448182-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO8vUiMZbKjefXbyOes%2Fsync%2F9c791e3d6c72cba4fa74e50faae949fb47dbdfe3.png?generation=1607558967818391\&alt=media)

After service account is created, select the account and create a key and download the JSON file.

### 4. Grant Service Account GA Access

Go to your google analytics account > admin > account user management and add the service account email address as a user.

### 5. Create Connection in Kodda

See[ manage connections ](/getting-started/manage-connections.md)

## Integrate Data from GA

### Select Source

To move data from Google Analytics, you'll [generate a new mapping](/user-guide/generate-mapping.md) and select your google analytics connection as the source and point to the target of your choosing.

![](https://1682448182-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO8vUiMZbKjefXbyOes%2Fsync%2F4c32b66c5e3fad4e0cdbff68965354c061a8e2ed.png?generation=1607558968374052\&alt=media)

Select account, property, and views you would like to use, these will be populated automatically and the choices will depend on the configuration of your Google Analytics account(s) If not sure which to use, reference google's documentation for [additional information. ](https://support.google.com/analytics/answer/1102152?hl=en)

### Select Query Parameters

Select the start date, metrics, dimensions, filters, segment. For a full list available choices reference [Google's Dimension and Metrics explorer](https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/).

| Field                                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Start Date                           | Per googles documentation all GA mappings must specify a date range. The minimum value allowed for the start date is 2005-01-01. Kodda will always use the current date as the end date.                                                                                                                                                                                                                                                                                        |
| Metrics                              | Choose the metrics you would like to include in your Google Analytics report. See google analytics [documentation on metrics](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#metrics) for more information. All mappings must include a minimum of 1 metric and a maximum of 10.                                                                                                                                                                 |
| Dimensions                           | Date is added by default and will be needed if you intend on loading your data incrementally to your target. If you intend to use a load pattern that does not incrementally load data than you may remove the default ga:date selection. See google analytics [documentation on dimensions ](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#dimensions)for more information. All mappings must include at least 1 dimension and a maximum of 7. |
| Filters (*Universal Analytics Only*) | This parameter is an optional expression that is used to filter the result set. Mappings are not required to have filters applied. See [filters](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters)                                                                                                                                                                                                                                         |
| Segment (*Universal Analytics Only*) | This is an optional value that can be specified to limit the result set to a single segment. Mappings are not required to have a segment selected. See [segment](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#segment)                                                                                                                                                                                                                         |

### Select Target Schema

Select the schema to place the target table object. You may select an existing schema from the drop down list or type your own schema name and press enter.

### Select Target Table

Select the target table you would like to write the data. You may select an existing table from the drop down list or type your own table and press enter.

### Available Activities

* Generate Mapping&#x20;
* Preview&#x20;

### **Mapping Options**

For a full reference of run-time options available on a mapping see[ Generate Mapping/Options](https://koddalabs.gitbook.io/kodda-documentation/user-guide/generate-mapping#options). There is one Run-time option that is unique to Google Analytics connections.

| Toggle                | Description                                                                                                                    |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **Use Daily Extract** | When toggled on, Kodda will pull each day as a API separate call. This will reduce sampling on free google analytics accounts. |

![](https://1682448182-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO8vUiMZbKjefXbyOes%2Fsync%2Fca3637849c67d708ad4cdb1f80b4d7886b8bb9b7.png?generation=1607558968239745\&alt=media)
