Initialize Plugin
Initialize the MoEngage Plugin by calling the MoECapacitorCore.initialize({ appId: "YOUR_WORKSPACE_ID", initConfig: initConfig});. In the case of Ionic-React initialize the plugin in the useIonViewWillEnter() callback, for Ionic-Angular initialize the plugin in ngOnInit().
For more information, read Ionic React Lifecycle.
iOS
Starting from version 5.x.x of capacitor-moengage-core, the default tracking for the custom boolean attribute will be changed to bool from double. To configure this, use MoEAnalyticsConfig and pass true to track the boolean as double or pass false to track it as bool.
import { MoECapacitorCore, MoEAnalyticsConfig, MoEInitConfig} from 'capacitor-moengage-core'
const analyticsConfig: MoEAnalyticsConfig = {shouldTrackUserAttributeBooleanAsNumber: true};
const initConfig: MoEInitConfig = {analyticsConfig: analyticsConfig};
MoECapacitorCore.initialize({ appId: "YOUR_WORKSPACE_ID", initConfig: initConfig });
Refer to the doc for more info
warning |
Warning Make sure you are setting the Push/InApp callback listeners before calling the initialize({ appId: "YOUR_WORKSPACE_ID", initConfig: initConfig }). |