Track outgoing Links from content loaded via AJAX


#1

Hi. I am a new user and found something which might be a problem in Piwik. On my website I load some content after the page itself was loaded. That content contains HTML and links to several different outgoing (i.e. other domains) links. However, none of them were tracked. Tracking outgoing links which were not loaded with AJAX work fine.

Is this problem known alread? Any solution?

If there is no such feature right now, I would happily suggest it.


#2

Any ideas?


(Fabian Becker) #3

Can you maybe create a simple demonstration for that (e.g. using jsfiddle)? I can look into that issue then.


#4

Thanks for your answer. You could have a look at my real site which is very basic as can be seen here: http://buchsuch.ch/buch/preisvergleich/9783486704532/

The page makes an AJAX request using jQuery and replaces the content of a div element with the result of the request using $(“div#priceComparison” ).html(result). The result variable contains actual HTML (I know, not very clean). All the links in “result” won’t trigger any statistics in Piwik whereas normal links (e.g. at the start page) can be observed with Piwik.


#5

I met the same problem, can anyone help?


#6

This does still not work in 2.0.2. Any updates? Is this a planned feature or does a feature request exist that I can follow?


#7

You can always attach a click even on your updated content:


$.get('/whatever',function(data){
  // render your html content here
  $('a.my-fresh-links').click(function(){
      _paq.push(["trackLink",$(this).attr('href'),'link']);
    });
});

Bear in mind the URL argument should be FULL URL, not relative.