How to build efficient desktop time tracker

During recent events in 2020, a lot of companies faced difficulties with a supervising their staff. Moving from regular office places to homes caused a lot of psychological, motivation and disciplinary issues that worsen the organization of working time. A well-working solution, proven by successful remote-work companies, is an introduction of a time-tracking software which workers should run on their PC. Such software should capture screenshots within some periods and measure activity level and then deliver these data for supervisors. There are a lot of such solutions on the market, but if you want to organize the most efficient workflows with the integrations to software applied in your company you might consider building your tracker application. Here at Devforth, we provide expertise in building such desktop applications. One of the products we have built is Tracklify. Tracklify combines a time-tracker integrated with Kanban tasks management board. In the post, we will share the secrets about the development of such tools.

Give a user a chance to delete a screenshot

Inform the user that your app just made a screenshot and show a confirmation box. If the user recognizes he was busted on doing non-work, let him delete a screenshot and do not include time from the last screenshot as a penalty. Tracklify, when does a screenshot, drops small approve window in the corner of the screen:

The window automatically disappears after 10 seconds with accepting a screenshot. User might want to close it faster by pressing Accept. If he wishes to drop the time he can click Reject.

Do screenshots at a random time

A lot of desktop time-trackers do screenshots at fixed periods - e.g. every 10 minutes. This allows workers to predict the time of the next screenshot and press Alt-Tab to return to work and may spend 8-9 minutes on the "rest". Just make impossible to guess the time of the next screenshot.

For example, distribute intervals between 0 and 20 minutes. The built-in random-generator gives uniform distribution, which in a long-term perspective will give 10 minutes average interval. Also, the well-working approach is to use normal distribution law for generating interval:

In plain words, this will generate more often intervals closer to 10 minutes and rarely closer to edges (0, 20 minutes). Use Box-Muller transform to convert the uniform distribution of native random function to normal distribution.

The more complex approach will increase probability basing on rarely used application processes. Using system API you can get the process name of an active window that the user works in. Store list of screenshots that the user accepted and if the user opens a new window - rapidly increase the probability of screenshot. If the user agreed - it will be persisted to list of "trusted" windows, otherwise, he will reject it and the same rule will catch him next time. This works very well when the user opens some messaging app.

Support offline

Persist screenshot and captured activity level in some storage on hard drive buffer and remove data from it only when the server will confirm that he accepted these data. The user might just lose the internet. Don't use RAM for storing it - the user might close tracker earlier then the connection will be recovered. To exclude Identifiers issues you might want to consider using UUIDs. Read more about why your software should use UUIDs

Use cross-platform technologies

We must admit that one of the best platforms for such an app in 2020 is Electron. It allows easily build an app for Windows, macOS and various Linux distributions.

Also, it brings the world of free, commercial-compatible NPM packages into your project which provides a cross-platform way to capture window titles, work with system tray, provide consistency in working with filesystem, and to collect activity level (keyboard and mouse events).

You can also use one of an awesome electron-builder and electron-packager tools to build installers signer with Code signing certificates which is required for such kind of software.

Use CI agents to quickly build versions of an app for different platforms

It is impossible to build perfect software from the first attempt. After receiving feedback you will have to improve or fix something. If you want to support more then one platform release process might become very tedious which will postpone delivering to the end-user. To improve it we recommend you create several virtual machines for each OS, e.g. using VirtualBox and install CI agents to each of them. Agents will be controlled from CI server which can trigger build by control version system hooks it will make your release process fast and easy so every user will be happy with fast fixes and updates.

Reach us and we will help you with developing a time-tracking application for your business!