startNewSession
The startNewSession() method forces the next tracked event to start a new session instead of waiting for the session timeout.
There are two forms:
- Default: Starts a new session and clears visit-level data stored on the tracker, such as visit custom variables.
- With preservation enabled: Starts a new session and keeps existing visit-level data.
The SDK doesn't send anything to the server when you call this method. The new session begins when the next event is tracked.
Syntax
Clear visit-level data (typical):
PiwikTracker.sharedInstance()?.startNewSession()[[PiwikTracker sharedInstance] startNewSession];Keep visit-level data:
PiwikTracker.sharedInstance()?.startNewSession(preserveSessionParameters: true)[[PiwikTracker sharedInstance] startNewSession:YES];Related methods
Updated 2 months ago
Did this page help you?