The WakaTime plugin is open-source on GitHub.
Inside Visual Studio, navigate to
Extensions and Updates...
Onlinecategory at the left, then search for
Downloadbutton, then click
Enter your API key , then press enter.
Use Visual Studio like you normally do and your time will be tracked for you automatically.
Visit https://wakatime.com/ to see your logged time.