Security, Privacy, AI and CSR information for all Piano products now lives in one place. Explore our Compliance Center.
Analytics
English French
English French

What is the difference between a session and a visit on mobile apps?

A visit depends on event activity, and a session depends on the state of the app. A visit ends after 30 minutes without events, while a session ends when the app has been in the background for more than 60 seconds. As a result, the two counts can differ a lot, and one visit often contains several sessions.


Visit

Session

Available on

Mobile apps and web

Mobile apps only

Starts when

The first event is received

The app is launched or brought to the foreground

Ends when

No events are recorded for 30 minutes (default)

The app is in the background for more than 60 seconds, or is killed or closed

Effect of the app going to the background

None directly. What matters is whether events keep being sent.

Ends the session after 60 seconds

Background time in the duration

Can be included

Not included

Identifier

Visit ID (available after processing)

App - Session ID

Visits

A visit is an interaction between a site or app and a visitor who has generated at least one event. It starts when the first event is received and ends when no events are recorded for a defined period, which is 30 minutes by default.

The foreground or background state of the app doesn't directly end a visit. If a user puts the app in the background and comes back within 30 minutes, events resume within the inactivity window, so it's still a single visit.

For example, a user generates an event, puts the app in the background for 12 minutes, then comes back and generates another event. This is still one visit, because the inactivity is under 30 minutes. The time between the two events can be included in the visit's duration.

Sessions

Sessions are specific to mobile apps and track the app's period of active use. A session includes all events from the moment the app is launched or brought to the foreground until it ends. A session ends when:

  • the app is in the background for more than 60 seconds.

  • the app is killed or closed.

If the app returns to the foreground within 60 seconds, the session continues instead of a new one starting. Time spent in the background isn't included in the session duration.

Each session has a unique App - Session ID. Piano Analytics uses this identifier because mobile apps can't rely on browser cookies in the same way websites do.

Several sessions in one visit

A visit is based on event inactivity (30 minutes) and a session is based on the state of the app (60 seconds in the background). It's therefore common to have several sessions in a single visit.

For example, a user opens the app at 10:00, puts it in the background at 10:15, reopens it at 10:20 and stops at 10:23:

  • Visits: 1, because there was no 30-minute inactivity.

  • Sessions: 2 (10:00 to 10:15, and 10:20 to 10:23).

This is a frequent reason for the gap between visit counts and session counts in mobile reporting.

Last updated: