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