Google Analytics - How to send events from landbot to a container page

Updated 2 weeks ago by Fran

Learn how to send events from Landbot to a container webpage and track conversions’ source in the right way!

You should apply this process when landbot is embedded into your website - using a domain that’s different from “landbot.io”.

Important: Deactivate the Google Analytics tracking code on the Landbot side (leave the Google Analytics ID field blank on Settings > SEO & Tracking) to make sure it doesn’t duplicate visitors.

We’ll cover now the generic step-by-step process and then a WordPress-specific one. Stay tuned!

Generic Process

  1. Add your Landbot to your container’s webpage using the snippet provided by the app (if you want to embed it you can adapt it’s height, width, and position depending on how you want it to be displayed, and remember to change Landbot's URL for yours!
     var myLandbotFrame = new LandbotFrameWidget({
    container: '#landbot-1548845976063',
    index: 'https://landbot.io/u/H-117144-ZGUSSI5IM2OI5NYH/index.html',
    });
  2. Add this code to the footer of your container’s webpage where landbot will be located:

<script>myLandbotFullpage.on('gaLandbot',function(data){ga.apply(this,data.args);});</script>

Replace "myLandbotFullpage.on" to match it with your snippet, it can be: myLandbotFullpage.on, myLandbotPopup.on, myLandbotFrame.on 

  1. In your chatbot builder, add this code to your “thank you block” - the one that goes right after what you consider a conversion, (e.g. Ask a question > Email). Replace the parameters with your own values:

{html}<script>Landbot.send('gaLandbot', {args: ['send', 'event', 'Category', 'Action','Label' ]});</script>{/html}

Change only 'event', 'Category', 'Action'  and 'Label' with your own values.

Important: If you are going to embed Landbot into your website, do not put two Google Analytics codes! The one of the container page will be more than enough!


How did we do?