In this article, we'll explain how to make your Certainly bot send data to Google Analytics, and how to visualize Certainly data in your Google Analytics dashboard.
The integration requires the use of a lightweight extension for the Certainly Widget. Please note that it is not possible to use this extension when Certainly is deployed in a different channel, such as Zendesk Chat or Facebook Messenger.
Below, we will cover:
- Configuring the Certainly Extension
- Configuring your Google Analytics (Universal) Dashboard
- Configuring your Google Analytics (v4) Dashboard
- You have created a chatbot on the Certainly Platform.
- You own an account on Google Analytics with at least one registered property (check out Google's documentation).
Configuring the Certainly Extension
- Embed the Certainly Widget on your website after your Google Analytics snippet. Read about where you can grab the snippet for the Certainly Widget.
- Embed the Certainly Google Analytics extension right after the Certainly Widget. This is the snippet, hosted by Certainly's CDN:
After you finish steps 1 and 2, your webpage should look similar to this:
<!-- Google Analytics Script tag -->
// Here goes your Google Analytics deployment, see requirements above
<!-- End of Google Analytics Script tag -->
<!--Certainly Widget Start-->
// You can pass metadata here
<!--Certainly Widget End-->
<!--Google Analytics extension for the Certainly Widget-->
<!--Google Analytics extension for the Certainly Widget End-->
- Navigate to your chatbot on the Certainly Platform. Make sure your bot is set up to expose Custom Variables to the hosting website.
- Then, add the events you want to send to Google Analytics by setting up the Custom Variable
"ga_event"inside relevant Modules. For example, the following setup will throw a "certainly_chat_started" event each time the visitor goes past the <md>Starting module:
- The variable
"ga_event"controls the event action that will be sent to your Google Analytics dashboard. As a best practice, we recommend that you stick to snake_case as a naming convention, and that you prepend
"certainly_"to the actual event name. For example, if you want to send an event for "FAQ Shipping", we recommend you configure the event as
You can also set up a custom event to be sent to Google Analytics in the Global Connections of your bot:
- You can define as many events as you want, but you can only define one event per Module. If you need to send multiple events at once, please split them across multiple consecutive Modules.
- Each event you define will be sent to Google Analytics as soon as your chatbot moves to the next Module in the conversation. If the bot does not move to a new Module, the event is never sent to Google Analytics.
- Event categories and labels are no longer supported by Google Analytics, as of GA4. If your dashboard is running on a previous version, the event will automatically appear under the category "certainly".
That's it—you've now set up your Google Analytics event. Don't forget to save and publish your bot!
Configuring your Google Analytics (Universal) Dashboard
If you're running on Google Analytics (v4), please refer to the following section.
Your chatbot is now sending events to your Google Analytics property. In order to visualize that data on your Analytics dashboard, you will need to set up some user segments. You can read about how to build custom segments in Google's documentation.
For example, the following custom segment includes all website visitors that had a chat with Certainly:
You can configure multiple user segments based on Certainly events. The following custom segment includes all visitors that both (1) had a chat with your Certainly chatbot and (2) purchased something from your webshop:
You can then use your Certainly segments to visualize data inside Google Analytics' Audience Overview:
Additionally, you can use your Certainly segments to visualize data inside Google Analytics' Ecommerce Conversions view:
Configuring your Google Analytics (v4) Dashboard
If you're running on Google Analytics (Universal), please refer to the previous section.
Your Google Analytics property is now receiving custom events from your Certainly bot. It might take up to 24 hours until the events are visible in your dashboard. Once they are, you can use them to create user segments, which provides means of exploring your data.
If you are running on Google Analytics v4, then creating a user segment can be done via the Explorations tool. The following example shows how to create a segment called "Certainly - Chat Started", which includes all users linked to an event "certainly_chat_started". The event name reflects the event label you defined in your own chatbot within the Configuring the Certainly Extension section above.
You can combine Certainly events with other events, custom or built-in, from Google Analytics. For instance, the following user segment, "Certainly - Made a Purchase", includes all users who (1) had at least one chat with Certainly and (2) had at least one transaction on the webshop.
If you have any questions about Certainly's extension for Google Analytics, feel free to get in touch with us!