How to Track Chatbot Leads in Google Analytics 4 (2026)

Ruben Buijs Ruben Buijs Mar 11, 2026 6 min read Updated Mar 13, 2026 ChatGPT Claude

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.

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:

  1. In GA4, go to AdminCustom definitions

  2. Click Create custom dimension

  3. Add dimensions for event_category, event_label, or whatever parameters you're sending

Step 4: Mark as Conversion

  1. Go to AdminEvents

  2. Find lead_captured in the event list

  3. 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

  1. Go to TriggersNew

  2. Choose Custom Event

  3. Event name: lead_captured

  4. Save

Repeat for any other events you want to track.

Step 3: Create GA4 Event Tags

  1. Go to TagsNew

  2. Choose Google Analytics: GA4 Event

  3. Select your GA4 Configuration tag

  4. Event name: lead_captured

  5. Add event parameters from your dataLayer variables

  6. Trigger: the custom event trigger you just created

  7. Save

Step 4: Test in Preview Mode

  1. Click Preview in GTM

  2. Open your website and interact with your chatbot

  3. Verify the tags fire correctly in Tag Assistant

  4. 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:

  1. Create your AI chatbot in the Boei dashboard — paste your website URL, and the AI learns your content automatically

  2. Enable Google Analytics in your widget's analytics settings — Boei detects your existing GA4 installation

  3. Done — events fire automatically:

    • BoeiOpened → visitor opens the chatbot

    • BoeiConversion → 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 $14/month with the AI chatbot included (2,000 AI messages/month). 7-day free trial, no credit card required.

Try Boei Free →

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:

  1. Step 1: page_view (any page)

  2. Step 2: chatbot_opened (or BoeiOpened)

  3. 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.

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

  1. In Google Ads, go to GoalsConversionsImport

  2. Select your GA4 property

  3. Import the lead_captured or BoeiConversion event

  4. 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.

Ruben Buijs

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.

Convert more visitors into leads

Join 10,000+ businesses using Boei

  • AI chatbot + 50 contact channels
  • 5-minute setup, no coding
  • 7-day free trial
  • Shared inbox + CRM
Try Free

Create your first Boei widget today

Get 30% more conversations and effortlessly convert them into customers.
Don't wait, experience it for free yourself!

URL

https://
https://

Trusted by 10,000+ businesses

Quick 5-min, no code setup

Andrew Lee David S. Vance W. Grant Nitesh Manav
from 159 reviews

Read more

Add Facebook Messenger Chat to WordPress
Add Facebook Messenger Chat to WordPress

Learn how to add Facebook Messenger chat to your WordPress site. Let readers message you directly from your blog without leaving the page.

How to Add a WhatsApp Chat Button to Your Website
How to Add a WhatsApp Chat Button to Your Website

Easily add a WhatsApp chat button to your website with our step-by-step guide. Enhance communication and user engagement effortlessly.

AI Chatbot Message Credits: Real Cost Per Response (2026)
AI Chatbot Message Credits: Real Cost Per Response (2026)

I compared message credit systems across 8 AI chatbot platforms. See what each response actually costs on budget, mid-tier, and premium AI models.

AI Chatbot Training Data Limits Compared (2026)
AI Chatbot Training Data Limits Compared (2026)

I compared how 10 AI chatbot platforms measure training data: characters, pages, MB, and words. See normalized costs per dollar.

18 AI Chatbot Use Cases With Real Examples (2026)
18 AI Chatbot Use Cases With Real Examples (2026)

Discover 18 proven AI chatbot use cases across customer support, sales, e-commerce, and HR. Real examples with ROI metrics and implementation tips.