Jquery .load page problem tracking clicks

Loading a bunch of outgoing links through jquery:

$("#divname").load("…/list-of-links.php",data);

But now it won’t track the clicks on these links anymore… I have the Piwik JS in the footer file.

How can I fix this?

I didn’t test it, but you can try to enable links tracking once again. E.g. via _paq.push(['enableLinkTracking']); or JavaScript API.

Thanks for your quick reply! I already have that one in my script. Always was… I think it has to do something with this:

https://forum.matomo.org/t/track-outgoing-links-from-content-loaded-via-ajax/9091/6

I meant executing this one once again after all links are loaded in the DOM. The solution linked by you looks like a hack. I’m not sure if that’s the only viable solution.

Ah, I understand. So I can just add _paq.push([‘enableLinkTracking’]); to my scripts?

$( document ).ready(function() {
call to blabla scripts;
_paq.push([‘enableLinkTracking’]);
};

@harmhero I’m not sure. For sure there’s a way to add listeners to all newly added links once again. Just just have to make sure that the links are there in the DOM before calling enableLinkTracking once again.