Google Tag Manager Integration

Learn how to set up Google Tag Manager to track user interactions and behaviors within your Chatbot using GA4

Setting up Google Tag Manager (GTM) for Google Analytics 4 (GA4) event routing for Botsonic Events involves configuring GTM to send specific events generated by Botsonic to your GA4 property. This integration allows you to track user interactions and behaviors within your chatbot using GA4.

Before you begin

  1. Google Tag Manager (GTM) Container Setup: Ensure that you have already set up a GTM container and have access to its ID. This container will be used to manage and deploy tags for tracking Botsonic Events in Google Analytics 4 (GA4).
  2. GTM Installed on Your Website: Verify that GTM is properly installed on your website. This involves adding the GTM container snippet to all pages of your website to enable tracking and tag management.


Step 1 - Set up the Data Layer Variable

Visit https://tagmanager.google.com/#/home and select the Container you've installed on your website which will be used for event tracking and routing.

  1. In the [Variables] page, select the [Data Layer Variable]
  2. Give the Data Layer variable a name, the name should be the same on the variable title space and the Data Layer variable field.
  3. Click [Save]


Step 2 - Set up Triggers

  1. In the [Triggers] page, click [New] to create a new trigger. We currently support the following triggers:

    • Messenger Closed
    • Messenger Opened
    • Message Sent
    • Starter Question Clicked


  1. The trigger title name must match the event name field, and should fire on [All Custom Events]


Step 3 - Set up Tags

  1. In the [Tags] page, click [New]


  1. Select [Google Tag]


  1. Setup the following, then click [Save]
    • Measurement ID and Event name
    • Event parameters using the variables created in the first step
    • Add all the triggers that were created in the previous step
The final result should look like this.

The final result should look like this.