A event listener can be registered to allow for the host application to see all of the analytics that are being tracked by the Appcues Capacitor Plugin. Refer to the Capacitor documentation for more information about plugin events.
You can register to receive Appcues analytics events using addListener
with an eventName
of analytics
on the Appcues
plugin object:
// Add the listener
Appcues.addListener('analytics', ({analytic, value, properties, isInternal}) => {
// analytic: Enum string indicating the type of the analytic. Possible values listed below.
// value: String containing the primary value of the analytic being tracked. For events - the event name, for screens - the screen title, for identify - the user ID, for group - the group ID.
// properties: Object containing the properties that provide additional context about the analytic.
// isInternal: Boolean indicating if the analytic was internally generated by the SDK, as opposed to passed in from the host application.
console.log(analytic, value, properties, isInternal);
});
...
//Removes the listener
Appcues.removeAllListeners();
There are four different possible values for analytic
and two possible values for isInternal
:
analytic |
isInternal |
SDK call |
---|---|---|
EVENT |
true |
N/A |
EVENT |
false |
Appcues.track() |
SCREEN |
false |
Appcues.screen() |
IDENTIFY |
false |
Appcues.identitfy() |
GROUP |
false |
Appcues.group() |
Events with isInternal == true
correspond to internal SDK events - these capture anything that is generated automatically inside of the Appcues SDK, including flow events and session events.
All other analytics - these are all the screens, events, user or group identities that are passed into the SDK from the host application have isInternal == false
.