# Google Analytics

Report your Web Chat widget's conversation funnel to Google Analytics 4

The Google Analytics integration reports how your Web Chat widget contributes to your funnel. Qwetty sends Google Analytics 4 (GA4) events across the conversation — widget opened, chat started, messages sent, leads captured and handoffs to an agent — so you can build funnels, audiences and attribution around real conversations.

:::note
Google Analytics reporting works with **Web Chat** channels only.
:::

## Activating Google Analytics

1. Go to **Integrations** and click the **Google Analytics** card on the **Catalog** tab
2. Click **Activate**

Activation does not sign in to Google. It switches reporting on for your organization and shows the Google Analytics settings on each Web Chat channel. You need the **Connect** permission, and Google Analytics counts toward your plan's integration limit.

## Setting up a Web Chat channel

1. Go to **Settings → Channel → [Your Channel] → Details → Configuration**
2. Choose the **Tracking** section
3. Under **Google Analytics**, turn on **Enable Google Analytics**
4. Fill in the settings:

| Setting | What to enter |
|---------|---------------|
| **Measurement ID** | Your GA4 Measurement ID, for example `G-XXXXXXXXXX`. Find it in Google Analytics → Admin → Data streams. Leave it blank to send events through the Google tag already on your site |
| **Measurement Protocol API secret** | Optional. Needed only for the two server-side events below. Create one in Google Analytics → Admin → Data streams → Measurement Protocol API secrets |
| **Events to report** | Turn each event on or off |

5. Click **Save**

The API secret is stored encrypted and never shown again; the field then reads **Configured — type to replace**. To remove it, click **Remove**. Changing these settings requires the **Edit** permission for Channels.

## Events

| Event | GA4 event name | Sent from | When |
|-------|----------------|-----------|------|
| **Widget opened** | `widget_opened` | Visitor's browser | The visitor opens the widget |
| **Chat started** | `chat_started` | Visitor's browser | The visitor starts a conversation |
| **Message sent** | `message_sent` | Visitor's browser | The visitor sends a message |
| **Lead captured** | `generate_lead` | Visitor's browser | Once per visitor per widget, when they submit the pre-chat form or send their first message |
| **Contacted on another channel** | `contact` | Visitor's browser | The visitor clicks one of your other channels on the widget's home screen. Includes which channel |
| **Handed off to agent** | `agent_handoff` | Qwetty's server | The conversation is handed from the bot to an agent |
| **Chat closed** | `chat_closed` | Qwetty's server | The conversation is closed |

**Handed off to agent** and **Chat closed** usually happen after the visitor has left the page, so the browser cannot report them. Qwetty sends them from its server, which **Needs a Measurement ID and an API secret above.** Server events reuse the visitor's GA client ID, so they join the same visitor and session; if the browser never provided one, the event is dropped rather than counted as a new user.

:::tip
To count an event as a conversion, mark it as a key event in Google Analytics → Admin → Events. An event must have fired at least once before it appears there.
:::

### Using the Google tag already on your site

If the site that hosts the widget already loads Google Analytics, you can leave **Measurement ID** blank. The widget then sends its events through your existing tag. In that case the server-side events are not available, because they need a Measurement ID.

### Consent

The widget respects the same consent switch as Google Ads tracking: with `window.qwettyTrackingConsent = false` set before the widget loads, no Google tag is loaded and no events are sent until `window.QwettyChat.setConsent(true)` is called. See [Google Ads](/en/integrations/google-ads#consent).

## Deactivating

Open **Integrations**, go to the **Installed** tab, and choose **Deactivate** from the connection's **⋯** menu. Google Analytics reporting stops on all your Web Chat widgets. Your per-channel settings — including saved Measurement IDs and API secrets — are kept, and you can reactivate any time. Events already sent to Google Analytics are unaffected.

## What data is sent to Google

- Event names, with the channel type and name for **Contacted on another channel**
- The visitor's GA client and session IDs, for server-side events

No message content, names, emails or phone numbers are sent to Google Analytics.

## Troubleshooting

| Problem | What to do |
|---------|------------|
| The **Tracking** section shows no Google Analytics settings | Activate Google Analytics on the **Integrations** page first |
| No events in Google Analytics | Check the **Measurement ID**, that the event is turned on, and that consent is granted. Use the Realtime or DebugView reports to see events as they arrive |
| Handoff and close events are missing | Both a **Measurement ID** and a **Measurement Protocol API secret** are required, and the visitor's browser must have loaded the Google tag |

## Next steps

- [Google Ads](/en/integrations/google-ads) — Count chats as Google Ads conversions
- [Channel Configuration](/en/channel-management/configuration) — Web Chat settings
- [Integrations Overview](/en/integrations/overview) — Connecting, statuses and permissions
