Hi!
The idea sounds good. As long as every clickable link in the table of contents contains the same click class for example and matomo can extract the click class from the website, it should work just fine. You can check with the matomo debug mode, what data matomo collects when a certain element is clicked. You just have to right click the element when in debug mode and select “Data Layer”.
As you can see in my website matomo can’t extract much. So maybe you should test it first, if matomo really reads for example the click class.
But in case that already works for you, what exactly do you mean by “doesn’t do the job very well”? How would you like it more precise?