# Track time spent in application

**URL:** <https://community.appfarm.io/t/track-time-spent-in-application/973>\
**Category:** Ask the community\
**Created:** [January 12, 2024, 9:07am UTC](https://community.appfarm.io/t/track-time-spent-in-application/973 "2024-01-12T09:07:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/jonas/32/17_2.png) [@Jonas](https://community.appfarm.io/u/Jonas)\
**Post date:** [January 12, 2024, 9:07am UTC](https://community.appfarm.io/t/track-time-spent-in-application/973/1 "2024-01-12T09:07:40Z")

</div>

What is the best way to measure the user’s time spent in the application?

As I don´t know when a user closes the application, it seems like the best option I have is to run a timer to count usage as long as the user has the application open? Deactivating the counter using the newly created On Hidden/On Visible action?

I see that this will be very dependent on the On Hidden/On Visible actions, and on the page visibility API. Is there any way for me to see whether users have that active or not? Can I either see that directly, or indirectly through knowing which browser my users are using?

It would be great to have some kind of an “On App Closed” action or service, if that is even possible

Does anyone use any third-party analytics tool to measure this?

---

<div class="post-metadata">

**Author:** ![karlh](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/karlh/32/2567_2.png) [@karlh](https://community.appfarm.io/u/karlh)\
**Post date:** [January 12, 2024, 12:51pm UTC](https://community.appfarm.io/t/track-time-spent-in-application/973/2 "2024-01-12T12:51:06Z")

</div>

Hi there.  
There are 3rd party tools that could cover this, but an option is also the one you are mentioning: using on hidden/on visible to control a timer. The timer could be reset when "on visible is triggered and be saved to an object class dedicated to this purpose.  
The events “on hidden/on visible” would not trigger if the browser does not support it.
