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

# Google Analytics (GA4)

> Give the operator console read access to your GA4 property — enable the Data API, create a service account with a JSON key, grant it Viewer on the property, and enter the key and the numeric property ID.

# Google Analytics (GA4)

Powers the operator console's web-analytics page — live visitors, sessions, top pages and referrers — pulled from the GA4 property that tracks your marketing site.

**Scope: Global defaults** only — a platform operator feature. Leave it unconfigured if you do not run the console.

## 1. In Google Cloud and GA4

1. **Google Cloud Console → APIs & Services → Library** → enable **Google Analytics Data API**.
2. **IAM & Admin → Service Accounts → Create service account**. Grant it **no** project roles at the project step — none are used.
3. Open the service account → **Keys → Add key → Create new key → JSON**. The file downloads once.
4. **GA4 → Admin → Property Access Management → Add users** → the service account's email (`…@….iam.gserviceaccount.com`) with the **Viewer** role. That is the only grant it needs.
5. **GA4 → Admin → Property Settings** → copy the **numeric Property ID** (not the `G-XXXXXXX` measurement ID).

## 2. Enter it in KnoxCall

**Settings → Integrations → Global defaults → Google Analytics (GA4)** → *Configure*:

| Field                         | Value                                                                                               |
| ----------------------------- | --------------------------------------------------------------------------------------------------- |
| **Service account JSON key**  | The entire contents of the JSON file, pasted verbatim — including the newlines inside `private_key` |
| **GA4 property ID (numeric)** | e.g. `123456789`                                                                                    |

**Save credentials.**

## 3. Verify

The operator console's *Test connection* performs a token exchange and a minimal one-day report against the property, and reports a bad property id distinctly from a bad key. The web-analytics page then populates.

## Things that bite

* **Numeric property ID, not the measurement ID.**
* **Paste the whole file.** A JSON key with mangled newlines fails as an authentication error, not a parse error.
* **No environment fallback exists for this type**; an unset row simply means the page has no data.
* **Viewer at the account level works too**, but is broader than needed.
