I solved this by using the tracking pixel inside our iframe:
(function() {
var d=document,
i=d.createElement("img"),
b=d.getElementsByTagName("body")[0],
r=d.referrer,
u="https://mysite.piwikpro.com/piwik.php?idsite=#{ENV['PIWIK_SITE_ID']}&rec=1&url=#{video_url(@project)}&urlref=";
i.src=u+r;
b.appendChild(i);
})();
I'm using JS to append the img tag to the body, so that I can set the urlref param to document.referrer
. Now I am able to track which sites my iframe is being viewed on the most. Works fine.