Sessions and Users

There are two important properties you will add to each message:

  • sessionId - a unique identifier for the current session

  • userId - a unique identifier for the user

Users

Although you can use identify to merge sessions and profiles, it is a must to store a persistent identifier for your user so every event by that user is collected into Profiles and Sessions.

We suggest using a unique string such as a UUID, nanoID or ulid.

If using a browser this identifier can be stored in LocalStorage or a cookie, but we suggest using a more persistent method for better accuracy in your data.

It can be hard to keep persistent data about a user in browser cookies because of user privacy concerns.

To make things easy we have a solution for storing these kinds of credentials, called PrivacyID.

Sessions

Sessions are used to identify that an event came from a specific sessions, such as a browser session or usage of an app.

We suggest using a unique string such as a UUID, nanoID or ulid.

If you are tracking in a browser it is fine to store this value in a non-guaranteed persistent storage such as LocalStorage as it does not need to be used across browsing sessions.

By default Fanplayr 360 assumes a session has ended 45 minutes after it receives the last message with a given sessionId. Because of this we suggest storing the last time a message was sent from a given ID and creating a new sessionId if it was longer than 45 minutes ago.

Last updated