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//Init - bot initialized
  • /virtual//Load - bot loaded
  • /virtual//Start - bot started
  • /virtual//Question/ - question asked
  • /virtual//Answer/ - question answered
  • /virtual//Answer_edit_start/ - answer redo started
  • /virtual//Answer_edit_finish/ - answer redo finished
  • /virtual//Leave - user made bot hidden
  • /virtual//Return - user made bot visible back
  • /virtual//Finish - user finished the bot flow
  • /virtual//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:

https://support.google.com/analytics/answer/1034823?hl=en#create_a_filter_at_the_view_level

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):

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

For Google Tag Manager:

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

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

Tags
See also