# Google Analytics

> Send conversation and lead events from every Giov channel to your Google Analytics 4 property, without personal data.

Connect Giov to Google Analytics 4 (GA4) to measure the conversations and leads you receive, next to the rest of your site's traffic. Giov sends a small set of events from its servers through the GA4 Measurement Protocol, for the website widget and, if you choose, for your messaging channels.

Google Analytics is available on the Business and Advanced plans. Only workspace admins can set it up.

## Set it up

1. In GA4, open **Admin**, then **Data streams**, and pick your web data stream.
2. Copy the **Measurement ID**. It looks like `G-XXXXXXXXXX`.
3. In the same stream, open **Measurement Protocol API secrets** and create a secret. Copy its value.
4. In Giov, open **Analytics**. In the **Google Analytics** card, enter the Measurement ID and the API secret, turn on **Send events to Google Analytics**, and save.
5. Select **Send test event**. Giov sends a test event to Google's validation endpoint and shows any problems Google reports.

Giov encrypts the API secret and never shows it again. To change it, paste a new one and save.

## Events

| Event | When it's sent | Parameters |
|---|---|---|
| `giov_conversation_started` | A conversation gets its first customer message | `channel` |
| `generate_lead` | A contact gives an email address or phone number for the first time in a conversation | `channel`, `method` |
| `giov_handoff` | GiovBot hands the conversation to a person | `channel` |
| `giov_conversation_resolved` | The conversation is closed | `channel`, `resolved_by` |
| `giov_chat_opened` | The visitor opens the website chat. Sent from the visitor's browser, not from Giov's servers | None |

Parameter values:

| Parameter | Values |
|---|---|
| `channel` | `website`, `email`, `whatsapp`, `messenger`, `instagram`, `telegram` |
| `method` | `form` (the pre-chat form, or details your page passed to the widget), `chat` (given in the conversation) |
| `resolved_by` | `bot` (GiovBot closed it), `agent` (a teammate closed it) |

`generate_lead` is a GA4 recommended event, so you can mark it as a key event in GA4. Each conversation sends `giov_conversation_started` and `generate_lead` at most once.

`giov_chat_opened` goes through your page's own Google tag: `gtag` if it's on the page, otherwise the `dataLayer` that Google Tag Manager reads. Giov's servers never send it, so nothing is counted twice.

## Website chats and consent

Website chats are joined to the visitor's existing Google Analytics session. When the connection is on, the widget reads your site's `_ga` cookie and session cookie, and sends only the GA client ID and session ID with the conversation.

If the visitor's browser has no `_ga` cookie, Giov sends nothing for that chat. That cookie only exists when your site's Google Analytics already ran, so your site's own consent setup applies: a visitor who declined analytics cookies isn't measured.

## Messaging channels

Email, WhatsApp, Messenger, Instagram and Telegram have no browser and no GA cookie. These events are off until you turn on **Include messaging channels**.

When it's on, each contact gets a pseudonymous client ID: a keyed hash of the contact, using a secret key unique to your workspace. The same contact keeps the same ID across conversations, the ID can't be turned back into the contact, and it's unrelated to the ID the same person would get in any other workspace.

You're responsible for your customers' consent to this measurement. Check your privacy notice before you turn it on.

## No personal data

Google's terms forbid sending personal data to Google Analytics. Giov never sends names, email addresses, phone numbers, message text, or contact, visitor or conversation IDs. Events carry only the parameters in the tables above.

Giov also marks every event as not for advertising use (`ad_user_data` and `ad_personalization` denied), so the events are used for measurement only.

## Reliability

Events are sent in the background. A slow or failing Google Analytics never delays or breaks a conversation: Giov waits up to 3 seconds, retries once, then drops the event.
