There are a lot of tools in that space, if you can bear the privacy implications. The one I used in the past was RescueTime (https://www.rescuetime.com/).
I'm currently using Timing.app. The only complaint (aside from some apps not being properly supported) I have is that there's no way to track across machines. I'm currently exporting and merging the data which is probably the best solution anyway.