Skip to content

Commit

Permalink
Merge pull request matomo-org#20 from danielegobbetti/master
Browse files Browse the repository at this point in the history
overlay plugin works if tracker URL does not end with piwik.php
  • Loading branch information
Matthieu Aubry committed Feb 3, 2013
2 parents e978e98 + 0bb39d1 commit 33843b3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/piwik.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,10 @@ var
var referrer = documentAlias.referrer;
var testReferrer = configTrackerUrl;

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

// remove protocol
testReferrer.substring(testReferrer.substring(0, 7) === 'http://' ? 7 : 8, testReferrer.length);
Expand Down Expand Up @@ -950,7 +952,10 @@ var
*/
function injectOverlayScripts(configTrackerUrl, configTrackerSiteId) {
var windowNameParts = window.name.split('###');
var root = configTrackerUrl.substring(0, configTrackerUrl.length - 9); // remove piwik.php
var root = configTrackerUrl;
if(root.substr(-9) == "piwik.php") {
root = root.substring(0, root.length - 9); // remove piwik.php if present
}
var period = windowNameParts[1];
var date = windowNameParts[2];

Expand Down

0 comments on commit 33843b3

Please sign in to comment.