I know corsair iQue has a heatmap if you have a corsair device. Saw it in there when I was setting up my mouse. I don’t have a corsair keyboard so your mileage may vary. Some other keyboard software’s may do this too. I’m not sure.
I’m unfamiliar with how keyloggers work, however from a programming perspective (if you use an open source keylogger or write your own), it would be possible to modify the program. A solution that comes to mind right away is to make an array of integers with each entry in the array corresponding to a key. when a key is pressed, add 1, then when you finish your session have the program write that array out to a csv or text file to make your analytics.
I’m unsure on logging of keyboard shortcuts. Happy music making!