App Center Analytics
App Center Analytics helps you understand user behavior and customer engagement to improve your app. The SDK automatically captures session count and device properties like model, OS version, etc. You can define your own custom events to measure things that matter to you. All the information captured is available in the App Center portal for you to analyze the data.
For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/analytics/cordova
Repo: https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-analytics
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-appcenter-analytics $ npm install --save @ionic-native/app-center-analytics@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
Usage
import { AppCenterAnalytics } from '@ionic-native/app-center-analytics';
constructor(private appCenterAnalytics: AppCenterAnalytics) { }
...
this.appCenterAnalytics.setEnabled(true).then(() => {
this.appCenterAnalytics.trackEvent('My Event', { TEST: 'HELLO_WORLD' }).then(() => {
console.log('Custom event tracked');
});
});
Instance Members
trackEvent(eventName, properties)
Tracks an custom event. You can send up to 200 distinct event names. Also, there is a maximum limit of 256 characters per event name and 64 characters per event property name and event property value.
Param | Type | Details |
---|---|---|
eventName |
string
|
Event name |
properties |
StringMap
|
Event properties |
Returns: Promise<void>
isEnabled()
Check if App Center Analytics is enabled
Returns: Promise<boolean>
setEnabled(shouldEnable)
Enable or disable App Center Analytics at runtime
Param | Type | Details |
---|---|---|
shouldEnable |
boolean
|
Set value |
Returns: Promise<void>
StringMap
Param | Type | Details |
---|