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
diff options
context:
space:
mode:
authorBeezyT <timo@ezdesign.de>2012-11-08 15:02:14 +0400
committerBeezyT <timo@ezdesign.de>2012-11-08 15:02:14 +0400
commit8a0fcbb4d1eb47a6634a9fd1cd0c351242454a25 (patch)
tree8573029d931af86c8853be21f39ff572f471050e
parentbe0df1214bd5808e23e3f39abe5687e26876ce4a (diff)
refs #2465 Insight
* links to the current url get a bubble as well * limit for the number of pages loaded from the API can be configured * ready for translation * url normalizer doesn't remove the hash part anymore (which corresponds to the latest behavior of the tracker) git-svn-id: http://dev.piwik.org/svn/trunk@7405 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r--config/global.ini.php4
-rw-r--r--lang/en.php6
-rw-r--r--plugins/Insight/API.php11
-rw-r--r--plugins/Insight/client/followingpages.js24
-rw-r--r--plugins/Insight/client/urlnormalizer.js7
-rw-r--r--plugins/Transitions/API.php8
-rw-r--r--plugins/Transitions/Transitions.php11
7 files changed, 45 insertions, 26 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index f5caf0c816..697b918407 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -311,6 +311,10 @@ api_service_url = http://api.piwik.org
; eg. $period=range&date=previous10 becomes $period=day&date=previous10. Use this setting to override the $period value.
graphs_default_period_to_plot_when_period_range = day
+; The Insight plugin shows the Top X following pages, Top X downloads and Top X outlinks which followed
+; a view of the current page. The value X can be set here.
+insight_limit = 300
+
[Tracker]
; Piwik uses first party cookies by default. If set to 1,
; the visit ID cookie will be set on the Piwik server domain as well
diff --git a/lang/en.php b/lang/en.php
index 04c8318f12..558b87b6ef 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -1809,5 +1809,9 @@ And thank you for using Piwik!',
'Insight_MainMetrics' => 'Main metrics',
'Insight_NoData' => 'There is no data for this page during the selected period.',
'Insight_OpenFullScreen' => 'Go full screen',
- 'Insight_CloseFullScreen' => 'Close full screen'
+ 'Insight_CloseFullScreen' => 'Close full screen',
+ 'Insight_OneClick' => '1 click',
+ 'Insight_Clicks' => '%s clicks',
+ 'Insight_ClicksFromXLinks' => '%1$s clicks from one of %2$s links',
+ 'Insight_Link' => 'Link'
);
diff --git a/plugins/Insight/API.php b/plugins/Insight/API.php
index 1c904a2516..eb2c9eb5d7 100644
--- a/plugins/Insight/API.php
+++ b/plugins/Insight/API.php
@@ -35,7 +35,12 @@ class Piwik_Insight_API
{
$this->authenticate($idSite);
- $translations = array();
+ $translations = array(
+ 'oneClick' => 'Insight_OneClick',
+ 'clicks' => 'Insight_Clicks',
+ 'clicksFromXLinks' => 'Insight_ClicksFromXLinks',
+ 'link' => 'Insight_Link'
+ );
return array_map('Piwik_Translate', $translations);
}
@@ -66,9 +71,9 @@ class Piwik_Insight_API
try
{
- // TODO find a good value for $limitBeforeGrouping - add config option?
+ $limitBeforeGrouping = Piwik_Config::getInstance()->General['insight_limit'];
$transitionsReport = Piwik_Transitions_API::getInstance()->getTransitionsForAction(
- $url, $type = 'url', $idSite, $period, $date, $segment, $limitBeforeGrouping = 100,
+ $url, $type = 'url', $idSite, $period, $date, $segment, $limitBeforeGrouping,
$part = 'followingActions', $returnNormalizedUrls = true);
}
catch(Exception $e)
diff --git a/plugins/Insight/client/followingpages.js b/plugins/Insight/client/followingpages.js
index d85d985f07..5373bf274b 100644
--- a/plugins/Insight/client/followingpages.js
+++ b/plugins/Insight/client/followingpages.js
@@ -57,8 +57,8 @@ var Piwik_Insight_FollowingPages = (function() {
var totalClicks = 0;
for (var i = 0; i < followingPages.length; i++) {
var page = followingPages[i];
- // downloads and outlinks still have the prefix
- // TODO investigate whether it would be better to use Piwik_Insight_UrlNormalizer.normalize
+ // though the following pages are returned without the prefix, downloads
+ // and outlinks still have it.
page.label = Piwik_Insight_UrlNormalizer.removeUrlPrefix(page.label);
totalClicks += followingPages[i].referrals;
}
@@ -223,14 +223,20 @@ var Piwik_Insight_FollowingPages = (function() {
highlightElements[1].height(height + 4).css({top: offset.top - 2, left: offset.left + width}).show();
highlightElements[2].height(height + 4).css({top: offset.top - 2, left: offset.left - 2}).show();
- var padding = '&nbsp;&nbsp;';
- // TODO translate
- var text = data.referrals + ' clicks';
var numLinks = linksOnPage[linkUrl].length;
+ var text;
if (numLinks > 1) {
- text += ' from ' + numLinks + ' links';
+ text = Piwik_Insight_Translations.get('clicksFromXLinks')
+ .replace(/%1\$s/, data.referrals)
+ .replace(/%2\$s/, numLinks);
+ } else if (data.referrals == 1) {
+ text = Piwik_Insight_Translations.get('oneClick');
+ } else {
+ text = Piwik_Insight_Translations.get('clicks')
+ .replace(/%s/, data.referrals);
}
-
+
+ var padding = '&nbsp;&nbsp;';
highlightElements[3].html(padding + text + padding).css({
minWidth: (width + 4) + 'px',
top: offset.top + height,
@@ -243,8 +249,8 @@ var Piwik_Insight_FollowingPages = (function() {
tag.data('piwik-highlighted', true);
}
- // TODO translate
- linkTag.data('piwik-hideNotification', Piwik_Insight_Client.notification('Link: ' + linkUrl));
+ linkTag.data('piwik-hideNotification', Piwik_Insight_Client.notification(
+ Piwik_Insight_Translations.get('link') + ': ' + linkUrl));
}
/** Remove highlight from link */
diff --git a/plugins/Insight/client/urlnormalizer.js b/plugins/Insight/client/urlnormalizer.js
index 01904eafa4..fcdf386c63 100644
--- a/plugins/Insight/client/urlnormalizer.js
+++ b/plugins/Insight/client/urlnormalizer.js
@@ -162,12 +162,6 @@ var Piwik_Insight_UrlNormalizer = (function() {
}
}
- // remove #...
- var pos;
- if ((pos = url.indexOf('#')) != -1) {
- url = url.substring(0, pos);
- }
-
// replace multiple / with a single /
url = url.replace(/\/\/+/g, '/');
@@ -194,6 +188,7 @@ var Piwik_Insight_UrlNormalizer = (function() {
url = url.replace(regEx, '');
}
url = url.replace(/\?&/, '?');
+ url = url.replace(/\?#/, '#');
url = url.replace(/\?$/, '');
return url;
diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php
index 1810cf5b17..4d1a0aea8b 100644
--- a/plugins/Transitions/API.php
+++ b/plugins/Transitions/API.php
@@ -92,8 +92,9 @@ class Piwik_Transitions_API
}
if ($parts == 'all' || in_array('followingActions', $partsArray))
{
+ $includeLoops = $parts != 'all' && !in_array('internalReferrers', $partsArray);
$this->addFollowingActions($transitionsArchiving, $archiveProcessing, $report, $idaction,
- $actionType, $limitBeforeGrouping);
+ $actionType, $limitBeforeGrouping, $includeLoops);
}
if ($parts == 'all' || in_array('externalReferrers', $partsArray))
{
@@ -205,12 +206,13 @@ class Piwik_Transitions_API
* @param $idaction
* @param string $actionType
* @param $limitBeforeGrouping
+ * @param boolean $includeLoops
*/
private function addFollowingActions($transitionsArchiving, $archiveProcessing, &$report,
- $idaction, $actionType, $limitBeforeGrouping) {
+ $idaction, $actionType, $limitBeforeGrouping, $includeLoops=false) {
$data = $transitionsArchiving->queryFollowingActions(
- $idaction, $actionType, $archiveProcessing, $limitBeforeGrouping);
+ $idaction, $actionType, $archiveProcessing, $limitBeforeGrouping, $includeLoops);
foreach ($data as $tableName => $table)
{
diff --git a/plugins/Transitions/Transitions.php b/plugins/Transitions/Transitions.php
index 6a2e6cc1cd..6b7cea5349 100644
--- a/plugins/Transitions/Transitions.php
+++ b/plugins/Transitions/Transitions.php
@@ -285,10 +285,11 @@ class Piwik_Transitions extends Piwik_Plugin
* @param $actionType
* @param Piwik_ArchiveProcessing_Day $archiveProcessing
* @param $limitBeforeGrouping
+ * @param $includeLoops
* @return array(followingPages:Piwik_DataTable, outlinks:Piwik_DataTable, downloads:Piwik_DataTable)
*/
public function queryFollowingActions($idaction, $actionType, Piwik_ArchiveProcessing_Day $archiveProcessing,
- $limitBeforeGrouping = false)
+ $limitBeforeGrouping = false, $includeLoops = false)
{
$types = array();
@@ -348,9 +349,11 @@ class Piwik_Transitions extends Piwik_Plugin
$rankingQuery->partitionResultIntoMultipleGroups('type', array_keys($types));
$type = $this->getColumnTypeSuffix($actionType);
- $where = 'log_link_visit_action.idaction_'.$type.'_ref = '.intval($idaction).' AND '
- . '(log_link_visit_action.idaction_'.$type.' IS NULL OR '
- . 'log_link_visit_action.idaction_'.$type.' != '.intval($idaction).')';
+ $where = 'log_link_visit_action.idaction_'.$type.'_ref = '.intval($idaction);
+ if (!$includeLoops) {
+ $where .= ' AND (log_link_visit_action.idaction_'.$type.' IS NULL OR '
+ . 'log_link_visit_action.idaction_'.$type.' != '.intval($idaction).')';
+ }
$orderBy = '`'.Piwik_Archive::INDEX_NB_ACTIONS.'` DESC';