> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dema.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Analytics

> Let the Dema Agent read GA4 traffic, revenue, and channel performance from Google Analytics when you ask.

## Overview

Once Google Analytics is connected, the Dema Agent can read GA4 analytics directly inside a conversation — pull KPIs such as sessions, active users, transactions, revenue, and conversions broken down by date, channel, country, or device; analyze source/medium attribution; monitor a launch or flash sale in near real time; discover custom dimensions and metrics; and look up which properties an account can access and their configuration.

The agent only acts when you ask it to.

***

## Prerequisites

* A GA4 property (Universal Analytics properties are not supported).
* Administrator access on the GA4 account or property so you can grant the connecting account access.
* Best practice: a dedicated Google "agent" account rather than a personal login.

***

## Connect Google Analytics

<Steps>
  <Step title="Grant the agent account Viewer access in Google Analytics">
    1. In Google Analytics (analytics.google.com) click the **Admin** gear.
    2. Select the correct **Account** and **Property**.
    3. In the **Property** column click **Access Management**.
    4. Click **+** then **Add users**.
    5. Enter the connecting Google account email.
    6. Choose the **Viewer** role (read-only) and click **Add**.

    Optional: **Property details** shows the numeric **Property ID** — note that this is *not* the `G-` Measurement ID.

    <Tip>
      Use a dedicated agent account and grant only **Viewer** at the property level. This keeps access scoped to the least privilege the agent needs.
    </Tip>

    <Note>
      The connecting account must already have **Viewer** on the property *before* you connect, or the property will not appear in Dema.
    </Note>
  </Step>

  <Step title="Connect in Dema">
    In Dema, go to **Agents → Settings → Integrations**, find **Google Analytics**, and click **Connect**. There are no fields to enter — Dema redirects you to Google sign-in. Sign in with the account you granted access to, approve the read-only `analytics.readonly` access, and pick the GA4 property. Dema marks the integration as Active.
  </Step>
</Steps>

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="My property does not appear">
    The connecting account needs at least **Viewer** on that property. Grant it in **Access Management**, then reconnect.
  </Accordion>

  <Accordion title="Wrong property or no data">
    Make sure you selected a **GA4** property (not Universal Analytics) and the correct numeric **Property ID**.
  </Accordion>

  <Accordion title="Connection expired">
    Reconnect from the integration card to re-authorize.
  </Accordion>
</AccordionGroup>

If you are still stuck, contact [support](mailto:info@dema.ai) with the error message you see.

***

## Additional resources

* [Add, edit, and delete users and user groups](https://support.google.com/analytics/answer/9305788)
* [Manage users in a property or account](https://support.google.com/analytics/answer/9305587)
* [Find your GA4 Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id)
