Paste your GA4 Measurement ID into Settings → Google Analytics. The widget forwards every interaction to your existing property, with the agent ID attached for filtering.
Most teams already use Google Analytics. Now your AI widget can feed directly into it. Google Analytics integration lets you see widget engagement alongside all your other site data — in the same dashboards, segments, and reports you already trust.
G-XXXXXXXXXX — find it in GA4 → Admin → Data Streams → your stream)That's it. The widget detects the new ID on its next load and starts forwarding events. No code changes to your site. No new tracking scripts to manage. Only admins and owners can change the ID.
When the embed script boots, the widget tells it which GA4 property to send to via a WIDGET_GA_INIT postMessage. The embed script then:
window.gtag if it's already on the page — no double initialization, no conflicting config callsgtag.js from googletagmanager.com and initializes it with your Measurement IDsend_to: <your-measurement-id> so events always land in the right property, even on sites with multiple GA streamsFive widget interactions become GA4 events:
| Event | GA4 name | Extra parameters |
|---|---|---|
| Widget opened | widget_open | agent_id |
| Widget closed | widget_close | agent_id |
| Message sent | widget_message_sent | agent_id, message_length |
| AI response received | widget_response_received | agent_id |
| Error occurred | widget_error | agent_id, error_type |
Every event carries agent_id so you can filter by specific agents in GA4 — useful if you run several agents in one organization. message_length (a number of characters) lets you distinguish short queries from detailed ones without capturing message content. error_type tags errors by category (network, auth, rate-limit) for diagnostic dashboards.
Message content is never sent to Google Analytics. Only metadata travels: event type, agent ID, numeric lengths, and error categories. The widget runs GA inside your page's context, so your existing cookie consent banner and GDPR compliance mechanisms control whether tracking fires — exactly as they do for the rest of your site.
If your site already loads GA4, the widget detects window.gtag and uses it directly. If not, it loads gtag.js using your Measurement ID. Either way, events land in the same GA4 property with the same session context as the rest of your site — so widget interactions appear naturally in your user journeys, conversion funnels, and audience segments.
Once events are flowing:
widget_open to see daily/weekly widget engagementwidget_open → widget_message_sent → your conversion event, to measure how many chatters convertagent_id to compare agents side-by-sidesend_to matching your Measurement ID)Widget engagement data has always existed in your Companin dashboard. This integration makes it part of your broader analytics picture — attributed to the same sessions, the same users, and the same goals as everything else you measure. No more switching between tools to understand whether the widget helps convert visitors.