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

# Google Analytics integration

> Send Crossword chat widget events to the Google Analytics 4 property already on your site, through the Google tag or Google Tag Manager.

Crossword can send what happens in your chat widget to the Google Analytics 4 already running on your website. You then see Crossword's events next to your own, in the reports you already use.

There is nothing to paste and no key to enter. The widget hands each event to the Google tag or Tag Manager on your page.

## Prerequisites

* Your site loads Google's tag (`gtag.js`) or Google Tag Manager on the pages where the chat appears.
* You have permission to manage tracking settings in Crossword. Without it, the page is view-only.

Crossword can't reach Google Analytics when it is added only through a Shopify custom or app pixel, or bundled into your site's code. It also can't reach a Google tag set up only with a `GT-` or `AW-` ID and no Tag Manager container. Nothing arrives, and no error is shown.

## Setup

**1. Open the integration**

In the [Crossword dashboard](https://app.crossword.ai), go to **Integrations > Analytics** and click **Google Analytics**.

**2. Enable event delivery**

Click **Turn on**. Events start going to Google straight away.

**3. Select events**

Tick the events to send on each tab: **Chat**, **Widget**, **Cards and suggestions**, and **Browsing**. Most chat events start ticked. To see what each one sends, read [Analytics events](https://crossword.ai/docs/reference/analytics-events.md).

**4. Save your changes**

Click **Save** at the top.

What happens next depends on how Google Analytics is set up on your site.

## Google tag (gtag.js)

This applies when your page calls `gtag('config', 'G-XXXXXXX')` itself. You have nothing else to do. Events arrive in Google Analytics as `crossword_widget_opened`, `crossword_visitor_message_sent`, and so on.

To check that it worked:

1. Open your website, open the chat, and send a message.
2. In Google Analytics, go to **Reports > Realtime**.
3. Look under **Event count by Event name**. Events appear within a minute.

## Google Tag Manager

This also applies to Google's current tag snippet, which loads a Tag Manager container. Crossword adds each event to your page's data layer. You then send it on to Google Analytics with one trigger and one tag.

**1. Create a custom event trigger**

In Tag Manager, create a **Custom Event** trigger. Set the event name to `crossword_.*` and tick **Use regex matching**.

**2. Create a GA4 event tag**

Create a **Google Analytics: GA4 Event** tag that fires on that trigger.

* **Event name:** `{{Event}}`. If you renamed events in Crossword, use a **Data Layer Variable** named `crossword.event_name` instead.
* **Event parameters:** add the details you want. Read each one from a **Data Layer Variable** named `crossword.` plus the detail, for example `crossword.agent_name` or `crossword.conversation_id`.

Treat `crossword.*` values as text in your tags.

**3. Publish the container**

Click **Submit**, then **Publish** the container. Then check **Reports > Realtime** as described above.

## Custom dimensions and metrics

Event names and counts appear right away. To see Crossword's details in standard reports, register these as **custom dimensions** in your Google Analytics property:

* `agent_name`
* `source`
* `trigger`
* `role`
* `kind`
* `verified`

Register `score` as a **custom metric**. Don't register ids such as `conversation_id`, because they have too many values.

Crossword sends `true` and `false` as text, and lists as comma-separated text.

## Lead conversion tracking

To count leads as a key event or a Google Ads conversion, create an event in Google Analytics from **Shared contact details** (`crossword_contact_identified`). Only count it where `verified` is `true`. Don't use the raw event.

## Event routing and limits

Crossword's events go wherever your Google tag or Tag Manager trigger sends them. That includes:

* Every Google Analytics property and linked Google Ads account on the tag.
* Any property another app on your site added to the same tag.
* Any other tag a catch-all trigger fires.

Google Analytics has its own limits, so Crossword trims what it sends:

* Details longer than 100 characters are cut.
* At most 20 of each browsing event are sent per page load.
* The `currency` and `traffic_type` details aren't sent, because Google reserves them.

## Data privacy

These points apply to Google Analytics on top of the [shared privacy points](https://crossword.ai/docs/reference/analytics-events.md#data-privacy).

* Nothing is sent while your page's own Google consent setting denies analytics. This holds even if your Google tag uses Google's advanced consent mode.
* Your Google tag adds its own page address, page title, and referrer to every event it sends, as it does for your own events.

## Custom event names

Each event arrives in Google Analytics as `crossword_` plus its key, for example `crossword_widget_opened`. You can give any event your own name, to match the names your reports already use.

* Type the new name in the event's name box. Spaces become underscores as you type. Leave the box empty to keep the default.
* To go back to the default, click **Reset to default** in the name box.
* A new name applies from your next save. Events already in Google Analytics keep their old names, so reports built on the old name stop counting new events.

A Google Analytics name must follow these rules:

* Up to 40 characters.
* Letters, numbers, and underscores only, starting with a letter.
* Not a name Google Analytics keeps for itself, such as `page_view`, `purchase`, or `session_start`, or a name starting with `google_`, `ga_`, or `firebase_`.
* Not one of Crossword's own event keys, such as `widget_opened`.
* Not a name cookie-consent tools use.
* Not an older shopping name, such as `addToCart`.
* Not a name another Crossword event already uses.
* Not something that looks like an email address or phone number.

**Names your site already sends.** Crossword checks the event names your site sent in the last 30 days. If your new name matches one, Crossword asks you to confirm before saving. It also asks when it can't run the check. Chat events would then count as your site's own events too, which could inflate its key events and conversions. Click **Save anyway** to keep the name, or **Cancel** to change it.

**Tag Manager sites.** Your trigger keeps receiving the `crossword_` names, so it doesn't break. The name you set comes along in `crossword.event_name`. Use it as the event name in your GA4 Event tag.

## Troubleshooting

**No events in Google Analytics**

* Use **Reports > Realtime**. DebugView only shows hits marked for debugging, and standard reports can take up to a day.
* If your site uses Tag Manager, check that the `crossword_.*` trigger and GA4 Event tag are published.
* Check that your page's consent banner allows analytics for your test visit.

**Only some events appear**

* **Session started** and **Conversation started** fire only for a new chat. A returning visitor gets **Conversation resumed** instead. To test them, use a private or incognito window.
* Check which events are ticked on each tab, and that you clicked **Save**.
* A **Needs attention** badge means Google Analytics is on but no events are ticked.

## Disable the integration

Switch **Send events** off at the top of the page, then click **Turn off**. New events stop straight away. Events already in Google Analytics stay, and your picks and names are kept for when you turn it back on.

## Related

> [card] [Analytics events](https://crossword.ai/docs/reference/analytics-events.md)
>
> Every event Crossword can send, what it means, and the details it carries.

> [card] [Mixpanel](https://crossword.ai/docs/integrations/mixpanel.md)
>
> Send the same events to Mixpanel too.

> [card] [Cookie consent](https://crossword.ai/docs/identity/cookie-consent.md)
>
> How a shopper's cookie choice decides what gets sent.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.