Track link title text

Hi there, I am struggling with a tracking issue for a slider. The slider click can consist of two parts: click on text layer and click on image itself.
The problem is: to combine the image click with the corresponding text click I use the title attribute via Google Tag Manager right now, because the title attribute is always the same for textlink and imagelink. There (in GTM), my link title attribute is defined as a custom variable.

Example:

<a href="https://mylink.com/some-url" title="**how to read this title attribute in a variable**" target="_top"><img src="something"></a>

How can I realize this in Matomo Tag Manager? In the preview mode I can not access the element depth I need. Sorry, this is my first time with Matomo Tag Manager :wink:
thx

You can try to create a JavaScript which is picking up the Title.
Something like this.

var title = document.getElementById('myLink').title;
var html = document.getElementById('myLink').innerHTML;

There are a bunch of other options.
But it depends on the website structure to crawl down the DOM I would say.

1 Like

Oh yes thx I will try that, good idea.