enableLinkTracking in dynamic content

I have section where links are loading by angular framework based on response data, which consists of external url.

I don’t see outlinks are tracked, is this expected? Is there any workaround for this scenario

This is what i have in script to enable enableLinkTracking ,

_paq.push(['enableLinkTracking']);

I had the same problem now and found some possibilites to fix it. Handle an event that fires after the links are added and there

  • re-run enableLinkTracking
  • or add the new links using addListener, f.e.
$("#newelement a").each (function () {
    _paq.push (["addListener", this]);
});
  • or add click handlers to the links and use trackLink to build your own tracking mechanism.
1 Like

According to the manual your _paq variable is properly specified. Read

By default all links to domains other than the current domain have click tracking enabled, and each click will be counted as an outlink.

under Download and Outlink Tracking at https://developer.matomo.org/guides/tracking-javascript-guide. Have you placed the entry just after the first call to the trackPageView() method?

Of course, the term enabled could simply mean that you can do it, if you have properly set a listener. I like Daniel’s approach.

Roddy