Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-03-11 09:53:54 +0400
committermattab <matthieu.aubry@gmail.com>2013-03-11 09:53:54 +0400
commitdc18d7b1bc6fed2716893cf1ac69c3a18fa34897 (patch)
tree7e76e4fbeae682a5160466e6bbde8f51b00eee43 /js
parent0775c8c9c04198ca38f080f11e16331fbc2703a0 (diff)
refs #3747 refactoring logic
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js24
1 files changed, 11 insertions, 13 deletions
diff --git a/js/piwik.js b/js/piwik.js
index d330d12a33..971bd7b600 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -954,6 +954,13 @@ var
* Page Overlay
************************************************************/
+ function getTrackerUrlForOverlay(trackerUrl) {
+ if (trackerUrl.slice(-9) === 'piwik.php') {
+ trackerUrl = trackerUrl.slice(0, trackerUrl.length - 9);
+ }
+ return trackerUrl;
+ }
+
/*
* Check whether this is a page overlay session
*
@@ -964,12 +971,7 @@ var
function isOverlaySession(configTrackerUrl, configTrackerSiteId) {
var windowName = 'Piwik_Overlay',
referrer = documentAlias.referrer,
- testReferrer = configTrackerUrl;
-
- // remove piwik.php from referrer if present
- if (testReferrer.slice(-9) === 'piwik.php') {
- testReferrer = testReferrer.slice(0, testReferrer.length - 9);
- }
+ testReferrer = getTrackerUrlForOverlay(configTrackerUrl);
// remove protocol
testReferrer.slice(testReferrer.slice(0, 7) === 'http://' ? 7 : 8, testReferrer.length);
@@ -1015,16 +1017,12 @@ var
var windowNameParts = windowAlias.name.split('###'),
period = windowNameParts[1],
date = windowNameParts[2],
- root = configTrackerUrl;
-
- if (root.slice(-9) === 'piwik.php') {
- root = root.slice(0, root.length - 9); // remove piwik.php if present
- }
+ trackerUrl = getTrackerUrlForOverlay(configTrackerUrl);
loadScript(
- root + 'plugins/Overlay/client/client.js?v=1',
+ trackerUrl + 'plugins/Overlay/client/client.js?v=1',
function () {
- Piwik_Overlay_Client.initialize(root, configTrackerSiteId, period, date);
+ Piwik_Overlay_Client.initialize(trackerUrl, configTrackerSiteId, period, date);
}
);
}