Sessions
Vessel provides you with visibility what your users are doing by monitoring the user sessions and application sessions in progress.
1. Start User Session
A user session begins when a user takes certain action and ends when action is completed.
/* To start a new session you can use following method
@param sessionName -The session that is to be started.
*/
- (void) startSession:(NSString*)sessionName;
//Example -To major time spent in shopping cart you need add following code.
Vessel *sharedInstance = [Vessel sharedInstance];
[sharedInstance startSession:@"shoppingCart"];
/**
* This method starts a session with given session name. If a session is
* already active with the given sessionName then no action is taken.
*
* @param sessonName
*/
public static void startSession(String sessonName);
// Example
VesselSDK.startSession("checkout");
/**
* This method starts a session with given session name. If a session is
* already active with the given sessionName then no action is taken.
*
* @param sessonName
*/
vesselsdk.startSession('checkout');
2. End User Session
/* To end a session you can use following method
@param sessionName -The session that is to be started.
*/
- (void) endSession:(NSString*)sessionName;
// Example -To complete shopping cart session we started, you can use following method
[sharedInstance endSession:@"shoppingCart"];
/**
* This method ends the session with the given sessionName. Can be called
* even if the session has not been started.
*
* @param sessionName
*/
public static void endSession(String sessionName)
// Example
VesselSDK.endSession("checkout");
/**
* This method ends the session with the given sessionName. Can be called
* even if the session has not been started.
*
* @param sessionName
*/
test.endSession("checkout");
3. End All Sessions
Include the code below to ensure that all session times, including when the App is in the background are properly recorded.
/** Ends all sessions that have been started but haven't been ended yet.
*/
[sharedInstance endAllSessions];
/**
* This method closes all the active sessions and reports them to the Vessel Platform
*/
//Example
VesselSDK.endAllSessions();
/**
* This method closes all the active sessions and reports them to the Vessel Platform
*/
vesselsdk.endAllSessions()
4. Discard All Sessions
If you want to discard all sessions that have been started but haven't been ended yet, you can use following method.
/** Discards all sessions that have been started but haven't been ended yet.
*/
[sharedInstance discardAllSessions];
/**
* This method will discard all sessions
*/
public static void discardAllSessions()
//Example
VesselSDK.discardAllSessions()
/** Discards all sessions that have been started but haven't been ended yet.
*/
vesselsdk.discardAllSessions();
Updated less than a minute ago