Piwik overlay and custom referer

Hello all,

I noticed that the overlay plugin does not work if the trackerUrl variable doesn’t end with “piwik.php”. Since I configured the webserver to use piwik.php as index for the path, I don’t have piwik.php in any tracking code.

I traced back this behavior to line 914 of piwik.js (non-minified):

 913                         // remove piwik.php from referrer
 914                         testReferrer = testReferrer.substring(0, testReferrer.length - 9);

Which I think may be changed with :

913                        // remove piwik.php from referrer if present
914                      if(testReferrer.substr(-9) == "piwik.php") testReferrer = testReferrer.substring(0, testReferrer.length - 9);

Then also row 954 has to be changed accordingly from:

953                        var root = configTrackerUrl.substring(0, configTrackerUrl.length - 9); // remove piwik.php


 953                         var root = configTrackerUrl;
 954                         if(root.substr(-9) == "piwik.php")  root =  root.substring(0,  root.length - 9);  // remove piwik.php if present

Or something among these lines.
What do you think?

I created a pull request on github:

Hope this helps.