Skip to main content
First 6 months free

AI Chatbot + Google Analytics 4: Complete Tracking Guide

How to track AI chatbot interactions in GA4, events, conversions, attribution, and full conversion-funnel reporting. Step-by-step with sample dataLayer code.

9 min readUpdated Analytics
Use Pre-Wired Tracking Free

The 5 Events to Track

  • chat_open, visitor opened the widget
  • chat_message_sent, first user message
  • chat_qualified_lead, bot tagged contact as qualified (mark conversion)
  • chat_handoff_requested, visitor asked for human
  • chat_csat_submitted, post-chat survey response

Sample dataLayer Push

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
    event: 'chat_qualified_lead',
    chat_session_id: '{{session_id}}',
    chat_topic: '{{topic}}',
    chat_score: {{score}},
    chat_intent: '{{intent}}',
    value: 0
});

GA4 Configuration

  1. In GTM, create a Custom Event trigger for each chat event name above.
  2. Create a GA4 Event tag for each, with parameters mapped from the dataLayer.
  3. In GA4 admin → Events → mark chat_qualified_lead and chat_csat_submitted as Conversions.
  4. Build a custom Exploration with chat events as steps in a funnel.
  5. Use Path Exploration to see what users do before and after chat.

Attribution Setup

Pass the chat session ID into your CRM as a custom property. When the deal closes, you can match back to the chatbot session and credit revenue. GA4's Conversion Paths report will show chat touch as part of the broader path. For full closed-loop revenue attribution, layer a BI tool (Looker, Mode) on top of CRM + GA4.

One caution on attribution models: chat is almost always a mid-journey touch, not the last click. If you report on last-click only, the chatbot will look worse than it is because the final conversion often happens on a return visit days later. Use a data-driven or position-based model in GA4 so mid-funnel chat touches get partial credit, and lean on the CRM session-ID match for the revenue number you actually defend in a budget meeting.

Recommended Event Parameters

The event name tells you what happened. The parameters tell you whether it mattered. Send these with every chat event so you can segment in GA4 without guessing. Register each one as a custom dimension in GA4 admin, or it will not show up in reports.

ParameterExample valueWhy it matters
chat_session_ida1b2c3De-dupes sessions, links to CRM
chat_topicpricingShows what visitors ask about
chat_intentbuySeparates buyers from browsers
chat_score72Ranks lead quality
chat_page/pricingTies chats to the page that sparked them

Never send message text, email addresses, or names into GA4. Keep those in your CRM behind consent. Analytics gets structured signals only. If you are wiring this on a site built with a no-code AI chatbot, the parameters above are usually template variables you map once.

Confirm the Events Actually Land

Half the tracking bugs we see are events that were built but never verified. Before you trust a single report, prove the data flows end to end. It takes ten minutes.

  1. Open GA4 admin, then DebugView, and turn on GTM Preview mode (or the GA Debugger extension) on your own browser.
  2. Open the widget and send a message. Watch chat_open and chat_message_sent appear in the DebugView timeline within a second or two.
  3. Click each event and confirm the parameters (topic, intent, score, session_id) are present, not blank. Blank means the dataLayer variable did not resolve.
  4. Trigger a qualified-lead path and check chat_qualified_lead fires exactly once, not twice.
  5. Wait 24 hours, then confirm the same events show up in the standard Events report, which is what proves they survived past debug mode.

A Worked Example: Reporting Chatbot ROI

Say your site gets 40,000 sessions a month. The widget opens on 12% of them (4,800 chat_open events) and 55% of those send a message (2,640 real conversations). At a 10% qualified-lead rate, that is 264 chat_qualified_lead conversions a month, each stamped with a topic, intent, and score.

In GA4 you can now answer the questions that actually get budget approved. Segment chat_qualified_lead by chat_page and you might find the /pricing page drives 40% of qualified chats. Segment by chat_topic and you see "integrations" is the top pre-sale question, which tells product and marketing something concrete.

Tie the 264 leads to closed-won deals in your CRM at a 20% close rate and a $1,200 average deal, and the chatbot is influencing about $63,000 in monthly pipeline. That is the number that justifies the tool. Check current plan limits on the pricing page and the cost is trivial against it.

Dashboards Worth Building

  1. Chat funnel. chat_open to chat_message_sent to chat_qualified_lead, as a Funnel Exploration. Watch where visitors drop.
  2. Topic breakdown. chat_qualified_lead grouped by chat_topic. This is a free voice-of-customer report.
  3. Page influence. chat events grouped by chat_page to see which content starts the most valuable conversations.
  4. Handoff rate. chat_handoff_requested over chat_message_sent. A rising rate means the bot needs more knowledge, not more traffic.
  5. CSAT trend. chat_csat_submitted over time, so a quality regression shows up before customers complain.

Common Tracking Mistakes

  • Firing chat_open on every render. Bind it to the session, not the component. Otherwise a single visitor who reopens the widget three times looks like three engaged people.
  • Forgetting to register custom dimensions. Parameters you push but never register in GA4 admin are silently dropped from reports. Register every one you send.
  • Ignoring consent mode. If your tags fire before consent, you have a compliance problem and skewed data. Gate chat tags behind the same consent your other tags use.
  • Marking everything a conversion. If chat_open is a conversion, your conversion rate is meaningless. Only qualified lead and positive CSAT should carry that weight. For the full picture on deploying the widget itself, see our website AI chatbot guide.

Frequently Asked Questions

What events should I track?

chat_open, chat_message_sent, chat_qualified_lead, chat_handoff_requested, chat_csat_submitted at minimum. Mark qualified lead and CSAT as conversions.

How do I attribute revenue?

Pass session ID to CRM, tie to closed-won deals. GA4 Conversion Paths shows chat touchpoints in the journey.

GTM or gtag directly?

GTM if you already run it. Pushing to the dataLayer keeps chat tracking decoupled from your GA4 config. Use gtag directly only when there is no tag manager.

How do I avoid double-counting?

Send a stable chat_session_id and fire chat_open once per session, not per render. Report on unique sessions, not raw event counts.

Is it GDPR compliant?

Yes, if tags sit behind consent and you never send message text, emails, or names. Track topic, intent, and score only. Personal data stays in the CRM.

What conversion rate is realistic?

8 to 15% of engaged chats turning into qualified leads is healthy once tuned. Report the trend against your own baseline, not a generic benchmark.

Tracking out of the box

EzyConn auto-pushes all 5 events to GA4 when GTM is on the page. No JavaScript needed.

Start Free

Last updated . View more guides.

Related resources