How can we calculate average time spent on a particular page by a user

  • 16 September 2020
  • 15 replies

I have an application where I am tracking the page view event...I am able to get the number of time the user visits the page but I also want to know how much time he/she spent on that page...


Best answer by Anthony Horta 3 February 2021, 01:41

View original

15 replies

Userlevel 6
Badge +3

@komalj —

In order to build a report to show. you the time a user has spent on a page, you can use our session event. The default duration is 30 minutes, but you can adjust the time as shown here. 


There is a great example of how to build this event in this community post


Let me know if that points you in the right direction!


Hi @cherise - I looked at that community post and do not see the answer to the question.

This article is similar, but the answer doesn’t fully make sense: 

We want to track the average time users spend on a particular page in our app. It seems so simple, but I’m having trouble creating the report or finding the answer. Thank you for your help in advance!


@cherise here are two examples of how I tried to simply capture the average time users are spending on a particular page, but neither seem right





Badge +1

This seems like a pretty basic requirement - is there an official answer as how to achieve this?


@Crawfish  nope not yet… @cherise can you please advise?

This seems like a pretty basic requirement - is there an official answer as how to achieve this?

Also very much interested in the best approach 


@cherise can you please help us out? Thanks

This took me longer than it should have to figure out. Within Funnels you can change the setting at right hand side below the Breakdowns section to “Time to convert” and then adjust the “Interval size” accordingly. In my case I set the interval size to 30sec and max 1800.



Cool! @Anthony Horta - what did you do to set the filter per the specific page the users are on?

@kirkn I used a very simple two step funnel. Step one, the page I wanted to see the lapsed time on and step two, the conversion event. So mine was on payment page → signed up. 


That’s a nice use case @Anthony Horta 

In the above example though, I’m just trying to simply see how long on average users spend on a certain page. There is no conversion data here, it is essentially reading / scrolling on this page and then they may exit to another page by navigating from the bottom nav menu.

@kirkn hmm.I think you can try…. first event would be “on page (not sure the actual event would be for you)” and then the next step would “exit event”, OR a custom event, that includes all the possible next steps a user may take from that page. So you may create a custom event that captures all the possibilities such as, “exit”, “ClickedNext”, “LoggedOut”, and so on as your secondary step in the funnel. This would then allow you to see how long a person spent on the page before leaving.   

Badge +1

I’ve added a feature request, so I suggest voting it up if you want Mixpanel to consider adding it:



@Anthony Horta Thanks very much for suggesting Funnels for this! It’s taken me closer to what I need than any other approach. For the benefit of other people reading this, a couple of observations:

1. Mixpanel’s ‘Session End’ virtual event can’t be added to a Custom Event

2. Any two-step funnel with ‘Session End’ as the second step (and intermediary steps excluded) seems to have a conversion time of zero seconds

So you can see how long users spend on a page before doing something else, but not how long they spend on the page if the session ends without further events.

I want export the following data using API in postman,

API used:["TimeSpentOnApp"]

Can anyone tell me how to add the other query parameters