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. If you're looking for a complete overview of GA4 chatbot integration, see our Google Analytics integration page. For broader analytics capabilities, check out Boei's built-in analytics dashboard.
Manual vs. Automatic Tracking: Quick Comparison
| Manual (gtag.js / GTM) | Automatic (Boei) | |
|---|---|---|
| Setup time | 30-60 minutes | 2 minutes |
| Events tracked | Only what you configure | Opens, leads, and channel clicks out of the box |
| Ongoing maintenance | Update code when chatbot provider changes | None - handled automatically |
| Iframe compatibility | Blocked by most chat widgets | Works natively, no iframe issues |
| Accuracy | Depends on implementation quality | Consistent, pre-tested event firing |
What Chatbot Events Should You Track in GA4?
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.
Method 1: Manual Setup with gtag.js
If your chatbot provider exposes JavaScript events or callbacks, you can push events to GA4 directly.
Step 1: Identify Your Chatbot's JavaScript API
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.
Step 2: Send Events to GA4
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.
Step 3: Register Custom Definitions in GA4
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
Step 4: Mark as Conversion
- Go to Admin → Events
- Find
lead_capturedin 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.
Method 2: Setup with Google Tag Manager
If you prefer GTM over inline code, you can use the dataLayer approach.
Step 1: Push Events to the dataLayer
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'
});
Step 2: Create Triggers in GTM
- Go to Triggers → New
- Choose Custom Event
- Event name:
lead_captured - Save
Repeat for any other events you want to track.
Step 3: Create GA4 Event Tags
- 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
Step 4: Test in Preview Mode
- 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
The Problem with Manual Tracking
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.
Method 3: Automatic Tracking with Boei
Boei includes a built-in AI chatbot that automatically sends lead events to your analytics. No code, no GTM, no iframe workarounds.
Setup in 2 minutes:
- 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 chatbotBoeiConversion→ visitor submits their contact info
What makes this different:
- 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 $19/month with the AI chatbot included (2,000 AI messages/month). 7-day free trial, no credit card required.
Using Chatbot Lead Data in GA4
Once events are flowing (via any method), here's how to get value from the data.
Build a Conversion Funnel
In GA4 Explore, create a funnel exploration:
- Step 1:
page_view(any page) - Step 2:
chatbot_opened(orBoeiOpened) - Step 3:
lead_captured(orBoeiConversion)
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.
Segment by Traffic Source
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.
Import as Google Ads Conversion
- In Google Ads, go to Goals → Conversions → Import
- Select your GA4 property
- Import the
lead_capturedorBoeiConversionevent - 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.
FAQ
Can I track chatbot leads from Tidio, Intercom, or Drift in GA4?
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."
What's the difference between tracking chatbot opens vs. leads?
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.
How long until I see chatbot events in GA4?
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.
Can I pass the lead's email to GA4?
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.
Does chatbot tracking work with cookie consent banners?
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.
How do I track which pages generate the most chatbot leads?
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.