Track your chatbot using Google Analytics

Use Google Analytics to track how your visitors are engaging with your bots. If you want to track enhanced ecommerce stats including product clicks and add to cart as to products recommended by Gobot, you'll need to leverage our Google Tag Manager functionality detailed here.

As a preliminary step, if you haven't already, you'll need to install your Google Analytics tracking snippet on your website in order for this feature to function.  Click here (analytics.js) and here (gtag.js) for more information as to installing your snippet. Also, be sure to disable any adblocker or similar plugin.

Next, follow these steps:

Go to the Gobot bot dashboard, select the chatbot you want to track, and click Bot Settings. Then click on the Advanced tab and then on the Analytics & Tracking sub-tab.  Look under Google Analytics, and review the options in the pull-down menu. 


If you select Automatic, all of the user interactions and associated user responses will be tracked in Google Analytics, consistent with the table below, even without you dragging the Google Analytics element into your bot script.  

ga(‘send’, ‘event’, [category], [action], [label], [value]);

The default pull-down menu option is Custom, which allows you to specifically designate directly within your bot script which user interaction (but not associated user response) you want to track using Google Analytics.  This is the default selection - so absent action on your part no data will be sent to Google Analytics until you drag the Google Analytics button into your bot script.  The Custom option makes sense if you want to track only one or a couple of user interactions (and not the associated user response), as the shorter list will make it easier to identify those elements in Google Analytics.  We will discuss the Custom option below in more detail.

If you've opted for the Custom selection, you will need to designate the user interaction you want to track. Click Save and you will be brought back to the bot builder.

  1. Drag the Google Analytics button into your bot script directly after the user interaction you want to track. This step is not required if you selected Automatic instead of Custom in Bot Settings.
  2. In the right hand panel, enter your Google Analytics Action and, optionally, Label and Value into the fields and click Save.  Category will be automatically passed as "Gobot-" followed by a string of numbers and letters representing your bot ID but you can edit this to reflect something more meaningful related to your campaign.  Select Action to correspond to whatever user interaction you want tracked.  For example, if you drag the Google Analytics button after an Email Field in a bot scripted to subscribe visitors to your newsletter, you may want to call the Action "Lead", etc.  In the example below, the field is used to collect the visitor's name, also a lead, and the Label field is left blank but can be used to supply additional information. Value is set by default to zero but can optionally be set to another number.
  3. As soon as the bot script gets to that user interaction in your bot script, Gobot will notify Google Analytics for tracking purposes.  Gobot will send a Google Analytics Event including a Category, Action, and, optionally, a Label and Value.  In the case of the Custom option, Gobot will not send the user's response to Google Analytics.  This data is only sent if you opt for the Automatic mode.
  4. You can find all of your bot's conversations in Google Analytics under Behaviour > Events > Overview

Setting Goals in Google Analytics

To see how to use the above event generated by Gobot to set up Goals (for easier use in other reports, like conversion tracking), please refer to this Google Analytics help article.

Please note that it may take a couple of hours for Google Analytics to update.  So give it some time after your bot first runs when conducting your testing!

Copyright 2019, Gobot LLC, All rights reserved.

Was this article helpful?

You might also find interest in these related articles:

  1. Track your bot's conversions using Google Ads (Adwords)
  2. How to use Facebook Pixel with Gobot