12 Bots Analytics
Use the Analytics Collector API to send events to an analytics app via a Bots custom component.
Adding Analytics to the PizzaBot Sample Bot
OMCe platform APIs, including the Analytics API, are available to a custom component via the conversation.oracleMobile
object.
Use conversation.oracleMobile.analytics.postEvent()
to send data about your bot and how it's being used to OMCe Analytics. You just need to make sure that the OMCe Analytics application is associated with the backend that's running the custom component, and that you configure a custom schema for the Analytics application to handle the data.
To demonstrate how to add Analytics to a bot, we'll use the PizzaBot sample bot.
Setting up the PizzaBot Analytics Application
Set up the Analytics application in OMCe Analytics and attach it to the backend that runs the custom component.
age_checker.js
custom component code.
Setting up the PizzaBot Custom Component
Add analytics to the AgeChecker custom component by modifying the code in age_checker.js
. You add code that takes the data that comes from the bot, and uses the Analytics API to send it to the analytics application.