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

How is time spent per visit calculated?

Piano Analytics calculates time spent from the time between consecutive events in the same visit. The calculation stops at the last event of the visit, because there's no later event to measure against. A visit ends after 30 minutes of inactivity, and at midnight.

For example, a visitor views a page at 10:00:00, clicks a link at 10:00:40, then views a second page at 10:02:00 and leaves. The visit's time spent is 2 minutes. The time spent reading the second page isn't counted, because no event follows it.

Visits with and without duration

  • Visit without duration: a visit with only one event. There's no second event to measure against, so it has no time spent.

  • Visit with duration: a visit with at least two events of any type (for example, page.display, click.action or click.download).

  • Visit with at least one page with duration: a visit with at least two page.display events, so the time between two page views can be measured. A visit can have duration without having a page with duration, for example one page view followed by clicks.

Entering visits and bounce visits

  • Entering visit: a visit with at least two page views, meaning at least two page.display events.

  • Bounce visit: a visit with fewer than two page views. For example, a visit with one page view and one click is a bounce. It still has a time spent, because it contains two events.

Time spent per visit metrics

Piano Analytics offers two metrics to measure time spent per visit.

  • Time spent / visits (m_time_spent_per_visits) is the average time spent during a visit, in milliseconds:

cumulative time spent / visits with duration

Cumulative time spent is the total time spent on the site, from the first event to the last event of each visit.

  • Time spent / visits (pages) (m_time_spent_per_visits_loads) only counts time between page views, in seconds:

cumulative time spent on pages / visits with at least one page with duration

Use it when you want to analyze time spent on the pages viewed only, for a given page or page level.

Neither metric is better than the other. Choose the one that fits how you want to measure time spent on your site.

Troubleshooting

  • Time spent / visits doesn't match a manual calculation: the metric divides by visits with duration, not by all visits. Use the value returned by Piano Analytics rather than recalculating it.

  • Time spent is 0 despite several actions: the visit may contain only one event, or its events happened within the same second. You may also be using a page-based metric on a visit with fewer than two page.display events.

  • Filtering gives unexpectedly low times: a filter limits time metrics to the matching events, not the whole visit. Use a segment instead to keep the full visit duration.

  • Offsite events show no time: events such as click.campaign.offsite aren't tied to a visit_id, so they don't count toward visit time.

  • Time spent is unexpectedly high: check for automatic events (auto-refresh, heartbeat, scroll tracking) or bot traffic that keep a visit going with continuous events.

To look at individual visits, use Data Query with the Visit ID property and a time metric.

Last updated: