There are quite a few reasons for why you should be tracking the time you’ve spent on your projects, just read through one of the many websites that sell time tracking tools. If you are tech savvy, you might actually prefer having access to an easy to use and free API that allows you to do just that.
Existing Tracking Solutions
There’s a sufficient amount of tracking tools available, peak at this list to get an idea. There’s absolutely no reason to create another Android, BlackBerry, iOS or Web App with a beautiful UI and great UX.
However, there are quite a few people who don’t want any UI. People who refuse to interact with anything that’s not a computer terminal. Or, more generic, people who would forget to press a fancy button to start tracking their time at work anyway.
The open-source Tracking API provides easy to use endpoints for tracking whatever you want using web requests. Be it your office hours, your workouts or how many donuts you ate. You can check out this Postman Collection to fiddle with the available endpoints.
The Tracking API handles 3 different types:
- Users, representing the one who is using the API (e.g. you)
- Topics, representing whatever you want to track (e.g. a project)
- Actions, representing tracking events (e.g. starting to work)
So, let’s set up a demo:
Adding a User
To keep it simple, the API doesn’t require any form of authentication. You can create a user simply by calling the following URL:
This will create a user named “John Doe”. You can expect a response similar to this:
"name": "John Doe"
Adding a Topic
Just like the user, you can create a topic by calling:
Which will result in a new topic called “Click Count Demo”:
"name": "Click Count Demo"
Now that you’ve set up a demo user and topic, you can add actions. Notice that this time we not only specify a name parameter, but also the userId and topicId from the responses above:
Each time you call this URL, a new action will be added to the “Click Count Demo” from “John Doe”:
Open the Result tab in the JSfiddle below and click on the black button. You’ll see a new “Click ”event at the very left of the chart.
Of course firing a GET request to an API every time you want to track stuff isn’t something you want to do manually. You’d be better off using the awesome triggers that IFTTT provides.
If This Then That
IFTTT is a free service for Android, iOS and the web that lets you create so called Applets. The Applets have a Trigger (e.g. you connected to a WiFi network) and an Action (e.g. turn your phone silent). Triggers and Actions can be connected from many popular services (e.g. social networks, cloud storage providers, smart home devices, …).
Tracking Applet Triggers
What triggers you select is up to you and depends on your use case. Some examples are:
Tracking Applet Actions
To actually track anything, you need to fire a web request to the tracking API. This can easily be done using Maker.
Here are two Applets you can copy if you own an Android device:
- Start time tracking when you connect with the office WiFi
- Stop time tracking when you disconnect from the office WiFi
If you’re having any questions, feel free to get in touch!