You can optionally decide to include Client Sessionization. This object will keep track of your users sessions and can be configured to timeout after a certain amount of inactivity. Activity is determined by how often events are sent with the Tracker – so you will need to send events to keep the current session active.
ClientSession client_session("sp.db", 5000, 5000, 2500);
NOTE: The database path used here must be the same as the one used in the Emitter.
|Defines the path and file name of the database||Yes|
|The timeout when the app is in focus||Yes|
|The timeout when the app is backgrounded||Yes|
|The time between checks||Yes|
All timing metrics are configured in milliseconds.
To set the background/foreground state you will need to detect this and then set this on the ClientSession object like so:
client_session.set_is_background(true || false);