For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Tracking users
To track individual users, use the setUserContext and unsetUserContext methods.
To track users, follow these steps.
- iOS
- Add the following code when the user logs in.
[[WLAnalytics sharedInstance] setUserContext:@"John Doe"];
- Add the following code when the user logs out.
[[WLAnalytics sharedInstance] unsetUserContext];
Android
- Add the following code when the user logs in.
WLAnalytics.setUserContext("John Doe");
Add the following code when the user logs out. WLAnalytics.unsetUserContext();
Cordova Not supported.
Web
- Add the following code when the user logs in.
ibmmfpfanalytics.setUserContext(user);
There is no unsetUserContext in the web API. The user session ends after 30 minutes of inactivity, unless another call is made to ibmmfpfanalytics.setUserContext(user).
Parent topic: Capturing analytics