A million years ago I used this https://github.com/rburgst/time-tracker-mac. But it hasn't really been updated in long time https://code.google.com/archive/p/time-tracker-mac/downloads.
I haven't tried this one, but Tyme looks promising http://tyme-app.com/mac-2/. It seems it's a standalone app and has a 15 day trial, so you can test it out for a while. It's also only $18, so it's quite affordable.