Tracking time spend by user

  • 1 February 2023
  • 1 reply

Hi Team,

Need to track time spend by user more than some minutes (2 mins) instead of getting average time spend i need to track about how many users spend more than 2 mins in particular event.

Urgent help needed.





Best answer by Denis Holmes 1 February 2023, 18:26

View original

1 reply

Userlevel 6
Badge +8

Hi @Mahima ,


You can use the user sessions chart to get some information about sessions across users. However, for specific event and screen tracking, Amplitude does not have a native way to do so but I can offer a solution.


Customers track time spent on their end and then pass in the duration as an event property to any page view type events. You could then segment and analyze by property metrics like property sum, property average, or property distribution in Event Segmentation.

To track duration, you would need to capture the timestamp of a start event and timestamp of an end event, calculate the difference between the two timestamps, and then pass in the duration as an event property for that end event. For example, let's say you have a start event = 'Viewed Home Page' and an end event = 'Clicked Signup'. When the user fires the 'Viewed Home Page' event, you can create a variable in your code called first_timestamp and pass in the current timestamp. When the user is going to fire the 'Clicked Signup' event, you would calculate the difference between the current timestamp and first_timestamp and pass that value into the 'duration' event property. You would then send the 'Clicked Signup' event with the 'duration' event property. This way, you can segment and filter on the value of the 'duration' event property for the 'Clicked Signup' event to see how long it took users to click that button after viewing your home page. I also recommend normalizing the 'duration' event property to a numerical value like seconds so that you can perform functions such as property average in the UI.


Here's a potential solution that you could look into to track that: