# Google Analytics

Connect RootCause.ai to Google Analytics 4 (GA4) to import your web analytics data.

***

### Prerequisites

Before connecting, ensure you have:

* A Google account with access to Google Analytics
* At least one GA4 property set up
* Viewer or higher access to the GA4 property you want to connect

***

### Setting Up the Connection

1. Navigate to **Data** → **Datasets** in your workspace
2. Click **New Connection** and select **Google Analytics**
3. Click **Sign in with Google**
4. A Google sign-in window will appear – select your account
5. Grant RootCause.ai read-only access to your Analytics data
6. Once authenticated, you'll see "Connected to Google Analytics"
7. Click **Save** to create the connector

RootCause.ai requests only read-only access (`analytics.readonly` scope) and cannot modify your Google Analytics configuration.

***

### Importing Data

Once your connector is saved:

1. Click **Import Data** on the connector
2. Select an **Account** from the dropdown
3. Select a **Property** (GA4 property) from the dropdown
4. Choose your **Dimensions** (up to 9) – these are the attributes you want to analyze:
   * Examples: `date`, `country`, `deviceCategory`, `sessionSource`, `pagePath`
5. Choose your **Metrics** (up to 10) – these are the measurements you want to import:
   * Examples: `sessions`, `activeUsers`, `screenPageViews`, `bounceRate`, `averageSessionDuration`

Use the search box to find specific dimensions and metrics.

***

### What Happens When You Import

1. RootCause.ai calls the Google Analytics Data API
2. Data is retrieved for your selected dimensions and metrics
3. Results are stored in your workspace's data lake in tabular format
4. Schema is created from your dimension and metric selections
5. A preview is generated for verification

The imported dataset becomes available for use in [Data Views](https://docs.rootcause.ai/user-guide/data-management/data-views) and [Ontology](https://docs.rootcause.ai/core-technologies/ontology) mapping.

***

### Live Data Sync

You can configure automatic syncing to keep your dataset current:

* **Manual** – Only sync when you click "Sync Now"
* **Hourly** – Refresh every hour
* **Daily** – Refresh once per day
* **Weekly** – Refresh once per week

When a sync runs, data is refreshed based on your selected dimensions and metrics.

***

### Common Dimensions and Metrics

**Popular Dimensions:**

| Dimension        | Description                         |
| ---------------- | ----------------------------------- |
| `date`           | The date of the event               |
| `country`        | User's country                      |
| `city`           | User's city                         |
| `deviceCategory` | Desktop, mobile, or tablet          |
| `sessionSource`  | Traffic source                      |
| `sessionMedium`  | Traffic medium (organic, cpc, etc.) |
| `pagePath`       | Page URL path                       |
| `landingPage`    | First page in session               |

**Popular Metrics:**

| Metric                   | Description                   |
| ------------------------ | ----------------------------- |
| `sessions`               | Number of sessions            |
| `activeUsers`            | Number of active users        |
| `newUsers`               | Number of new users           |
| `screenPageViews`        | Total page views              |
| `bounceRate`             | Bounce rate percentage        |
| `averageSessionDuration` | Average session length        |
| `conversions`            | Total conversions             |
| `totalRevenue`           | Total revenue (if configured) |

***

### Disconnecting

To disconnect your Google account:

1. Open the connector settings
2. Click **Disconnect**
3. The OAuth tokens will be removed

You can also revoke access from your [Google Account permissions](https://myaccount.google.com/permissions).

***

### Troubleshooting

**No accounts or properties showing**

* Verify you have access to at least one GA4 property
* Check that you're signed in with the correct Google account
* Ensure you granted the required permissions during OAuth

**Authentication expired**

* Click **Sign in with Google** again to re-authenticate
* Google OAuth tokens expire; periodic re-authentication may be needed

**Data not matching GA4 interface**

* RootCause.ai uses the GA4 Data API, which may have slight differences from the GA4 web interface
* Ensure you're comparing the same date ranges and dimensions
* Some real-time data may not be immediately available via the API
