diff options
author | Daniele Gobbetti <d.gobbetti@peer.biz> | 2013-02-01 19:40:26 +0400 |
---|---|---|
committer | Daniele Gobbetti <d.gobbetti@peer.biz> | 2013-02-01 19:40:26 +0400 |
commit | 0bb39d1ab8219885b3b58f7a55b8831e720180d1 (patch) | |
tree | 4f9c2b3734f9a330a0902a67fe54ef58b12c0fdc /js | |
parent | 7aa7595ba5e3608d38292db7f2e03b5549494f24 (diff) |
added conditional checks
This solves:
http://forum.piwik.org/read.php?2,100257
Two conditional checks were added in order to remove
"piwik.php" at the end of the called script only if present.
Diffstat (limited to 'js')
-rw-r--r-- | js/piwik.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/js/piwik.js b/js/piwik.js index 302e5463d8..ce59415758 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -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); @@ -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]; |