How Track Google Analytics Events in Landbot with Google Tag Manager (GTM)

Ana Updated by Ana

Google Tag Manager is a tag management system that allows you to quickly and easily update tags and code snippets on your website or mobile app. 

This article explains how to send Custom Events from Landbot to a container page using GTM and being tracked by Google Analytics.

Part Zero: In your page where the bot will be embedded

From your workspace in GTM, go to the Admin > Install Google Tag Manager section and copy and paste the required code snippets into your website:

Part One: In GTM (Trigger Creation)
  1. Go to your Workspace and Select Triggers

  1. Select New

  1. Then a modal to create our new trigger will pop up. In this case, we will call it LandbotEvent

  1. Now we click on Trigger Configuration:

  1. And Select Custom Event:

  1. And we call the event "LeadCaptured":

And press Save.

Part Two: In GTM (Tag Creation)
  1. Select Tags

  1. Select New:

  1. We will call it the GA event from LandbotEvent:

  1. For Tag Configuration, we select "Google Analytics: GA4 Event":

  1. Paste your Google Analytics Measurement ID and give a name to the tag event that will be tracked:

  1. Fill in the rest of the parameters according to your needs:

  1. Now go to the Triggering Section

  1. Where we are going to select the Trigger that we just created:

  1. And now the Tag configuration is ready to Save

Now your Tag is ready, save your changes and publish:

Part Three: In Landbot add the trigger of the custom event
  1. Add a Code block:

  1. Add the following code:

window.dataLayer.push({'event':'LeadCaptured'});

Finally, test the bot from your website and then see from your Google Analytics workspace the event captured under the tag name "my_event" (you will need to wait a couple of minutes to see the data in real time).

How did we do?

Landbot in your web with Google Tag Manager

Contact