How to track user actions within the bot using Google Analytics / Google Tag Manager?

If you’re using Google Analytics (or Global site tag - gtag.js) on your website where the bot is placed, it’s possible to track user interactions with the bot using your existing Google Analytics account: just enable the tracking and all actions are automatically sent to your analytics account! To enable go to Bot Settings > Analytics

If you enable reporting as pageviews, you will see these bot action results as virtual pageviews in your google analytics reporting:

  • /virtual/bot path/Init - bot initialized
  • /virtual/bot path/Load - bot loaded
  • /virtual/bot path/Start - bot started
  • /virtual/bot path/Question/code name - question asked
  • /virtual/bot path/Answer/code name - question answered
  • /virtual/bot path/Answer_edit_start/code name - answer redo started
  • /virtual/bot path/Answer_edit_finish/code name - answer redo finished
  • /virtual/bot path/Leave - user made bot hidden
  • /virtual/bot path/Return - user made bot visible back
  • /virtual/bot path/Finish - user finished the bot flow
  • /virtual/bot path/Exit - user exited the bot

Where code name is a step setting, which can be adjusted:

please note that when you change it, the analytics reports relying on the exact steps are going to be changed or reset as well.

Please note: this will most likely blow up your total page views, so it probably makes sense to create a separate view for bot actions and filter out bot page views from your existing reporting:

then from predefined filters, you’d need: Exclude/Include only traffic to the subdirectories: use this filter to exclude/include only traffic to a particular subdirectory (such as /motorcycles or /help/content/faq).

If you want to send events to your Google Analytics (or Facebook for example) you can use this solution.

You can also enable reporting as events, and then the events will be sent like this:

For Google Analytics:

    hitType: 'event',
    eventCategory: 'QB',
    eventAction: '<action>',
    eventLabel: '<bot path>'

For Global Site Tag (GA4):

'QB', {
    bot: quriobot.options.use,
    action: name

For Google Tag Manager:

    event: {
        eventCategory: 'QB',
        eventAction: '<action>',
        eventLabel: '<bot path>',

Where eventAction will be in the form:

  • Init - bot initialized
  • Load - bot loaded
  • Start - bot started
  • Question/code name - question asked
  • Answer/code name - question answered
  • Answer_edit_start/code name - answer redo started
  • Answer_edit_finish/code name - answer redo finished
  • Leave - user made bot hidden
  • Return - user made bot visible back
  • Finish - user finished the bot flow
  • Exit - user exited the bot

How to track the conversion via UTM parameters

An easier approach for the tracking of the conversion via the bot is to use UTM parameters:

those will be added automatically to any link provided by the bot or an iframe embedded by it.

Please check a more advanced approach to the UTM parameters, if you need to read them from the URL: How to send the UTM parameter(s) along with the response data

There’s also an additional, custom URL parameters setting, in case you need to skip using UTM parameters, for example, for the internal links, as that’s not recommended:

those parameters will be added to the final URL as is, so please have them properly URL-encoded.

Edit this page

See also