For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.

MobileFirst Cordova plug-in initialization of analytics

The MobileFirst Cordova plug-in prepares your iOS app for sending analytics data to the server. If your app does not require analytics, this code can be removed.


The MobileFirst plug-in adds two lines for creating the listeners after the web framework initialization is complete and web resources are ready to be used. These appear in the wlInitWebFrameworkDidCompleteWithResult function in the MFPAppDelegate.m file.

[[WLAnalytics sharedInstance] addDeviceEventListener:NETWORK]; [[WLAnalytics sharedInstance] addDeviceEventListener:LIFECYCLE];

These lines can be removed if not needed.

To send analytics data to the server, the developer must explicitly add the call within index.js or any subsequently added JavaScript files:


For more information on MobileFirst analytics see MobileFirst Cordova plug-in initialization for analytics.

Parent topic: Developing Cordova apps for iOS