Skip to Content
GuidesDevelopersResources
Website and widget

Track widget leads in your analytics tools

Listen to the botello:lead event to count contacts left in the chat in GA4, Google Tag Manager or Meta Pixel.

Plans
All plans
Channels
Website

The chat lives in an iframe: your analytics tools cannot see what happens inside it. So that you can still count the contacts generated by the assistant, the widget dispatches the botello:lead event on your page every time a visitor leaves their contact details. You then forward it to Google Analytics 4, Google Tag Manager, Meta Pixel or any other tool.

Best for

Measuring the number of leads coming from the chat, using them as a conversion goal, optimizing an ad campaign on these leads.

Before you start

  • The widget is installed on your site: see Install the chatbot on your website.
  • Your analytics tool is already installed on the same pages (GA4 tag, GTM container or Meta Pixel).
  • You respect the visitor’s cookie choice: only send the event to an advertising tool if the visitor has accepted it.

The event

PropertyValue
Namebotello:lead
TargetYour page’s window
TypeCustomEvent
Dataevent.detail.source: gate, handoff, chat or widget
Personal dataNone: no name, no e-mail, no message

Values of source:

sourceWhen
gateThe visitor filled in the form required before chatting
handoffThe visitor submitted the contact-the-team form (excluding order tracking)
chatThe assistant took the contact request in the conversation and passed it on to the team
widgetFallback value for any other source added later

Only Botello’s iframe can dispatch the event. It fires when the contact is saved, once per contact.

Connect your tool

Choose the tool

Use the tab below for the tool already on your site. With Google Tag Manager, you only need to add a small script; the rest is configured in GTM.

Add the listener

Paste the script after your analytics tool’s tag, on every page where the widget is installed. It can be before or after the Botello tag.

GA4 with gtag.js
<script>
  window.addEventListener('botello:lead', function (event) {
    if (typeof gtag !== 'function') return;
    // "generate_lead" is a GA4 recommended event.
    gtag('event', 'generate_lead', {
      lead_source: 'botello_' + event.detail.source, // botello_gate, botello_handoff, botello_chat
    });
  });
</script>

In GA4, then mark generate_lead as a key event (AdminEvents). To analyze lead_source, create an event-scoped custom dimension on that parameter.

Check

Open your site, then your platform’s testing tool (GA4 DebugView, GTM Preview mode, Meta Pixel Helper). In the chat, leave your contact details, for example by asking to talk to the team. The event should appear within seconds.

To test without any tool, type this in your browser console:

window.addEventListener('botello:lead', (e) => console.log('botello:lead', e.detail));

Examples

Do

Send a conversion event without personal data, with source as the only detail. To link a lead to a person, use the lead.created webhook on the server side.

Avoid

Try to grab the visitor’s e-mail from the page to send it to an advertising tool: the event deliberately does not contain it.

Troubleshooting

What you seeLikely causeFix
No eventThe listener is on document instead of windowListen on window
No event after the order-tracking formThat form does not create a leadExpected
gtag is not defined or fbq is not definedThe script is placed before the tool’s tag, or the tool is blocked by consentPlace the listener after the tool’s tag. The typeof … !== 'function' check prevents the error
The event shows in GTM but not in GA4GA4 tag not published, or trigger misnamedCheck the exact name botello_lead, then publish the container
Fewer leads in the tool than in BotelloAd blockers, cookies refused, leads from other channels (WhatsApp, Instagram)Expected: the event only covers the widget on your site and depends on the visitor’s browser

Frequently asked questions

Learn more

Was this page helpful?
Checked against the product on 14 November 2026 Suggest a fix

On this page