For more information, refer to GitHub.
What Does This Plugin Do?
With this plugin you can track the user interaction with the bot or the bot's behaviour sending the information to Google Analytics.
npm install --save @botonic/plugin-google-analyticsto install the plugin.
- Add it to the
getUserId is set, the plugin will not identify the userId (logged user) to Google Analytics. The clientId will be sent either way in all trackings. (see clientId vs. userId for more information).
The user traits (
getUserTraits) will be sent only if
getUserId is set.
automaticTracking is set to
false, the plugin will not track automatically in every user interaction.
getEventFields is set, the plugin will send a default set of fields to the automatic tracking. This option is used only if
automaticTracking is not set or is set to
This plugin can also be used to track manually.
The tracking must be done inside the
botonicInit method and make sure to call it with the
await keyword to ensure its execution.
For every tracking, the user will be identified with the
userTraits defined in the plugin's options or with its default values.
eventFields contains these Google Analytic event tracking fields :
category: eventCategory in Google Analytics (string, required)
action: eventAction in Google Analytics (string, required)
label: eventLabel in Google Analytics (string, optional)
value: eventValue in Google Analytics (numeric, optional)