Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. C++ Tracker
  6. Client Sessions

Client Sessions

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);
Code language: JavaScript (javascript)

NOTE: The database path used here must be the same as the one used in the Emitter.

Argument NameDescriptionRequired?
db_nameDefines the path and file name of the databaseYes
foreground_timeoutThe timeout when the app is in focusYes
background_timeoutThe timeout when the app is backgroundedYes
check_intervalThe time between checksYes

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);
Code language: JavaScript (javascript)

If you’d like to learn more about Snowplow BDP you can book a demo with our team, or if you’d prefer, you can try Snowplow technology for yourself quickly and easily.