# Calculating Average Time Spent on site

The *Average Time on Site* is different for Hit and Visit segments. This is because of the sequence calculation.

## Description description

### Environment

- Customer Journey Analytics
- Analytics

### Issue/Symptoms

Sequence calculation logic when segments are involved to calculate Average Time Spent on Site.

## Resolution resolution

‘Average Time on Site’ metric show the amount of time spent between hits for a given dimension item. Average Time on Site is calculated based on (Total Seconds Spent/sequences). A *sequence* is where a dimension item is the same for one or more consecutive hits.

However, there will be some difference in the calculation of ‘Average Time on Site’ when segments based on Hit or Visit container are involved. This is because of sequence calculation.

- If a segment is based on Visit container, the Average time spent on site is calculated by adding the total time spent in the visit divided by total number of hits (Sequences) made in that visit.
- Whereas, if the segment is based on Hit container, the Average time spent on site is calculated by adding the total time spent during the hits defined in segment divided by valid hits (based on the condition specified in the segment) only.

**Example - Page vs Average Time spent on Site report**

Segment condition: Page equals A or B

Visit A Page Time Spent

Hit #1 A 5

Hit #2 B 11

Hit #3 C 2

Hit #4 D 2

Avg Time Spent on site (Visit segment) = (5+11+2+2)/4 = 5 seconds

Avg Time Spent on site (Hit segment) = (5+11)/2 = 8 seconds