Tracking Javascripts


(status4) #1

Hello. I want to track javascripts (widgets which get included in several websites).

At the moment I am using this snippet in the widgets:

var script = document.createElement("script");
script.setAttribute("language","JavaScript");
script.setAttribute("src","www.example.org/piwik.js");
document.body.appendChild(script);
try {
  var piwikTracker = Piwik.getTracker("www.example.org/piwik.php", 1);
  piwikTracker.setDocumentTitle(document.location);
  piwikTracker.trackPageView();
} 
catch (err) {}

As you can see this uses piwik.js, but that´s a bad idea because of the file size.
Is it possible to use a tracking pixel or anything else in this situation?

Thanks a lot.


(Matthieu Aubry) #2

You can, but it’s not currently documented… there is a ticket: http://dev.piwik.org/trac/ticket/653


(status4) #3

Thanks, I have a look at it.