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.

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.

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