Track Clicks on table of contents on various pages

Hi there,

I am very new to the MTM - so please excuse my missing knowledge :slight_smile:

On several pages I have a table of contents. I want to create a tag that meassures if they are actually clicked.

How can I set this up so that it meassures all clicks on all tables of content on all pages?

As for now I only have an idea - but that doesnt do the job very well:

I create a trigger that fires when click class contains “internal-link” and when visible elements text contains “table of content”.

Can anyone suggest a more precise way please?

Thanks a lot in advance
Cheers
RuSo

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?

Hi Florian,

thanks for your reply and your ideas.

My Matomo pulls more information, I guess this is good :slight_smile:

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

Thanks a lot
Cheesr
RuSo

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:
image

If Matomo can read those variables on your website, you should get an event report that could look like this.

image

Maybe this would also be a solution for you problem. With that, you could track on which page which anchor link was clicked.

HĂ­ Florian,

thanks for the tip. I track it like this and I am ok with this now.

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 :slight_smile:

Here is how my event tracking looks like:

Best
RuSo

Hi @Ruso,
Content tracking is used to track if some content has been displayed, and if so, if a user interacted with it…
→ See:

If you want to track such content, you can refer these doc: