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”.
My Matomo pulls more information, I guess this is good
I Found a Workaround now using the Anchor ID - I track all clicks where the Click Element contains #c (which means it links to an Anchor on the page. In my opinion that is not a very precise way to do it, as all Links to anchors will be tracked - and not only the ones in the table of contents.
I guess instead of event tracking I should use content tracking - but I just dont understand how to get that running. If you can help, I’d really appreciate: Einzelne Klicks innerhalb der Seite tracken
Do the sites with the table of contents have any matching url parts? Like for example /blog? Then you could filter the trigger so it only fires when the anchors on pages that contain “specific-url-part” are clicked.
Another possibility would be if you name your event category or event action after a variable so the names are dynamically filled with whereever the anchor was clicked or what the attributed click text was. This looks like this in the tag configuration:
If Matomo can read those variables on your website, you should get an event report that could look like this.
Maybe this would also be a solution for you problem. With that, you could track on which page which anchor link was clicked.
The good thing about having the page name as category is that all tags are then sorted under the URL and I get a very good understanding what happend on the specific page. I am not so much interested in knowing which events have been triggered in general but what happened on a specific page…However, the metrics I chose are still not perfect, but they are getting better
Still I feel that using Content Tracking would be better, but I dont know how to set it up