# Google Analytics (v1)

Information note **Google Analytics extraction is supported by Stitch**   
This integration is powered by [Singer's](https://www.singer.io/) Google Analytics tap and certified by Stitch. [Check out and contribute to the repo on GitHub](https://github.com/singer-io/tap-google-analytics).  
  
For support, contact [Support](https://community.qlik.com/t5/Support/ct-p/qlikSupport).

Information note **Keep up with the latest Google Analytics updates** with the [Google Analytics Integration Changelog](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics/changelog).

## Google Analytics integration summary

Stitch’s Google Analytics integration allows you to create custom reports by selecting the metrics and dimension you want to replicate. You can create multiple reports and configure each of them individually. Refer to the [Schema](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#schema) section for more info and an example table schema.

This integration:

* Supports creating multiple custom reports
* Supports [custom metrics and dimensions](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#custom-metrics-dimensions)
* Doesn’t currently support Lifetime Values and Cohorts
* Doesn’t currently support Filters or Segments

## Google Analytics feature snapshot

A high-level look at Stitch's Google Analytics (v1) integration, including release status, useful links, and the features supported in Stitch.

| **STITCH** |  |  |  |
| --- | --- | --- | --- |
| **[Release status](https://help.qlik.com/en-US/stitch/integrations/identify-an-integration-version)** | Released on March 30, 2020 | **Supported by**<br><br>the Info icon<br><br>Indicates if the integration is supported by Stitch or the Singer community. | [Stitch](https://community.qlik.com/t5/Support/ct-p/qlikSupport) |
| **Stitch plan**<br><br>the Info icon<br><br>The type of Stitch plan required to use the integration. | Standard | **[API availability](https://help.qlik.com/en-US/stitch/developers/stitch-connect/guides/source-destination-reference)**<br><br>the Info icon<br><br>Indicates if the integration is available as a source in Stitch Connect. | the Success icon<br><br>This version of the integration is available via the API.<br><br><br>Available |
| **Singer GitHub repository** | [singer-io/tap-google-analytics](https://github.com/singer-io/tap-google-analytics) |  |  |
| **REPLICATION SETTINGS** |  |  |  |
| **[Anchor Scheduling](https://help.qlik.com/en-US/stitch/replication/replication-scheduling/anchor-scheduling)**<br><br>the Info icon<br><br>A type of replication scheduling where an integration's Replication Frequency is anchored to a time you select. | the Success icon<br><br>This feature is supported for this version of the integration.<br><br><br>Supported | **[Advanced Scheduling](https://help.qlik.com/en-US/stitch/replication/replication-scheduling/advanced-scheduling)**<br><br>the Info icon<br><br>A type of replication scheduling that allows you to specify granular start times for data extraction using cron expressions. | the Success icon<br><br>This feature is supported for this version of the integration.<br><br><br>Supported |
| **Table-level reset**<br><br>the Info icon<br><br>Indicates if data can be reset at the table level. If unsupported, data can only be reset at the integration level. | the Success icon<br><br>This feature is supported for this version of the integration.<br><br><br>Supported | **[Configurable Replication Methods](https://help.qlik.com/en-US/stitch/replication/replication-methods)**<br><br>the Info icon<br><br>Indicates if Replication Methods can be defined by you for tables in the integration. | the Remove icon<br><br>Configurable Replication Methods are not supported for this integration. Stitch will use pre-defined replication methods for tables you set to replicate.<br><br><br>Unsupported |
| **DATA SELECTION** |  |  |  |
| **Table selection**<br><br>the Info icon<br><br>The ability to select individual tables for replication in the Stitch interface. If table selection is unavailable, all tables and all the columns they contain will be set to replicate by default. | the Success icon<br><br>This feature is supported for this version of the integration.<br><br><br>Supported | **Column selection**<br><br>the Info icon<br><br>The ability to select individual columns for replication in the Stitch interface. If column selection is unavailable, all columns will be set to replicate by default. | the Success icon<br><br>This feature is supported for this version of the integration.<br><br><br>Supported |
| **Select all**<br><br>the Info icon<br><br>Indicates if the integration supports selecting all available tables and columns. | the Remove icon<br><br>The APIs used by this integration (Reporting API v4 and Metadata API) don't support selecting all fields due to compatibility rules.<br><br><br>Unsupported |  |  |
| **TRANSPARENCY** |  |  |  |
| **[Extraction Logs](https://help.qlik.com/en-US/stitch/replication/extractions/integration-extraction-logs)**<br><br>the Info icon<br><br>Logs detailing the Extraction phase of the replication process for a given integration. Includes error info, should an error occur. | the Success icon<br><br>This feature is supported for this version of the integration.<br><br><br>Supported | **[Loading Reports](https://help.qlik.com/en-US/stitch/replication/integration-loading-reports)**<br><br>the Info icon<br><br>Reports detailing the Loading phase of the replication process for a given integration. Includes the number of rows loaded for each table and error info, should an error occur. | the Success icon<br><br>This feature is supported for this version of the integration.<br><br><br>Supported |

## Connecting Google Analytics

### Google Analytics setup requirements

To set up Google Analytics in Stitch, you need:

* **At least Read & Analyze permissions in the account you want to connect to Stitch**. [See Google’s documentation for more info](https://support.google.com/analytics/answer/2884495?hl=en).

* **To have recent data in the account you want to connect to Stitch.** Verify that there is data from the past 30 days in the account before continuing.

* **To pause all ad-blocking software**. Because Google authentication uses pop ups, you may encounter issues if ad blockers aren’t disabled during the setup.

### Step 1: Add Google Analytics as a Stitch data source

1. [Sign into your Stitch account](https://app.stitchdata.com/).

2. On the Stitch Dashboard page, click the **Add Integration** button.

3. Click the **Google Analytics** icon.

4. Enter a name for the integration. This is the name that will display on the Stitch Dashboard for the integration; it’ll also be used to create the schema in your destination.

   For example, the name “Stitch Google Analytics” would create a schema called `stitch_google_analytics` in the destination. **Note**: Schema names cannot be changed after you save the integration.

### Step 2: Configure your custom reports

Next, you’ll configure the custom report(s) you want to replicate. The report(s) you enter on this page are used to create the tables in your destination.

In the **Report Name** field, enter the name of report. This will be used to dynamically create the name of the report’s corresponding table in the destination:

![Creating a custom Google Analytics report named Visitor Traffic](https://help.qlik.com/en-US/stitch/images/integrations/google-analytics-custom-report.png)Creating a custom Google Analytics report named Visitor TrafficCreating a custom Google Analytics report named Visitor Traffic

To add another report, click **Configure another report** and enter a name for the report.

Information note **Renaming and deleting reports**: After the integration is created, renaming and deleting reports will have implications how data from this integration is loaded into your destination. Refer to the [Renamed](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#renamed-reports) and [Deleted reports](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#deleted-reports) sections for more info.

### Step 3: Define the historical replication start date

The Sync Historical Data setting defines the starting date for your Google Analytics integration. This means that data **equal to or newer than this date** will be replicated to your data warehouse.

Change this setting if you want to replicate data beyond Google Analytics’s default setting of **1 year**. For a detailed look at historical replication jobs, check out the [Syncing Historical SaaS Data](https://help.qlik.com/en-US/stitch/replication/syncing-historical-saas-data-resetting-replication-keys) guide.

### Step 4: Create a replication schedule

Information note Replication schedules affect the time Extraction begins, not the time to data loaded. Refer to the [Replication Scheduling](https://help.qlik.com/en-US/stitch/replication/replication-scheduling) documentation for more information.

In the **Replication Frequency** section, you’ll create the integration’s [replication schedule](https://help.qlik.com/en-US/stitch/replication/replication-scheduling). An integration’s replication schedule determines how often Stitch runs a replication job, and the time that job begins.

Google Analytics integrations support the following replication scheduling methods:

* [Replication Frequency](https://help.qlik.com/en-US/stitch/replication/replication-scheduling/replication-frequency)

* [Anchor Scheduling](https://help.qlik.com/en-US/stitch/replication/replication-scheduling/anchor-scheduling)

* [Advanced Scheduling using Cron](https://help.qlik.com/en-US/stitch/replication/replication-scheduling/advanced-scheduling) (Advanced or Premium plans only)

To keep your row usage low, consider setting the integration to replicate less frequently. See the [Understanding and Reducing Your Row Usage guide](https://help.qlik.com/en-US/stitch/getting-started/understanding-stitch-usage) for tips on reducing your usage.

### Step 5: Authorize Stitch and select a Google Analytics profile

![Selecting a Google Analytics profile.](https://help.qlik.com/en-US/stitch/images/integrations/ga-select-profiles.png)Selecting a Google Analytics profile.Selecting a Google Analytics profile.

1. Next, you’ll be prompted to log into your Google account and approve Stitch’s access to your Google Analytics data. **Note that we will only ever read your data.**

2. Click **Allow** to continue.

3. After your credentials are validated, you’ll be prompted to select the Google Analytics profile you want to connect to Stitch.

   **Remember:** Profiles need to have Read & Analyze permissions to be detected by Stitch. If you don’t see the profile you want in this list, we recommend that you double-check the permission settings.

4. When finished, click **Continue.**

### Step 6: Set metrics and dimensions to replicate

To complete the setup, you’ll need to select metrics and dimensions for each [report](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#configure-reports) you want to replicate to your destination.

1. In the list of reports that displays - or in the **Tables to Replicate** tab, if you skipped this step during setup - locate a report you want to replicate.

2. To track a report, click the **checkbox** next to the report’s name. You’ll be redirected to a page with a list of metrics and dimensions available for replication.

3. Select the metrics and dimensions you want to include in the report. When making your selections, keep the following in mind:

   * **You can select up to 10 metrics and 7 dimensions per report.** This limit is imposed by Google and can’t be changed or worked around. When you reach this limit, you won’t be able to make any other selections until you de-select a metric or dimension.

   * **Metric and dimension combinations are subject to Google’s compatibility rules.** When you select a metric or dimension, all other metrics and dimensions incompatible with the selection will be greyed out. To test your combos before selecting them in Stitch, use [Google’s Dimensions & Metrics Explorer](https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/).

   * **Custom metrics and dimensions** will display as either `ga:metricXX` or `ga:dimensionXX`, where `XX` is replaced with the specific number of the metric or dimension. Refer to the [Custom metrics and dimensions section](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#custom-metrics-dimensions) for help identifying custom metrics and dimensions in your Google Analytics account.

   * **Some metrics and dimensions are associated with products that must be enabled.** If the product isn’t enabled, Stitch will encounter issues during Extraction.

     For example: Metrics and dimensions associated with DoubleClick Campaign Manager can only be replicated successfully if DoubleClick Campaign Manager is enabled.

4. Repeat this process for your remaining reports.

5. When finished, click the **Finalize Your Selections** button at the bottom of the screen to save your selections.

**Note:** If these settings are changed while a replication job is still in progress, they will not be used until the next job starts.

### Initial and historical replication jobs

After you finish setting up Google Analytics, its **Sync Status** may show as **Pending** on either the Stitch Dashboard or in the Integration Details page.

For a new integration, a **Pending** status indicates that Stitch is in the process of scheduling the initial replication job for the integration. **This may take some time to complete.**

Information note

**Initial replication jobs with Anchor Scheduling**

If using Anchor Scheduling, an initial replication job may not kick off immediately. This depends on the selected Replication Frequency and Anchor Time. Refer to the [Anchor Scheduling](https://help.qlik.com/en-US/stitch/replication/replication-scheduling#job-scheduling-and-anchor-times) documentation for more information.

#### Free historical data loads

The first seven days of replication, beginning when data is first replicated, are free. Rows replicated from the new integration during this time won’t count towards your quota. Stitch offers this as a way of testing new integrations, measuring usage, and ensuring historical data volumes don’t quickly consume your quota.

Information note **Replication will continue after the seven days are over**. If you’re no longer interested in this source, be sure to **pause** or **delete** the integration to prevent unwanted usage.

## Google Analytics replication

* [How Stitch replicates your custom reports](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#custom-report-replication)

* [Selecting metrics and dimensions in your custom reports](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#metrics-and-dimensions)

### Custom report replication

* [Replication Method](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#replication-method)

* [Renamed reports](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#renamed-reports)

* [Deleted reports](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#deleted-reports)

#### Replication Method

Custom reports in Google Analytics are replicated using Key-based Incremental Replication with `start_date` as a Replication Key. A `start_date` value is a date in `YYYY-MM-DD` format.

Google Analytics report data is aggregated per day, meaning that the day’s data isn’t complete until the next day begins. For this reason, data for the current day may be re-replicated until the day is ‘complete’. **Note**: The [attribution modeling of your account](https://support.google.com/analytics/answer/1662518?hl=en) may also affect when data is considered complete.

For example: Data for `2020-03-26` isn’t considered complete by Google until `2020-03-27` begins. The integration may re-replicate data for `2020-03-26` until records for `2020-03-27` start to become available.

#### Renamed reports

Information note **Note**: Stitch won’t send a notification when a report is renamed. We recommend informing your colleagues when a report is renamed to ensure they’re using the new, correct destination table.

When you rename a report after the integration has been created, Stitch will:

1. **Load data into a new table in your destination.** From the date the report is renamed, Stitch will load all data into a new table. The original table will remain in the destination unless you choose to drop it.

2. **Continue replicating data from the Replication Key value saved for the table.** You’ll need to reset the report to re-replicate all data [from the integration’s **Start Date**](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#define-historical-sync) and have it loaded into the new table.

   To reset a report, click into the report and then click **Report Settings** on the right side of the page. Click the **Reset Report** button.

3. **Retain your metric and dimension selections for the report.** You won’t need to re-select metrics and dimensions.

#### Deleted reports

To delete a report, open the integration’s settings page, click **Configure another report**, and click **Remove this report**.

This will permanently remove the report from the integration, including any selected metrics and dimensions.

**Note**: Deleting a report in Stitch won’t automatically remove the corresponding table in your destination.

### Metrics and dimensions

When selecting metrics and dimensions in Stitch, keep the following in mind:

* [Maximum selection limits](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#maximum-selection-limits)

* [Compatibility rules](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#compatibility-rules)

* [Custom metrics and dimensions](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#custom-metrics-dimensions)

#### Maximum selection limits

For each report in a Google Analytics integration, you can select up to [10 metrics](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#metrics) and [7 dimensions](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#dimensions).

These limits are imposed by Google and can’t be changed or worked around. When you reach these limits, you won’t be able to make any other selections until you de-select a metric or dimension.

#### Compatibility rules

The metrics and dimensions you select in custom reports are subject to [Google’s compatibility rules](https://support.google.com/analytics/answer/1033861?hl=en#ValidDimensionMetricCombinations). Refer to [Google’s Dimensions and Metrics Explorer](https://developers.google.com/analytics/devguides/reporting/core/dimsmets) for a list of valid dimension and metric pairs.

#### Custom metrics and dimensions

Custom metrics and dimensions will display as either `ga:metricXX` or `ga:dimensionXX`, where `XX` is replaced with the specific number of the metric or dimension.

To identify a custom metric or dimension:

1. Sign into your Google Analytics Dashboard.
2. Open the Custom Metrics or Dimensions page by navigating to **Admin &gt; Property Column &gt; Custom Definitions &gt; Custom Metric/Dimension**.
3. In the row for the metric or dimension, locate the **Index** column.
4. Append the value in the **Index** column to either `ga:metric` or `ga:dimension`. For example: If the index for a custom dimension is `1`, the name that displays in Stitch would be `ga:dimension1`.

## Google Analytics table reference

Information note

**Schemas and versioning**

Schemas and naming conventions can change from version to version, so we recommend verifying your integration’s version before continuing.

The schema and info displayed below is for **version 1** of this integration.

This is the latest version of the Google Analytics integration.

Information note

**Table and column names in your destination**

Depending on your destination, table and column names may not appear as they are outlined below.

For example: Object names are lowercased in Redshift (`CusTomERs` &gt; `customers`), while case is maintained in PostgreSQL destinations (`CusTomERs` &gt; `CusTomERs`). Refer to the [Loading Guide](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides) for your destination for more info.

### sample\_report

For every report you create in the integration’s settings page, Stitch will create a corresponding table in your destination. The table will contain the [metrics and dimensions you select](https://help.qlik.com/en-US/stitch/integrations/saas/google-analytics#track-data), along with a few columns Stitch requires for replication.

**Note**: Every row in this table pertains to a specific day. Use the `start_date` and `end_date` columns to identify what day the row is for.

The `_sdc_record_hash` column is a Stitch-generated SHA 256 hash that should be used as a Primary Key. The hash consists of a UTF-8 encoded JSON list containing:

* The account ID, web property ID, and profile ID of the associated report
* Pairs of `ga:dimension_name` and `dimension_value`
* The `start_date` and `end_date` values for the record, in `YYYY-mm-dd` format

| **Replication Method [](https://help.qlik.com/en-US/stitch/replication/replication-methods)[the Info icon](https://help.qlik.com/en-US/stitch/replication/replication-methods)[](https://help.qlik.com/en-US/stitch/replication/replication-methods)** | Key-based Incremental |
| --- | --- |
| **Primary Key ![](https://help.qlik.com/en-US/stitch/images/replication/primary-key-icon.svg)** | \_sdc\_record\_hash |
| **Replication Key ![](https://help.qlik.com/en-US/stitch/images/replication/replication-key-icon.svg)** | start\_date |

sample\_report table schema

| **account\_id**<br><br><br>INTEGER |
| --- |
| **end\_date**<br><br><br>DATE-TIME |
| **profile\_id**<br><br><br>STRING |
| **start\_date**<br><br><br>DATE-TIME |
| **web\_property\_id**<br><br><br>STRING |
| **\_sdc\_record\_hash**<br><br><br>STRING |