Your chatbot is generating leads, but are they showing up in Google Analytics? Most chatbot tools handle conversations fine — but don't send any data to GA4. That means your reports show page views but miss the actual conversions happening inside the chat widget.
This guide walks you through tracking chatbot leads in GA4: the manual way using events and GTM, and a zero-code alternative.
Before diving into setup, decide which chatbot interactions matter most. Here are the events worth tracking:
| Event Name | When It Fires | Why It Matters |
|---|---|---|
chatbot_opened |
Visitor opens the chat widget | Measures engagement / interest |
chat_started |
Visitor sends first message | Measures intent |
lead_captured |
Visitor submits email/phone/name | This is your conversion |
chat_handoff |
AI escalates to human agent | Measures AI coverage gaps |
chat_completed |
Conversation ends | Measures completion rate |
The most important one is lead_captured — that's when a visitor gives you their contact information. Everything else is supporting data.
If your chatbot provider exposes JavaScript events or callbacks, you can push events to GA4 directly.
Most chatbot tools have an API or callback system. Check your provider's docs for event hooks. Common patterns:
// Tidio example
document.addEventListener('tidioChat-open', function() {
gtag('event', 'chatbot_opened');
});
// Intercom example
Intercom('onShow', function() {
gtag('event', 'chatbot_opened');
});
// Drift example
drift.on('startConversation', function() {
gtag('event', 'chat_started');
});
If your chatbot doesn't expose JavaScript events, skip to Method 2 or Method 3.
Use the gtag() function to send custom events. Add event parameters to capture useful context:
// When a lead is captured
gtag('event', 'lead_captured', {
'event_category': 'chatbot',
'event_label': 'email_submitted',
'page_path': window.location.pathname
});
Place this code where your chatbot fires its lead capture callback.
For your event parameters to appear in reports:
In GA4, go to Admin → Custom definitions
Click Create custom dimension
Add dimensions for event_category, event_label, or whatever parameters you're sending
Go to Admin → Events
Find lead_captured in the event list
Toggle Mark as conversion
Now GA4 treats every chatbot lead as a conversion. This flows through to Google Ads if you've linked your accounts.
If you prefer GTM over inline code, you can use the dataLayer approach.
Add this code to your website, triggered by your chatbot's events:
// When chat widget opens
dataLayer.push({
'event': 'chatbot_opened',
'chatbot_provider': 'your-chatbot-name'
});
// When a lead is captured
dataLayer.push({
'event': 'lead_captured',
'chatbot_provider': 'your-chatbot-name',
'lead_type': 'email'
});
Go to Triggers → New
Choose Custom Event
Event name: lead_captured
Save
Repeat for any other events you want to track.
Go to Tags → New
Choose Google Analytics: GA4 Event
Select your GA4 Configuration tag
Event name: lead_captured
Add event parameters from your dataLayer variables
Trigger: the custom event trigger you just created
Save
Click Preview in GTM
Open your website and interact with your chatbot
Verify the tags fire correctly in Tag Assistant
Check GA4 DebugView to confirm events arrive
Both methods above require:
Your chatbot to expose JavaScript callbacks (many don't)
Custom code on your website
GTM configuration and ongoing maintenance
Testing every time your chatbot provider updates their widget
If your chatbot loads inside an iframe (which many do), you can't access its DOM or events from your page at all. This is the most common blocker.
Boei includes a built-in AI chatbot that automatically sends lead events to your analytics — no code, no GTM, no iframe workarounds.
Create your AI chatbot in the Boei dashboard — paste your website URL, and the AI learns your content automatically
Enable Google Analytics in your widget's analytics settings — Boei detects your existing GA4 installation
Done — events fire automatically:
BoeiOpened → visitor opens the chatbot
BoeiConversion → visitor submits their contact info
No JavaScript API needed — Boei controls the widget, so it handles tracking natively
No iframe limitations — events are pushed directly to your analytics, not from inside an iframe
Multi-platform tracking — enable Google Analytics, Google Tag Manager, Facebook Pixel, and Plausible simultaneously
Lead data flows to analytics — email, phone, and name are automatically pushed to your analytics for conversion tracking and retargeting
50+ channels included — besides the AI chatbot, add WhatsApp, Telegram, phone, email, Instagram DM, and more. All tracked the same way.
Plans start from $14/month with the AI chatbot included (2,000 AI messages/month). 7-day free trial, no credit card required.
Once events are flowing (via any method), here's how to get value from the data.
In GA4 Explore, create a funnel exploration:
Step 1: page_view (any page)
Step 2: chatbot_opened (or BoeiOpened)
Step 3: lead_captured (or BoeiConversion)
This shows you the drop-off at each stage. If many visitors open the chatbot but few submit their info, you may need to adjust your lead capture timing or questions.
Create a GA4 segment for chatbot leads and break it down by source/medium. You'll see whether chatbot leads come from organic search, paid ads, social media, or direct traffic. This helps you allocate budget to the channels that drive the most chatbot conversations.
In Google Ads, go to Goals → Conversions → Import
Select your GA4 property
Import the lead_captured or BoeiConversion event
Set a conversion value (e.g., $10 per lead)
Google Ads will now optimize your campaigns toward visitors who are likely to chat and leave their contact info — not just visitors who view your page.
It depends on whether they expose JavaScript events. Tidio and Intercom have documented event hooks. Drift has a JavaScript API. But most load inside iframes, which limits what you can track from your page. Check your provider's docs for "Google Analytics integration" or "event tracking."
A chatbot open means someone clicked the chat icon. A lead means they submitted contact information (email, phone, name). Opens measure interest; leads measure conversions. Track both, but mark only lead_captured as a GA4 conversion.
Events appear in DebugView immediately. In standard reports, they can take 24-48 hours. The event will appear in your Events list within 24 hours, at which point you can mark it as a conversion.
Technically yes, using event parameters. But sending personally identifiable information (PII) like email addresses to GA4 violates Google's Terms of Service. Instead, send a hashed version or a lead ID that you can match in your CRM. Boei handles this by pushing lead data to analytics in a privacy-compliant way.
If you use a consent management platform, GA4 tags won't fire until the visitor accepts analytics cookies. This means you may undercount chatbot interactions from visitors who decline cookies. Google's Consent Mode v2 can model conversions for non-consenting users, but the actual events won't fire.
Add page_path as an event parameter. In GA4, create a custom report with the lead_captured event filtered by page path. This tells you exactly which pages drive chatbot conversations — so you can add the chatbot to more pages like those.
Article by
Ruben is the founder of Boei, with 12+ years of experience in conversion optimization. Former IT consultant at Ernst & Young and Accenture, where he helped product teams at Shell, ING, Rabobank, Aegon, NN, and AirFrance/KLM optimize their digital experiences. Now building tools to help businesses convert more website visitors into customers.
Get 30% more conversations and effortlessly convert them into customers.
Don't wait, experience it for free yourself!
URL
Trusted by 10,000+ businesses
Quick 5-min, no code setup
Learn how to add Facebook Messenger chat to your WordPress site. Let readers message you directly from your blog without leaving the page.
Easily add a WhatsApp chat button to your website with our step-by-step guide. Enhance communication and user engagement effortlessly.
I compared message credit systems across 8 AI chatbot platforms. See what each response actually costs on budget, mid-tier, and premium AI models.
I compared how 10 AI chatbot platforms measure training data: characters, pages, MB, and words. See normalized costs per dollar.
Discover 18 proven AI chatbot use cases across customer support, sales, e-commerce, and HR. Real examples with ROI metrics and implementation tips.