Time devotion to coding

I have noticed that while i am working through fcc curriculum or learning coding i spent large amount of time on reading forums and randomly googling for other things on internet .Some where i get stuck like i am unable to install any particular software or i am trapped in some other problem i spent time on internet .The problem is that i am unable to take account of my learning speed and my work is not as productive as i want it to be .Hence i want to manage it very well and wanted to take account of how much time i spent on actual learning and on some thing else .I know that best thing is to solve your problem by own but i thought i am giving more time to it .I need advise in this case .Is there any desktop appliocation which will take account of time given to specific task .

I use Toggl for time tracking. You need to manually start and end tasks, but it turns into a habit after some time.