The WakaTime plugin works for TeXstudio and is open-source on GitHub.
Install the wakatime python command line tool.
Create a ~/.wakatime.cfg file with contents:
[settings]
api_key = XXXX
Replace XXXX with your actual API key
.
Run install.py
Mac and Linux
curl -fsSL https://raw.githubusercontent.com/wakatime/texstudio-wakatime/master/install.py | python
Windows
Download and extract texstudio-wakatime-master.zip, then double click install.py.
Use TeXstudio like you normally do and your time will be tracked for you automatically.
Visit https://wakatime.com/dashboard to see your logged time.