tracking · conversions · chatbot

Measuring chat-widget leads in Google Analytics and Google Ads (Pipedrive LeadBooster as the worked example).

First published 30 April 2023. Restored 1 November 2026; the steps and menu names are from then.

Pipedrive LeadBooster chat window next to the Google Ads, Google Tag Manager and Google Analytics logos

Pipedrive is a well-regarded CRM, and one of its most valued features is LeadBooster Chat, a chatbot that collects leads on your website. The bot is fully automated and quick to set up. Getting its conversations into Google Analytics as events and conversions is a different story, and that is where many businesses get stuck.

This note gives you a ready-made script and a step-by-step guide to track LeadBooster Chat interactions in Google Analytics 4 and Google Ads.

What do you need before you start?

  • The Company ID and Playbook ID of your LeadBooster chatbot. Both live in your Pipedrive LeadBooster account.
  • An active Google Tag Manager container. That is where the script goes.
  • A Google Analytics 4 account, to record the chat interactions as events and conversions. If you don’t have one yet, you can create one for free.
  • A Google Ads account with access to conversion setup, if you also want to count the chats as conversions in Google Ads.

With those four in place you can start.

How do you get Google Tag Manager to listen to LeadBooster events?

The first step is putting the script into Google Tag Manager.

  1. Find your Company ID and Playbook ID. Log into Pipedrive and go to Leads > LeadBooster > Live Chat > select the Playbook > Installation > Manual installation.
  2. Copy the script below and put your Company ID and Playbook ID in the two places marked with X’s.
<script>
  window.pipedriveLeadboosterConfig = {
    base: 'leadbooster-chat.pipedrive.com',
    companyId: XXXXXXX,
    playbookUuid: 'xxxxxxx-xxxxxxx-xxxxxxxxx-xxxxxxx',
    version: 2
  };
  (function() {
    var w = window;
    if (w.LeadBooster) {
      console.warn('LeadBooster already exists');
    } else {
      w.LeadBooster = {
        q: [],
        on: function(n, h) {
          this.q.push({ t: 'o', n: n, h: h });
        },
        trigger: function(n) {
          this.q.push({ t: 't', n: n });
        }
      };
      w.LeadBooster.on('conversationEnded', function(data) {
        var eventLabel = data.qualified ? 'chat-lead' : 'conversation-ended';
        dataLayer.push({
          'event': 'leadboosterEvent',
          'eventCategory': 'LeadBooster Chat',
          'eventAction': 'Conversation Ended',
          'eventLabel': eventLabel,
          'eventValue': null
        });
      });
      w.LeadBooster.on('opened', function(data) {
        dataLayer.push({
          'event': 'leadboosterEvent',
          'eventCategory': 'LeadBooster Chat',
          'eventAction': 'Opened',
          'eventLabel': 'chat-opened',
          'eventValue': null
        });
      });
      w.LeadBooster.on('closed', function(data) {
        dataLayer.push({
          'event': 'leadboosterEvent',
          'eventCategory': 'LeadBooster Chat',
          'eventAction': 'Closed',
          'eventLabel': 'chat-closed',
          'eventValue': null
        });
      });
    }
  })();
</script>
<script src="https://leadbooster-chat.pipedrive.com/assets/loader.js" async></script>
  1. Open Google Tag Manager and create a new Custom HTML tag. Set the trigger to fire on every page.
  2. Paste the script into the tag.
  3. Hit Preview in Google Tag Manager to test it.

The script does two things: it shows the chat on your website, and it listens to what happens in the chat. Every time the chat is opened or closed, or a conversation ends, it pushes an event called leadboosterEvent into the data layer, with an eventAction that says which of the three it was. When a conversation ends, the eventLabel is chat-lead if LeadBooster marks the conversation as qualified, otherwise conversation-ended.

Now that Google Tag Manager can hear the chat, we can build triggers and tags on top of it.

How do you set up triggers for opened, closed and conversation ended?

Three events matter: the chat was opened, the chat was closed, and a conversation ended. You need one data layer variable and three triggers.

1. Create a data layer variable.

  • In Google Tag Manager go to Variables, scroll down, click New and choose Data Layer Variable.
  • Name it Leadbooster Data Layer Var.
  • Set the Data Layer Variable Name to eventAction.

2. Create the “opened” trigger.

  • Go to Triggers, click New and choose the Custom Event trigger type.
  • Trigger name: Leadbooster Opened
  • Event name: leadboosterEvent
  • This trigger fires on Some Custom Events, where eventAction equals Opened

3. Do the same for “closed”.

  • Trigger name: Leadbooster Closed
  • Event name: leadboosterEvent
  • Fires on Some Custom Events where eventAction equals Closed

4. And the one that matters most, “conversation ended”.

  • Trigger name: Leadbooster Lead
  • Event name: leadboosterEvent
  • Fires on Some Custom Events where eventAction equals Conversation Ended

With these three triggers you can send each event to Google Analytics 4 the moment it happens.

How do you turn them into GA4 events and conversions?

Script and triggers are in place. The next step is GA4 events for “Opened”, “Closed” and “Conversation Ended”. While you test in Google Tag Manager’s Preview mode, you should see the events arrive in the real-time report. To check:

  1. Log into Google Analytics 4.
  2. Click Reports in the left-hand menu.
  3. Click Real-time.
  4. Scroll down to the card titled “Event count by event name”.

You should see the events come in live while you test in Preview.

Before you can mark them as conversions, the events first have to show up in Google Analytics 4. That can take up to 72 hours, though it is usually sooner. Then:

  1. Log into Google Analytics 4.
  2. Go to Admin, bottom left.
  3. In the property column, click Events.
  4. Flip the switch on one or all of these events to count them as conversions.

How do you count the chat as a conversion in Google Ads?

  1. Log into Google Ads.
  2. Go to Tools & Settings and choose Conversions.
  3. Click ”+” for a new conversion action.
  4. Choose Website as the source and scan your URL.
  5. Scroll down and click ”+ Add a conversion action manually”.
  6. Fill in the conversion name and value.
  7. Give the conversion a fixed value. A target ROAS strategy works with that value, so this is how you give one conversion priority over another.
  8. Google Ads then offers to place the tag through Google Tag Manager.
  9. In Google Tag Manager, create a new Google Ads Conversion Tracking tag.
  10. Fill in the Conversion ID and Conversion Label that Google Ads generated.
  11. Attach the tag to the Leadbooster Lead trigger (the “conversation ended” event).

Same thing here: it can take up to 72 hours before the conversions come through correctly.

What are the five steps, in short?

  1. Set up Google Tag Manager.
  2. Add the LeadBooster listener script.
  3. Create the data layer variable, the triggers and the tags for the LeadBooster events.
  4. Set up GA4 events for opened, closed and conversation ended.
  5. Set up Google Ads conversion tracking for ended conversations.

Once this runs, you can see how many chats were started, how many of them ended in a qualified lead, and the overall conversion rate. Ask the companies you work with to put this on their site.

Book a free audit →