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

Suppose you’re using Google Analytics (or Global site tag - gtag.js) on your website where the bot is placed. In that case, it’s possible to track user interactions with the bot using your existing Google Analytics account: 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 - the user made bot hidden
  • /virtual/bot path/Hide - bot was hidden (either via user action or by itself)
  • /virtual/bot path/Return - the user made the bot visible back
  • /virtual/bot path/Finish - the 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:

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>',
    eventValue: {answer}
}

For Global Site Tag (GA4):

'event',
'QB', {
    bot: '<bot path>',
    action: '<action>',
    answer: {answer}
}

For Google Tag Manager:

{
    event: 'QB',
    bot: '<bot path>',
    action: '<action>,
    answer: {answer}
}

Where ‘action’ 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 - the user has made the bot hidden
  • Hide - the bot was hidden (either by the user action or by itself)
  • Return - the user has made the bot visible back
  • Finish - the user has finished the bot flow
  • Exit - the user has exited the bot

How to send Quriobot events from GTM to GA4 property that is triggered from GTM

When triggered from GTM, GA4 won’t receive custom events that Quriobot is sending to GTM by default, so you’ll need to take such steps in order to implement sending of the events to GA4:

In GTM, create 2 variables, action, bot and answer:

n GTM, create a tag of type GA4 event, selecting the previously created configuration:

The event name should be set to ‘QB’ Also, add event parameters:

  • bot with value {{bot}}
  • action with value {{action}}
  • answer with value {{answer}}

In GTM, create a trigger of type Custom Event:

et Event name to QB and select to fire the trigger when Event equals QB

In GTM, select the previously created GTM trigger to fire the previously created GA4 event tag:

How to track the conversion via UTM parameters

An easier approach for tracking 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