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:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-03-25 07:24:48 +0300
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-03-25 07:24:48 +0300
commit44e29c487fb8b127b1b174b834e233769508dfe0 (patch)
tree6a1ed30f546977e8bd827e42b438808a5d97cb46
parent64b0df6d2dd13fe6568e4acbcc83402e43f7e0fb (diff)
- cleaned up the Tracker/Action code, added tests, as well as cleaning up Actions archiving code
- now displaying all columns that user setColumnsToDisplay even if there are no values set - displaying custom column names for downloads and outlinks tables - enabled sort on download and outlinks - it's now possible to sort a table by a column that is not defined. It will not error but just not do anything. - fixed #393 Remove unique visitors from report for a given category of actions - fixed #158 outlinks without subpages when there are outlinks with the same domain and subpages should be grouped in the same row - fixed #535 Add "export" icons below the "Actions" reports (pages, download, outlinks) - fixed #579 API Actions: full_url and url is 0 - REMOVED feature of naming an outlink or a download with a custom name. All downloads and outlinks are now grouped by the URL host. The data will be consistent across all periods independantly of the data set. Only data processed from this version will be affected. - API CHANGE renamed entry_nb_unique_visitor in entry_nb_uniq_visitors and renamed exit_nb_unique_visitor in exit_nb_uniq_visitors in the Actions.getActions API call - FEATURE outlink won't count clicks on URLs where the hostname is one of the registered hostname for this website (see Settings > Websites) - FEATURE you can use Piwik to count clicks on links and count downloads, without using the automatic Javascript based download/outlinks tracking, but by modifying links to go through piwik.php. For example, http://yourwebsite.org/piwik/piwik.php?idsite=1&link=http://example.org&redirect=1 will count the outlink in piwik and redirect the user to http://example.org For example, http://yourwebsite.org/piwik/piwik.php?idsite=1&download=http://yourwebsite.org/download.pdf&redirect=1 will count the download in piwik and redirect the user to http://yourwebsite.org/download.pdf NOTE: it is recommended to rely on the automatic outlink and download tracking (more information on http://piwik.org/docs/javascript-tracking/). rather than adding a depending on Piwik for your website to function properly. However this feature is useful to some users as it gives a simple and reliable way of counting clicks, that you can then query using the Piwik API.
-rwxr-xr-xconfig/global.ini.php59
-rw-r--r--core/ArchiveProcessing/Day.php2
-rw-r--r--core/Common.php4
-rw-r--r--core/DataTable/Filter/Sort.php63
-rw-r--r--core/DataTable/Row.php8
-rw-r--r--core/Tracker.php17
-rw-r--r--core/Tracker/Action.php227
-rw-r--r--core/Tracker/Generator.php10
-rw-r--r--core/Tracker/GoalManager.php4
-rw-r--r--core/Tracker/Visit.php122
-rw-r--r--core/ViewDataTable.php10
-rw-r--r--core/ViewDataTable/HtmlTable.php15
-rw-r--r--lang/en.php4
-rw-r--r--plugins/Actions/API.php23
-rw-r--r--plugins/Actions/Actions.php101
-rw-r--r--plugins/Actions/Controller.php137
-rw-r--r--plugins/CoreHome/templates/datatable.css2
-rw-r--r--plugins/CoreHome/templates/datatable.js6
-rw-r--r--plugins/CoreHome/templates/datatable.tpl3
-rw-r--r--plugins/CoreHome/templates/datatable_actions.tpl3
-rw-r--r--plugins/CoreHome/templates/datatable_actions_recursive.tpl3
-rw-r--r--plugins/CoreHome/templates/datatable_actions_subdatable.tpl3
-rw-r--r--plugins/CoreHome/templates/datatable_footer.tpl8
-rw-r--r--plugins/Referers/Referers.php5
-rw-r--r--tests/core/ArchiveProcessing/Day.test.php52
-rwxr-xr-xtests/core/Common.test.php2
-rw-r--r--tests/core/Tracker/Action.test.php102
-rw-r--r--tests/resources/Tracker/Action.config.ini.php5
28 files changed, 531 insertions, 469 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index 865fa2ff46..1005ba5788 100755
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -129,32 +129,6 @@ visit_standard_length = 1800
; visitors that stay on the website and view only one page will be considered staying 10 seconds
default_time_one_page_visit = 10
-; variable name used to specify a download link
-; Example: '/piwik.php?idsite=1&download=http://piwik.org/piwik.zip' will redirect to 'http://piwik.org/piwik.zip'
-download_url_var_name = download
-
-; variable name used to specify a link to an external website
-; Example: '/piwik.php?idsite=1&link=http://piwik.org/' will redirect to 'http://piwik.org/'
-outlink_url_var_name = link
-
-; variable that contains the name of the download or the outlink to redirect to
-; Example: '/piwik.php?idsite=1&download=http://piwik.org/piwik.zip&name=Piwik last version'
-download_outlink_name_var = name
-
-; variable name to track any campaign, for example CPC campaign
-; Example: If a visitor first visits 'index.php?piwik_campaign=Adwords-CPC' then it will be counted as a campaign referer named 'Adwords-CPC'
-campaign_var_name = piwik_campaign
-
-; variable name to track any campaign keyword
-; Example: If a visitor first visits 'index.php?piwik_campaign=Adwords-CPC&piwik_kwd=My killer keyword' then it will be counted as a campaign referer named 'Adwords-CPC' with the keyword 'My killer keyword'
-campaign_keyword_var_name = piwik_kwd
-
-; name of the cookie used to store the visitor information
-cookie_name = piwik_visitor
-
-; by default, the Piwik tracking cookie expires in 2 years
-cookie_expire = 63072000
-
; if set to false, any goal conversion will be credited to the last more recent non empty referer.
; when set to true, the first ever referer used to reach the website will be used
use_first_referer_to_determine_goal_referer = false
@@ -170,6 +144,39 @@ enable_detect_unique_visitor_using_settings = true
; The mapping is defined in core/DataFiles/LanguageToCountry.php,
enable_language_to_country_guess = true
+; name of the cookie used to store the visitor information
+cookie_name = piwik_visitor
+
+; by default, the Piwik tracking cookie expires in 2 years
+cookie_expire = 63072000
+
+; variable name to track any campaign, for example CPC campaign
+; Example: If a visitor first visits 'index.php?piwik_campaign=Adwords-CPC' then it will be counted as a campaign referer named 'Adwords-CPC'
+campaign_var_name = piwik_campaign
+
+; variable name to track any campaign keyword
+; Example: If a visitor first visits 'index.php?piwik_campaign=Adwords-CPC&piwik_kwd=My killer keyword' then it will be counted as a campaign referer named 'Adwords-CPC' with the keyword 'My killer keyword'
+campaign_keyword_var_name = piwik_kwd
+
+; variable name used to specify a download link
+; Example: '/piwik.php?idsite=1&download=http://piwik.org/piwik.zip' will redirect to 'http://piwik.org/piwik.zip'
+download_url_var_name = download
+
+; variable name used to specify a link to an external website
+; Example: '/piwik.php?idsite=1&link=http://piwik.org/' will redirect to 'http://piwik.org/'
+outlink_url_var_name = link
+
+; variable name used to specify that the user should be redirected to the clicked linked, or the downloaded file
+; eg. http://yourwebsite.org/piwik/piwik.php?idsite=1&link=http://example.org&redirect=1
+; will count the outlink in piwik and redirect the user to http://example.org
+; eg. http://yourwebsite.org/piwik/piwik.php?idsite=1&download=http://yourwebsite.org/download.pdf&redirect=1
+; will count the download in piwik and redirect the user to http://yourwebsite.org/download.pdf
+; NOTE: it is recommended to rely on the automatic outlink and download tracking (more information on http://piwik.org/docs/javascript-tracking/).
+; rather than adding a depending on Piwik for your website to function properly.
+; However this feature is useful to some users as it gives a simple and reliable way of counting clicks, that you can then query using the Piwik API.
+outlink_redirect_var_name = redirect
+download_redirect_var_name = redirect
+
[log]
;possible values for log: screen, database, file
diff --git a/core/ArchiveProcessing/Day.php b/core/ArchiveProcessing/Day.php
index 995fac0e59..77558a3f34 100644
--- a/core/ArchiveProcessing/Day.php
+++ b/core/ArchiveProcessing/Day.php
@@ -218,7 +218,6 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing
static public function generateDataTable( $table )
{
$dataTableToReturn = new Piwik_DataTable;
-
foreach($table as $label => $maybeDatatableRow)
{
// case the aInfo is a subtable-like array
@@ -240,7 +239,6 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing
$dataTableToReturn->addRow($row);
}
-
return $dataTableToReturn;
}
diff --git a/core/Common.php b/core/Common.php
index 4ef4a183c9..4d3b38815f 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -156,19 +156,15 @@ class Piwik_Common
static function getPathAndQueryFromUrl($url)
{
$parsedUrl = parse_url( $url );
-
$result = '';
-
if(isset($parsedUrl['path']))
{
$result .= substr($parsedUrl['path'], 1);
}
-
if(isset($parsedUrl['query']))
{
$result .= '?'.$parsedUrl['query'];
}
-
return $result;
}
diff --git a/core/DataTable/Filter/Sort.php b/core/DataTable/Filter/Sort.php
index 148bb5b6e1..cc15213095 100644
--- a/core/DataTable/Filter/Sort.php
+++ b/core/DataTable/Filter/Sort.php
@@ -45,28 +45,25 @@ class Piwik_DataTable_Filter_Sort extends Piwik_DataTable_Filter
function sort($a, $b)
{
- return
- (
- (!isset($a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
- && !isset($b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
- )
- ? 0
- : (
- !isset($a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
- ? 1
- :(
- !isset($b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
- ? -1
- : $this->sign * (
- $a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort]
- < $b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort]
- ? -1
- : 1
- )
+ return (!isset($a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
+ && !isset($b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
+ )
+ ? 0
+ : (
+ !isset($a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
+ ? 1
+ :(
+ !isset($b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
+ ? -1
+ : $this->sign * (
+ $a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort]
+ < $b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort]
+ ? -1
+ : 1
)
)
)
- ;
+ ;
}
function naturalSort($a, $b)
@@ -79,10 +76,20 @@ class Piwik_DataTable_Filter_Sort extends Piwik_DataTable_Filter
function sortString($a, $b)
{
- return $this->sign *
- strcasecmp($a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort],
- $b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort]
- );
+ return !isset($a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
+ && !isset($b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort] )
+ ? 0
+ : (!isset($a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort])
+ ? 1
+ : (!isset($b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort] )
+ ? -1
+ : $this->sign *
+ strcasecmp($a->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort],
+ $b->c[Piwik_DataTable_Row::COLUMNS][$this->columnToSort]
+ )
+ )
+ )
+ ;
}
/**
@@ -117,8 +124,11 @@ class Piwik_DataTable_Filter_Sort extends Piwik_DataTable_Filter
return $column;
}
- return false;
+ // even though this column is not set properly in the table,
+ // we select it for the sort, so that the table's internal state is set properly
+ return $this->columnToSort;
}
+
protected function filter()
{
if($this->table instanceof Piwik_DataTable_Simple)
@@ -133,11 +143,6 @@ class Piwik_DataTable_Filter_Sort extends Piwik_DataTable_Filter
$row = current($rows);
$this->columnToSort = $this->selectColumnToSort($row);
- if($this->columnToSort === false)
- {
- return;
- }
-
$value = $row->getColumn($this->columnToSort);
if( Piwik::isNumeric($value))
{
diff --git a/core/DataTable/Row.php b/core/DataTable/Row.php
index abc6aea288..20d46c9a50 100644
--- a/core/DataTable/Row.php
+++ b/core/DataTable/Row.php
@@ -331,7 +331,13 @@ class Piwik_DataTable_Row
{
foreach($rowToSum->getColumns() as $columnToSumName => $columnToSumValue)
{
- if($columnToSumName != 'label')
+ //TODO this should not be hardcoded here.
+ if($columnToSumName != 'label'
+ && $columnToSumName != 'nb_uniq_visitors'
+ && $columnToSumName != 'entry_nb_uniq_visitors'
+ && $columnToSumName != 'exit_nb_uniq_visitors'
+
+ )
{
$thisColumnValue = $this->getColumn($columnToSumName);
$newValue = $this->sumRowArray($thisColumnValue, $columnToSumValue);
diff --git a/core/Tracker.php b/core/Tracker.php
index f4a49ab34e..bad522f78b 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -45,7 +45,10 @@ class Piwik_Tracker
const COOKIE_INDEX_REFERER_KEYWORD = 10;
const COOKIE_INDEX_VISITOR_RETURNING = 11;
- public function __construct() {}
+ public function __construct()
+ {
+ $this->request = $_REQUEST;
+ }
public function main()
{
@@ -57,11 +60,11 @@ class Piwik_Tracker
self::connectDatabase();
$visit = $this->getNewVisitObject();
+ $visit->setRequest($this->request);
$visit->handle();
unset($visit);
} catch (PDOException $e) {
printDebug($e->getMessage());
- $this->setState(self::STATE_LOGGING_DISABLE);
}
}
$this->end();
@@ -195,7 +198,6 @@ class Piwik_Tracker
{
throw new Exception("The Visit object set in the plugin must implement Piwik_Tracker_Visit_Interface");
}
-
return $visit;
}
@@ -260,11 +262,11 @@ class Piwik_Tracker
private function handleDownloadRedirect()
{
$downloadVariableName = Piwik_Tracker_Config::getInstance()->Tracker['download_url_var_name'];
- $urlDownload = Piwik_Common::getRequestVar( $downloadVariableName, '', 'string');
+ $urlDownload = Piwik_Common::getRequestVar( $downloadVariableName, '', 'string', $this->request);
if( !empty($urlDownload) )
{
- if( Piwik_Common::getRequestVar( 'redirect', 1, 'int') == 1)
+ if( Piwik_Common::getRequestVar( 'redirect', 1, 'int', $this->request) == 1)
{
$this->setState( self::STATE_TO_REDIRECT_URL );
}
@@ -275,11 +277,12 @@ class Piwik_Tracker
private function handleOutlinkRedirect()
{
$outlinkVariableName = Piwik_Tracker_Config::getInstance()->Tracker['outlink_url_var_name'];
- $urlOutlink = Piwik_Common::getRequestVar( $outlinkVariableName, '', 'string');
+ $urlOutlink = Piwik_Common::getRequestVar( $outlinkVariableName, '', 'string', $this->request);
if( !empty($urlOutlink) )
{
- if( Piwik_Common::getRequestVar( 'redirect', 1, 'int') == 1)
+ $redirectVariableName = Piwik_Tracker_Config::getInstance()->Tracker['outlink_redirect_var_name'];
+ if( Piwik_Common::getRequestVar( 'redirect', 1, 'int', $this->request) == 1)
{
$this->setState( self::STATE_TO_REDIRECT_URL );
}
diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php
index 6ab05173a6..f613f77fad 100644
--- a/core/Tracker/Action.php
+++ b/core/Tracker/Action.php
@@ -16,9 +16,19 @@
* @package Piwik_Tracker
*/
interface Piwik_Tracker_Action_Interface {
- public function getIdAction();
- public function record( $idVisit, $idRefererAction, $timeSpentRefererAction );
+ const TYPE_ACTION = 1;
+ const TYPE_OUTLINK = 2;
+ const TYPE_DOWNLOAD = 3;
+
+ public function setRequest($requestArray);
public function setIdSite( $idSite );
+ public function init();
+ public function getActionUrl();
+ public function getActionName();
+ public function getActionType();
+ public function record( $idVisit, $idRefererAction, $timeSpentRefererAction );
+ public function getIdAction();
+ public function getIdLinkVisitAction();
}
/**
@@ -45,38 +55,63 @@ interface Piwik_Tracker_Action_Interface {
*/
class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
{
- private $url;
+ private $request;
private $idSite;
private $idLinkVisitAction;
- private $finalActionName;
- private $actionType;
private $idAction = null;
-
- /**
- * 3 types of action, Standard action / Download / Outlink click
- */
- const TYPE_ACTION = 1;
- const TYPE_OUTLINK = 2;
- const TYPE_DOWNLOAD = 3;
+
+ private $actionName;
+ private $actionType;
+ private $url;
protected function getDefaultActionName()
{
return Piwik_Tracker_Config::getInstance()->Tracker['default_action_name'];
}
+ public function setRequest($requestArray)
+ {
+ $this->request = $requestArray;
+ }
+
/**
* Returns URL of the page currently being tracked, or the file being downloaded, or the outlink being clicked
* @return string
*/
- public function getUrl()
+ public function getActionUrl()
{
- return $this->url;
+ return $this->actionUrl;
+ }
+ public function getActionName()
+ {
+ return $this->actionName;
}
-
public function getActionType()
{
return $this->actionType;
}
+
+ protected function setActionName($name)
+ {
+ $this->actionName = $name;
+ }
+ protected function setActionType($type)
+ {
+ $this->actionType = $type;
+ }
+ protected function setActionUrl($url)
+ {
+ $this->actionUrl = $url;
+ }
+
+ public function init()
+ {
+ $info = $this->extractUrlAndActionNameFromRequest();
+ $this->setActionName($info['name']);
+ $this->setActionType($info['type']);
+ $this->setActionUrl($info['url']);
+ }
+
/**
* Returns the idaction of the current action name.
* This idaction is used in the visitor logging table to link the visit information
@@ -90,10 +125,31 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
*/
function getIdAction()
{
- if(is_null($this->idAction))
+ if(!is_null($this->idAction))
{
- $this->idAction = $this->loadActionId();
+ return $this->idAction;
+ }
+ $idAction = Piwik_Tracker::getDatabase()->fetch("/* SHARDING_ID_SITE = ".$this->idSite." */ SELECT idaction
+ FROM ".Piwik_Common::prefixTable('log_action')
+ ." WHERE name = ? AND type = ?",
+ array($this->getActionName(), $this->getActionType())
+ );
+
+ // the action name has not been found, create it
+ if($idAction === false)
+ {
+ Piwik_Tracker::getDatabase()->query("/* SHARDING_ID_SITE = ".$this->idSite." */
+ INSERT INTO ". Piwik_Common::prefixTable('log_action'). "( name, type )
+ VALUES (?,?)",
+ array($this->getActionName(),$this->getActionType())
+ );
+ $idAction = Piwik_Tracker::getDatabase()->lastInsertId();
+ }
+ else
+ {
+ $idAction = $idAction['idaction'];
}
+ $this->idAction = $idAction;
return $this->idAction;
}
@@ -150,83 +206,55 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
/**
* Generates the name of the action from the URL or the specified name.
- * Sets the name as $this->finalActionName
+ * Sets the name as $this->actionName
*
* @return void
*/
- private function generateInfo()
+ protected function extractUrlAndActionNameFromRequest()
{
- $actionName = '';
-
+ // download?
$downloadVariableName = Piwik_Tracker_Config::getInstance()->Tracker['download_url_var_name'];
- $downloadUrl = Piwik_Common::getRequestVar( $downloadVariableName, '', 'string');
-
+ $downloadUrl = Piwik_Common::getRequestVar( $downloadVariableName, '', 'string', $this->request);
if(!empty($downloadUrl))
{
- $this->actionType = self::TYPE_DOWNLOAD;
+ $actionType = self::TYPE_DOWNLOAD;
$url = $downloadUrl;
- $actionName = $url;
}
- else
+
+ // outlink?
+ if(empty($actionType))
{
$outlinkVariableName = Piwik_Tracker_Config::getInstance()->Tracker['outlink_url_var_name'];
- $outlinkUrl = Piwik_Common::getRequestVar( $outlinkVariableName, '', 'string');
+ $outlinkUrl = Piwik_Common::getRequestVar( $outlinkVariableName, '', 'string', $this->request);
if(!empty($outlinkUrl))
{
- $this->actionType = self::TYPE_OUTLINK;
+ $actionType = self::TYPE_OUTLINK;
$url = $outlinkUrl;
- //remove the last '/' character if it's present
- if(substr($url,-1) == '/')
- {
- $url = substr($url,0,-1);
- }
- $nameVariableName = Piwik_Tracker_Config::getInstance()->Tracker['download_outlink_name_var'];
- $actionName = Piwik_Common::getRequestVar( $nameVariableName, '', 'string');
- if( empty($actionName) )
- {
- $actionName = $url;
- }
- }
- else
- {
- $this->actionType = self::TYPE_ACTION;
- $url = Piwik_Common::getRequestVar( 'url', '', 'string');
- $actionName = Piwik_Common::getRequestVar( 'action_name', '', 'string');
}
}
- $this->url = $url;
- // the ActionName wasn't specified
- if( empty($actionName) )
+ // defaults to page view
+ if(empty($actionType))
{
- $actionName = trim(Piwik_Common::getPathAndQueryFromUrl($url));
-
- // in case the $actionName is ending with a slash,
- // which means that it is the index page of a category
- // we append the defaultActionName
- // toto/tata/ becomes toto/tata/index
- if(strlen($actionName) > 0
- && $actionName[strlen($actionName)-1] == '/'
- )
+ $actionType = self::TYPE_ACTION;
+ $url = Piwik_Common::getRequestVar( 'url', '', 'string', $this->request);
+ $actionName = Piwik_Common::getRequestVar( 'action_name', '', 'string', $this->request);
+ if( empty($actionName) )
{
- $actionName .= $this->getDefaultActionName();
+ $cleanedUrl = str_replace(array("\n", "\r", "\t"), "", $url);
+ $actionName = Piwik_Common::getPathAndQueryFromUrl($cleanedUrl);
+ // in case the $actionName is empty or ending with a slash,
+ // we append the defaultActionName: a/b/ becomes a/b/index
+ if(empty($actionName)
+ || substr($actionName, -1) == '/')
+ {
+ $actionName .= $this->getDefaultActionName();
+ }
}
- }
-
- /*
- * Clean the action name
- */
-
- // get the delimiter, by default '/'
- $actionCategoryDelimiter = Piwik_Tracker_Config::getInstance()->General['action_category_delimiter'];
-
- // case the name is an URL we dont clean the name the same way
- if(Piwik_Common::isLookLikeUrl($actionName))
- {
- $actionName = trim($actionName);
- }
- else
- {
+
+ // get the delimiter, by default '/'
+ $actionCategoryDelimiter = Piwik_Tracker_Config::getInstance()->General['action_category_delimiter'];
+
// create an array of the categories delimited by the delimiter
$split = explode($actionCategoryDelimiter, $actionName);
@@ -240,51 +268,18 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
$actionName = implode($actionCategoryDelimiter, $split);
}
- // remove the extra bad characters if any (shouldn't be any at this point...)
- $actionName = str_replace(array("\n", "\r"), '', $actionName);
-
+ $url = trim($url);
+ $url = str_replace(array("\n", "\r"), "", $url);
if(empty($actionName))
{
- $actionName = $this->getDefaultActionName();
- }
-
- $this->finalActionName = $actionName;
- }
-
- /**
- * Sets the attribute $idAction based on $finalActionName and $actionType.
- *
- * @see getIdAction()
- */
- private function loadActionId()
- {
- $this->generateInfo();
-
- $name = $this->finalActionName;
- $type = $this->actionType;
-
- $idAction = Piwik_Tracker::getDatabase()->fetch("/* SHARDING_ID_SITE = ".$this->idSite." */ SELECT idaction
- FROM ".Piwik_Common::prefixTable('log_action')
- ." WHERE name = ? AND type = ?",
- array($name, $type)
- );
-
- // the action name has not been found, create it
- if($idAction === false)
- {
- Piwik_Tracker::getDatabase()->query("/* SHARDING_ID_SITE = ".$this->idSite." */
- INSERT INTO ". Piwik_Common::prefixTable('log_action'). "( name, type )
- VALUES (?,?)",
- array($name,$type)
- );
- $idAction = Piwik_Tracker::getDatabase()->lastInsertId();
- }
- else
- {
- $idAction = $idAction['idaction'];
+ $actionName = $url;
}
- return $idAction;
+
+ return array(
+ 'name' => $actionName,
+ 'type' => $actionType,
+ 'url' => $url,
+ );
}
-
}
diff --git a/core/Tracker/Generator.php b/core/Tracker/Generator.php
index 14888c5f9e..ea1178123f 100644
--- a/core/Tracker/Generator.php
+++ b/core/Tracker/Generator.php
@@ -414,7 +414,6 @@ class Piwik_Tracker_Generator
{
// we don't keep the previous action values
// reinit them to empty string
- $this->setCurrentRequest( Piwik_Tracker_Config::getInstance()->Tracker['download_outlink_name_var'],'');
$this->setCurrentRequest( Piwik_Tracker_Config::getInstance()->Tracker['download_url_var_name'],'');
$this->setCurrentRequest( Piwik_Tracker_Config::getInstance()->Tracker['outlink_url_var_name'],'');
$this->setCurrentRequest( 'action_name', '');
@@ -462,15 +461,6 @@ class Piwik_Tracker_Generator
// add the parameter to the url
$this->setCurrentRequest( $GETParamToAdd , $urlValue);
-
- // in 50% we give a special name to the download/outlink
- if(mt_rand(0,1)==0)
- {
- $nameDownload = $this->getRandomString(6,3,'ALL');
-
- $this->setCurrentRequest( Piwik_Tracker_Config::getInstance()->Tracker['download_outlink_name_var']
- , $nameDownload);
- }
}
// if we didn't set any campaign NOR any download click
diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php
index bac8759ecc..ecb1f1353b 100644
--- a/core/Tracker/GoalManager.php
+++ b/core/Tracker/GoalManager.php
@@ -66,7 +66,7 @@ class Piwik_Tracker_GoalManager
{
return false;
}
- $url = $this->action->getUrl();
+ $url = $this->action->getActionUrl();
$actionType = $this->action->getActionType();
$goals = $this->getGoalDefinitions($idSite);
foreach($goals as $goal)
@@ -143,7 +143,7 @@ class Piwik_Tracker_GoalManager
'idlink_va' => $this->action->getIdLinkVisitAction(),
'location_country' => $location_country,
'location_continent'=> $location_continent,
- 'url' => $this->action->getUrl(),
+ 'url' => $this->action->getActionUrl(),
'visitor_returning' => $this->cookie->get( Piwik_Tracker::COOKIE_INDEX_VISITOR_RETURNING ),
);
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php
index 6d0fe020f6..bb34e5843c 100644
--- a/core/Tracker/Visit.php
+++ b/core/Tracker/Visit.php
@@ -11,6 +11,7 @@
interface Piwik_Tracker_Visit_Interface {
+ function setRequest($requestArray);
function handle();
}
@@ -38,6 +39,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
protected $userSettingsInformation = null;
protected $idsite;
protected $visitorKnown;
+ protected $request;
// @see detect*() referer methods
protected $typeRefererAnalyzed;
@@ -49,13 +51,17 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
function __construct()
{
- $idsite = Piwik_Common::getRequestVar('idsite', 0, 'int');
+ $idsite = Piwik_Common::getRequestVar('idsite', 0, 'int', $this->request);
if($idsite <= 0)
{
throw new Exception("The 'idsite' in the request is invalid.");
}
$this->idsite = $idsite;
}
+ function setRequest($requestArray)
+ {
+ $this->request = $requestArray;
+ }
/**
* Main algorith to handle the visit.
@@ -84,10 +90,35 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
return;
}
- // current action
$action = $this->newAction();
+ $action->setIdSite($this->idsite);
+ $action->setRequest($this->request);
+ $action->init();
+ if($this->detectActionIsOutlinkOnAliasHost($action))
+ {
+ printDebug("The outlink's URL host is one of the known host for this website. We don't record this click.");
+ return;
+ }
$actionId = $action->getIdAction();
+ if($GLOBALS['DEBUGPIWIK'])
+ {
+ switch($action->getActionType()) {
+ case Piwik_Tracker_Action::TYPE_ACTION:
+ $type = "normal page view";
+ break;
+ case Piwik_Tracker_Action::TYPE_DOWNLOAD:
+ $type = "download";
+ break;
+ case Piwik_Tracker_Action::TYPE_OUTLINK:
+ $type = "outlink";
+ break;
+ }
+ printDebug("Detected action <u>$type</u>,
+ Action name: ". $action->getActionName() . ",
+ Action URL = ". $action->getActionUrl() );
+ }
+
// goal matched?
$goalManager = new Piwik_Tracker_GoalManager( $action );
$someGoalsConverted = false;
@@ -206,9 +237,9 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
{
printDebug("New Visit.");
- $localTime = Piwik_Common::getRequestVar( 'h', $this->getCurrentDate("H"), 'numeric')
- .':'. Piwik_Common::getRequestVar( 'm', $this->getCurrentDate("i"), 'numeric')
- .':'. Piwik_Common::getRequestVar( 's', $this->getCurrentDate("s"), 'numeric');
+ $localTime = Piwik_Common::getRequestVar( 'h', $this->getCurrentDate("H"), 'numeric', $this->request)
+ .':'. Piwik_Common::getRequestVar( 'm', $this->getCurrentDate("i"), 'numeric', $this->request)
+ .':'. Piwik_Common::getRequestVar( 's', $this->getCurrentDate("s"), 'numeric', $this->request);
$serverTime = $this->getCurrentTimestamp();
$serverDate = $this->getCurrentDate();
@@ -473,14 +504,14 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
}
require_once "UserAgentParser/UserAgentParser.php";
- $plugin_Flash = Piwik_Common::getRequestVar( 'fla', 0, 'int');
- $plugin_Director = Piwik_Common::getRequestVar( 'dir', 0, 'int');
- $plugin_Quicktime = Piwik_Common::getRequestVar( 'qt', 0, 'int');
- $plugin_RealPlayer = Piwik_Common::getRequestVar( 'realp', 0, 'int');
- $plugin_Pdf = Piwik_Common::getRequestVar( 'pdf', 0, 'int');
- $plugin_WindowsMedia = Piwik_Common::getRequestVar( 'wma', 0, 'int');
- $plugin_Java = Piwik_Common::getRequestVar( 'java', 0, 'int');
- $plugin_Cookie = Piwik_Common::getRequestVar( 'cookie', 0, 'int');
+ $plugin_Flash = Piwik_Common::getRequestVar( 'fla', 0, 'int', $this->request);
+ $plugin_Director = Piwik_Common::getRequestVar( 'dir', 0, 'int', $this->request);
+ $plugin_Quicktime = Piwik_Common::getRequestVar( 'qt', 0, 'int', $this->request);
+ $plugin_RealPlayer = Piwik_Common::getRequestVar( 'realp', 0, 'int', $this->request);
+ $plugin_Pdf = Piwik_Common::getRequestVar( 'pdf', 0, 'int', $this->request);
+ $plugin_WindowsMedia = Piwik_Common::getRequestVar( 'wma', 0, 'int', $this->request);
+ $plugin_Java = Piwik_Common::getRequestVar( 'java', 0, 'int', $this->request);
+ $plugin_Cookie = Piwik_Common::getRequestVar( 'cookie', 0, 'int', $this->request);
$userAgent = Piwik_Common::sanitizeInputValues(@$_SERVER['HTTP_USER_AGENT']);
$aBrowserInfo = UserAgentParser::getBrowser($userAgent);
@@ -491,7 +522,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$os = UserAgentParser::getOperatingSystem($userAgent);
$os = $os === false ? 'UNK' : $os['id'];
- $resolution = Piwik_Common::getRequestVar('res', 'unknown', 'string');
+ $resolution = Piwik_Common::getRequestVar('res', 'unknown', 'string', $this->request);
$ip = Piwik_Common::getIp();
$ip = ip2long($ip);
@@ -626,8 +657,6 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
{
throw new Exception("The Action object set in the plugin must implement the interface Piwik_Tracker_Action_Interface");
}
- $action->setIdSite($this->idsite);
-
return $action;
}
@@ -665,8 +694,8 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$this->refererHost = '';
// get the urls and parse them
- $refererUrl = Piwik_Common::getRequestVar( 'urlref', '', 'string');
- $currentUrl = Piwik_Common::getRequestVar( 'url', '', 'string');
+ $refererUrl = Piwik_Common::getRequestVar( 'urlref', '', 'string', $this->request);
+ $currentUrl = Piwik_Common::getRequestVar( 'url', '', 'string', $this->request);
$this->refererUrl = $refererUrl;
$this->refererUrlParse = @parse_url($refererUrl);
@@ -752,6 +781,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
return true;
}
}
+ return false;
}
@@ -775,23 +805,51 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
return true;
}
}
- // is the referer host any of the registered URLs for this website?
- $websiteData = Piwik_Common::getCacheWebsiteAttributes($this->idsite);
- if(isset($websiteData['hosts']))
+ if($this->isHostKnownAliasHost($this->refererHost))
{
- $canonicalHosts = array();
- foreach($websiteData['hosts'] as $host) {
- $canonicalHosts[] = str_replace('www.', '' , $host);
- }
- $canonicalRefererHost = str_replace('www.', '', $this->refererHost);
- if(in_array($canonicalRefererHost, $canonicalHosts))
- {
- $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_DIRECT_ENTRY;
- return true;
- }
+ $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_DIRECT_ENTRY;
+ return true;
}
}
-
+ return false;
+ }
+
+ /**
+ * @param $action
+ * @return bool true if the outlink the visitor clicked on points to one of the known hosts for this website
+ */
+ protected function detectActionIsOutlinkOnAliasHost(Piwik_Tracker_Action_Interface $action)
+ {
+ if($action->getActionType() != Piwik_Tracker_Action_Interface::TYPE_OUTLINK)
+ {
+ return false;
+ }
+ $actionUrl = $action->getActionUrl();
+ $actionUrlParsed = @parse_url($actionUrl);
+ if(!isset($actionUrlParsed['host']))
+ {
+ return false;
+ }
+ return $this->isHostKnownAliasHost($actionUrlParsed['host']);
+ }
+
+ // is the referer host any of the registered URLs for this website?
+ protected function isHostKnownAliasHost($urlHost)
+ {
+ $websiteData = Piwik_Common::getCacheWebsiteAttributes($this->idsite);
+ if(isset($websiteData['hosts']))
+ {
+ $canonicalHosts = array();
+ foreach($websiteData['hosts'] as $host) {
+ $canonicalHosts[] = str_replace('www.', '' , $host);
+ }
+ $canonicalHost = str_replace('www.', '', $urlHost);
+ if(in_array($canonicalHost, $canonicalHosts))
+ {
+ return true;
+ }
+ }
+ return false;
}
/**
diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php
index 43558c7e7d..bf4340c30d 100644
--- a/core/ViewDataTable.php
+++ b/core/ViewDataTable.php
@@ -242,6 +242,7 @@ abstract class Piwik_ViewDataTable
$this->viewProperties['show_goals'] = false;
$this->viewProperties['show_search'] = Piwik_Common::getRequestVar('show_search', true);
$this->viewProperties['show_table_all_columns'] = Piwik_Common::getRequestVar('show_table_all_columns', true);
+ $this->viewProperties['show_all_views_icons'] = Piwik_Common::getRequestVar('show_all_views_icons', true);
$this->viewProperties['show_exclude_low_population'] = Piwik_Common::getRequestVar('show_exclude_low_population', true);
$this->viewProperties['show_offset_information'] = Piwik_Common::getRequestVar('show_offset_information', true);;
$this->viewProperties['show_footer'] = Piwik_Common::getRequestVar('show_footer', true);
@@ -653,6 +654,15 @@ abstract class Piwik_ViewDataTable
}
/**
+ * Whether or not to show the tag cloud, pie charts, bar chart icons
+ * @return void
+ */
+ public function disableShowAllViewsIcons()
+ {
+ $this->viewProperties['show_all_views_icons'] = false;
+ }
+
+ /**
* Whether or not to show the "goal" icon
* @return void
*/
diff --git a/core/ViewDataTable/HtmlTable.php b/core/ViewDataTable/HtmlTable.php
index d656908f85..222503a5d6 100644
--- a/core/ViewDataTable/HtmlTable.php
+++ b/core/ViewDataTable/HtmlTable.php
@@ -124,6 +124,7 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
$view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
$view->properties = $this->getViewProperties();
+ $view->defaultWhenColumnValueNotDefined = '-';
return $view;
}
@@ -231,24 +232,20 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
// we show the columns in order specified in the setColumnsToDisplay
// each column has a string name;
// this name will for example be used to specify the sorting column
- $columnsInDataTable = array_keys($phpArray[0]['columns']);
$columnsToDisplay = $this->columnsToDisplay;
if(count($columnsToDisplay) == 0)
{
- $columnsToDisplay = $columnsInDataTable;
+ $columnsToDisplay = array_keys($phpArray[0]['columns']);
}
$columnsToDisplay = array_unique($columnsToDisplay);
foreach($columnsToDisplay as $columnToDisplay)
{
- if(in_array($columnToDisplay, $columnsInDataTable))
- {
- $metadataColumnToDisplay[] = array(
- 'name' => $columnToDisplay,
- 'displayName' => $this->getColumnTranslation($columnToDisplay)
- );
- }
+ $metadataColumnToDisplay[] = array(
+ 'name' => $columnToDisplay,
+ 'displayName' => $this->getColumnTranslation($columnToDisplay)
+ );
}
}
return $metadataColumnToDisplay ;
diff --git a/lang/en.php b/lang/en.php
index 468d3cc5b4..48dc001efe 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -143,6 +143,10 @@ $translations = array(
'Actions_SubmenuPages' => 'Pages',
'Actions_SubmenuOutlinks' => 'Outlinks',
'Actions_SubmenuDownloads' => 'Downloads',
+ 'Actions_ColumnClicks' => 'Clicks',
+ 'Actions_ColumnUniqueClicks' => 'Unique Clicks',
+ 'Actions_ColumnDownloads' => 'Downloads',
+ 'Actions_ColumnUniqueDownloads' => 'Unique Downloads',
'Dashboard_Dashboard' => 'Dashboard',
'Dashboard_AddWidget' => 'Add a widget...',
'Dashboard_DeleteWidgetConfirm' => 'Are you sure you want to delete this widget from the dashboard?',
diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php
index 42188eee90..b76e988dfa 100644
--- a/plugins/Actions/API.php
+++ b/plugins/Actions/API.php
@@ -59,36 +59,13 @@ class Piwik_Actions_API
public function getDownloads( $idSite, $period, $date, $expanded = false, $idSubtable = false )
{
$dataTable = $this->getDataTable('Actions_downloads', $idSite, $period, $date, $expanded, $idSubtable );
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('full_url', 'url', create_function('$url', 'return $url;')));
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getPathFromActionsUrl'));
-
return $dataTable;
}
public function getOutlinks( $idSite, $period, $date, $expanded = false, $idSubtable = false )
{
$dataTable = $this->getDataTable('Actions_outlink', $idSite, $period, $date, $expanded, $idSubtable );
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('full_url', 'url', create_function('$url', 'return $url;')));
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getPathFromActionsUrl'));
return $dataTable;
}
}
-/**
- * returns /Y in http://X/Y
- *
- * @param string $url
- * @return string
- */
-function Piwik_getPathFromActionsUrl($url)
-{
- $n = preg_match("#://[^/]+(/)#",$url, $matches, PREG_OFFSET_CAPTURE);
- if($n)
- {
- $returned = substr($url, $matches[1][1]);
- return $returned;
- }
-
- return $url;
-}
-
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php
index a0f94dc189..20f1f312b1 100644
--- a/plugins/Actions/Actions.php
+++ b/plugins/Actions/Actions.php
@@ -44,12 +44,7 @@ class Piwik_Actions extends Piwik_Plugin
public function __construct()
{
- $this->setCategoryDelimiter( Zend_Registry::get('config')->General->action_category_delimiter);
- }
-
- public function setCategoryDelimiter($delimiter)
- {
- self::$actionCategoryDelimiter = $delimiter;
+ self::$actionCategoryDelimiter = Zend_Registry::get('config')->General->action_category_delimiter;
}
function addWidgets()
@@ -123,7 +118,7 @@ class Piwik_Actions extends Piwik_Plugin
LEFT JOIN ".$archiveProcessing->logVisitActionTable." as t2 USING (idvisit))
LEFT JOIN ".$archiveProcessing->logActionTable." as t3 USING (idaction)
WHERE visit_server_date = ?
- AND idsite = ?
+ AND idsite = ?
GROUP BY t3.idaction
ORDER BY nb_hits DESC";
$query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite ));
@@ -135,7 +130,7 @@ class Piwik_Actions extends Piwik_Plugin
*/
$query = "SELECT name,
type,
- count(distinct visitor_idcookie) as entry_nb_unique_visitor,
+ count(distinct visitor_idcookie) as entry_nb_uniq_visitors,
count(*) as entry_nb_visits,
sum(visit_total_actions) as entry_nb_actions,
sum(visit_total_time) as entry_sum_visit_length,
@@ -143,7 +138,7 @@ class Piwik_Actions extends Piwik_Plugin
FROM ".$archiveProcessing->logTable."
JOIN ".$archiveProcessing->logActionTable." ON (visit_entry_idaction = idaction)
WHERE visit_server_date = ?
- AND idsite = ?
+ AND idsite = ?
GROUP BY visit_entry_idaction
";
$query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite ));
@@ -155,10 +150,9 @@ class Piwik_Actions extends Piwik_Plugin
*/
$query = "SELECT name,
type,
- count(distinct visitor_idcookie) as exit_nb_unique_visitor,
+ count(distinct visitor_idcookie) as exit_nb_uniq_visitors,
count(*) as exit_nb_visits,
sum(case visit_total_actions when 1 then 1 else 0 end) as exit_bounce_count
-
FROM ".$archiveProcessing->logTable."
JOIN ".$archiveProcessing->logActionTable." ON (visit_exit_idaction = idaction)
WHERE visit_server_date = ?
@@ -207,85 +201,60 @@ class Piwik_Actions extends Piwik_Plugin
unset($this->actionsTablesByType);
}
- static public function splitUrl($url)
+ static public function getHostAndPageNameFromUrl($url)
{
$matches = $split_arr = array();
- $n = preg_match("#://[^/]+(/)#",$url, $matches, PREG_OFFSET_CAPTURE);
- if( $n )
+ if(preg_match("#://[^/]+(/)#",$url, $matches, PREG_OFFSET_CAPTURE))
{
$host = substr($url, 0, $matches[1][1]);
- $split_arr = array($host, $url);
+ return array($host, substr($url,strlen($host)));
}
- else
- {
- $split_arr = array($url);
- }
- return $split_arr;
+ return array($url, "/");
}
- static public function getActionCategoryFromName($name)
+ static public function getActionExplodedNames($name, $type)
{
- $isUrl = false;
- // case the name is an URL we dont clean the name the same way
- if(Piwik_Common::isLookLikeUrl($name)
- || preg_match('#^mailto:#',$name))
+ if($type == Piwik_Tracker_Action::TYPE_DOWNLOAD
+ || $type == Piwik_Tracker_Action::TYPE_OUTLINK)
{
- $split = self::splitUrl($name);
- $isUrl = true;
+ return self::getHostAndPageNameFromUrl($name);
}
- else
+ if(empty(self::$actionCategoryDelimiter))
{
- if(empty(self::$actionCategoryDelimiter))
- {
- $split = array($name);
- }
- else
- {
- $split = explode(self::$actionCategoryDelimiter, $name, self::$limitLevelSubCategory);
- }
+ return array($name);
}
- return array( $isUrl, $split);
+ return explode( self::$actionCategoryDelimiter,
+ $name,
+ self::$limitLevelSubCategory);
}
protected function updateActionsTableWithRowQuery($query)
{
$rowsProcessed = 0;
-
while( $row = $query->fetch() )
{
- // split the actions by category
- $returned = $this->getActionCategoryFromName($row['name']);
- $aActions = $returned[1];
- $isUrl = $returned[0];
-
+ $actionExplodedNames = $this->getActionExplodedNames($row['name'], $row['type']);
+
// we work on the root table of the given TYPE (either ACTION or DOWNLOAD or OUTLINK etc.)
$currentTable =& $this->actionsTablesByType[$row['type']];
// go to the level of the subcategory
- $end = count($aActions)-1;
+ $end = count($actionExplodedNames)-1;
for($level = 0 ; $level < $end; $level++)
{
- $actionCategory = $aActions[$level];
+ $actionCategory = $actionExplodedNames[$level];
$currentTable =& $currentTable[$actionCategory];
}
- $actionName = $aActions[$end];
+ $actionName = $actionExplodedNames[$end];
- // create a new element in the array for the page
- // we are careful to prefix the pageName with some value so that if a page has the same name
- // as a category we don't overwrite or do other silly things
-
- // if the page name is not a URL we add a / before
- if( !$isUrl )
+ // we are careful to prefix the pageName with some value
+ // so that if a page has the same name as a category
+ // we don't merge both entries
+ if($row['type'] == Piwik_Tracker_Action::TYPE_ACTION)
{
- // we know that the concatenation of a space and the name of the action
- // will always be unique as all the action names have been trimmed before reaching this point
$actionName = '/' . $actionName;
}
- else
- {
- $actionName = ' ' . $actionName;
- }
// currentTable is now the array element corresponding the the action
// at this point we may be for example at the 4th level of depth in the hierarchy
@@ -294,13 +263,10 @@ class Piwik_Actions extends Piwik_Plugin
// add the row to the matching sub category subtable
if(!($currentTable instanceof Piwik_DataTable_Row))
{
- $currentTable = new Piwik_DataTable_Row(
- array( Piwik_DataTable_Row::COLUMNS =>
- array( 'label' => (string)$actionName,
- 'full_url' => (string)$row['name'],
- )
- )
- );
+ $currentTable = new Piwik_DataTable_Row(array(
+ Piwik_DataTable_Row::COLUMNS => array('label' => (string)$actionName),
+ Piwik_DataTable_Row::METADATA => array('url' => (string)$row['name']),
+ ));
}
foreach($row as $name => $value)
@@ -308,9 +274,10 @@ class Piwik_Actions extends Piwik_Plugin
// we don't add this information as itnot pertinent
// name is already set as the label // and it has been cleaned from the categories and extracted from the initial string
// type is used to partition the different actions type in different table. Adding the info to the row would be a duplicate.
- if($name != 'name' && $name != 'type')
+ if($name != 'name'
+ && $name != 'type')
{
- // in some very rare case, we actually have twice the same action name with 2 different idaction
+ // in some edge cases, we have twice the same action name with 2 different idaction
// this happens when 2 visitors visit the same new page at the same time, there is a SELECT and an INSERT for each new page,
// and in between the two the other visitor comes.
// here we handle the case where there is already a row for this action name, if this is the case we add the value
diff --git a/plugins/Actions/Controller.php b/plugins/Actions/Controller.php
index 51aa10588d..43274d16f1 100644
--- a/plugins/Actions/Controller.php
+++ b/plugins/Actions/Controller.php
@@ -3,119 +3,92 @@ require_once "ViewDataTable.php";
class Piwik_Actions_Controller extends Piwik_Controller
{
- function getDownloads($fetch = false)
+ public function index()
+ {
+ $view = new Piwik_View('Actions/index.tpl');
+
+ /* Actions, Downloads, Outlinks */
+ $view->dataTableActions = $this->getActions( true );
+ $view->dataTableDownloads = $this->getDownloads( true );
+ $view->dataTableOutlinks = $this->getOutlinks( true );
+
+ echo $view->render();
+ }
+
+ public function getActions($fetch = false)
{
$view = Piwik_ViewDataTable::factory();
$view->init( $this->pluginName,
__FUNCTION__,
- 'Actions.getDownloads',
- 'getDownloadsSubDataTable' );
-
- $view->setColumnsToDisplay( array('label','nb_uniq_visitors') );
- $view->setSortedColumn( 'nb_uniq_visitors','desc' );
- $view->disableExcludeLowPopulation();
- $view->setLimit( 15 );
- $view->disableSort();
- $view->disableShowAllColumns();
-
+ 'Actions.getActions',
+ 'getActionsSubDataTable' );
+ $this->configureViewActions($view);
return $this->renderView($view, $fetch);
}
- function getDownloadsSubDataTable($fetch = false)
+ public function getActionsSubDataTable($fetch = false)
{
$view = Piwik_ViewDataTable::factory();
$view->init( $this->pluginName,
__FUNCTION__,
- 'Actions.getDownloads',
- 'getDownloadsSubDataTable');
-
- $view->setColumnsToDisplay( array('label','nb_uniq_visitors') );
- $view->setSortedColumn( 'nb_uniq_visitors','desc' );
- $view->disableExcludeLowPopulation();
- $view->disableSearchBox();
- $view->setLimit( 15 );
- $view->disableSort();
-
+ 'Actions.getActions',
+ 'getActionsSubDataTable' );
+ $this->configureViewActions($view);
return $this->renderView($view, $fetch);
}
- function getActions($fetch = false)
+ public function getDownloads($fetch = false)
{
- $view = $this->getActionsView( $this->pluginName,
- __FUNCTION__,
- 'Actions.getActions',
- 'getActionsSubDataTable' );
+ $view = Piwik_ViewDataTable::factory();
+ $view->init( $this->pluginName,
+ __FUNCTION__,
+ 'Actions.getDownloads',
+ 'getDownloadsSubDataTable' );
+
+ $this->configureViewDownloads($view);
+ $view->disableShowAllColumns();
return $this->renderView($view, $fetch);
}
- function getActionsSubDataTable($fetch = false)
+ public function getDownloadsSubDataTable($fetch = false)
{
- $view = $this->getActionsView( $this->pluginName,
- __FUNCTION__,
- 'Actions.getActions',
- 'getActionsSubDataTable' );
-
+ $view = Piwik_ViewDataTable::factory();
+ $view->init( $this->pluginName,
+ __FUNCTION__,
+ 'Actions.getDownloads',
+ 'getDownloadsSubDataTable');
+ $this->configureViewDownloads($view);
+ $view->disableSearchBox();
return $this->renderView($view, $fetch);
}
- function getOutlinks($fetch = false)
+ public function getOutlinks($fetch = false)
{
$view = Piwik_ViewDataTable::factory();
$view->init( $this->pluginName,
__FUNCTION__,
'Actions.getOutlinks',
'getOutlinksSubDataTable' );
-
- $view->setColumnsToDisplay( array('label','nb_uniq_visitors') );
- $view->setSortedColumn( 'nb_uniq_visitors','desc' );
+ $this->configureViewOutlinks($view);
$view->disableExcludeLowPopulation();
- $view->setLimit( 15 );
- $view->disableSort();
$view->disableShowAllColumns();
-
return $this->renderView($view, $fetch);
}
- function getOutlinksSubDataTable($fetch = false)
+ public function getOutlinksSubDataTable($fetch = false)
{
$view = Piwik_ViewDataTable::factory();
$view->init( $this->pluginName,
__FUNCTION__,
'Actions.getOutlinks',
'getOutlinksSubDataTable');
-
- $view->setColumnsToDisplay( array('label','nb_uniq_visitors') );
- $view->setSortedColumn( 'nb_uniq_visitors','desc' );
- $view->disableExcludeLowPopulation();
+ $this->configureViewOutlinks($view);
$view->disableSearchBox();
- $view->setLimit( 15 );
- $view->disableSort();
-
return $this->renderView($view, $fetch);
}
- function index()
- {
- $view = new Piwik_View('Actions/index.tpl');
-
- /* Actions / Downloads / Outlinks */
- $view->dataTableActions = $this->getActions( true );
- $view->dataTableDownloads = $this->getDownloads( true );
- $view->dataTableOutlinks = $this->getOutlinks( true );
-
- echo $view->render();
- }
-
- protected function getActionsView($currentControllerName,
- $currentMethod,
- $methodToCall = 'Actions.getActions',
- $subMethod = 'getActionsSubDataTable')
+ protected function configureViewActions($view)
{
- $view = Piwik_ViewDataTable::factory();
- $view->init( $currentControllerName,
- $currentMethod,
- $methodToCall,
- $subMethod );
$view->setTemplate('CoreHome/templates/datatable_actions.tpl');
if(Piwik_Common::getRequestVar('idSubtable', -1) != -1)
@@ -130,9 +103,11 @@ class Piwik_Actions_Controller extends Piwik_Controller
}
$view->disableSort();
$view->disableOffsetInformation();
- $view->setLimit( 100 );
+ $view->disableShowAllViewsIcons();
+ $view->disableShowAllColumns();
- $view->setColumnsToDisplay( array('label','nb_uniq_visitors','nb_hits') );
+ $view->setLimit( 100 );
+ $view->setColumnsToDisplay( array('label','nb_hits','nb_uniq_visitors') );
$view->setSortedColumn( 'nb_uniq_visitors', 'desc' );
$view->setColumnTranslation('nb_hits', Piwik_Translate('General_ColumnPageviews'));
$view->setColumnTranslation('nb_uniq_visitors', Piwik_Translate('General_ColumnUniquePageviews'));
@@ -162,6 +137,26 @@ class Piwik_Actions_Controller extends Piwik_Controller
return $view;
}
+ protected function configureViewDownloads($view)
+ {
+ $view->setColumnsToDisplay( array('label','nb_visits', 'nb_uniq_visitors') );
+ $view->setColumnTranslation('nb_visits', Piwik_Translate('Actions_ColumnDownloads'));
+ $view->setColumnTranslation('nb_uniq_visitors', Piwik_Translate('Actions_ColumnUniqueDownloads'));
+ $view->setSortedColumn( 'nb_visits','desc' );
+ $view->disableExcludeLowPopulation();
+ $view->setLimit( 15 );
+ }
+
+ protected function configureViewOutlinks($view)
+ {
+ $view->setColumnsToDisplay( array('label','nb_visits','nb_uniq_visitors') );
+ $view->setColumnTranslation('nb_visits', Piwik_Translate('Actions_ColumnClicks'));
+ $view->setColumnTranslation('nb_uniq_visitors', Piwik_Translate('Actions_ColumnUniqueClicks'));
+ $view->setSortedColumn( 'nb_visits','desc' );
+ $view->disableExcludeLowPopulation();
+ $view->setLimit( 15 );
+ }
+
protected function getArrayFromRecursiveDataTable( $dataTable, $depth = 0 )
{
$table = array();
diff --git a/plugins/CoreHome/templates/datatable.css b/plugins/CoreHome/templates/datatable.css
index d053a2b222..cb13c6553e 100644
--- a/plugins/CoreHome/templates/datatable.css
+++ b/plugins/CoreHome/templates/datatable.css
@@ -119,7 +119,7 @@ table.dataTable td.labelodd {
}
table.dataTable td.label,table.subActionsDataTable td.label,table.actionsDataTable td.label
- {
+{
border-top: 0;
border-left: 1px solid #C1DAD7;
}
diff --git a/plugins/CoreHome/templates/datatable.js b/plugins/CoreHome/templates/datatable.js
index 5bbde69751..7c83458dff 100644
--- a/plugins/CoreHome/templates/datatable.js
+++ b/plugins/CoreHome/templates/datatable.js
@@ -33,7 +33,6 @@ dataTable.prototype =
onClickSort: function(domElem)
{
var self = this;
-
var newColumnToSort = $(domElem).attr('id');
// we lookup if the column to sort was already this one, if it is the case then we switch from desc <-> asc
if(self.param.filter_sort_column == newColumnToSort)
@@ -738,6 +737,9 @@ actionDataTable.prototype =
buildAjaxRequest: dataTable.prototype.buildAjaxRequest,
handleLowPopulationLink: dataTable.prototype.handleLowPopulationLink,
handleSearchBox: dataTable.prototype.handleSearchBox,
+ handleExportBox: dataTable.prototype.handleExportBox,
+ handleSort: dataTable.prototype.handleSort,
+ onClickSort: dataTable.prototype.onClickSort,
//initialisation of the actionDataTable
init: function(workingDivId, domElem)
@@ -775,6 +777,8 @@ actionDataTable.prototype =
self.applyCosmetics(domElem);
+ self.handleExportBox(domElem);
+ self.handleSort(domElem);
if( self.workingDivId != undefined)
{
self.handleSearchBox(domElem, self.actionsDataTableLoaded );
diff --git a/plugins/CoreHome/templates/datatable.tpl b/plugins/CoreHome/templates/datatable.tpl
index a8c204e478..a3cc8876f9 100644
--- a/plugins/CoreHome/templates/datatable.tpl
+++ b/plugins/CoreHome/templates/datatable.tpl
@@ -23,8 +23,7 @@
<td>
{if !$row.idsubdatatable && $column.name=='label' && isset($row.metadata.url)}<span id="urlLink">{$row.metadata.url}</span>{/if}
{if $column.name=='label'}{logoHtml metadata=$row.metadata alt=$row.columns.label}{/if}
-{* sometimes all columns are not set in the datatable, we assume the value 0 *}
-{if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}0{/if}
+{if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}{$defaultWhenColumnValueNotDefined}{/if}
</td>
{/foreach}
</tr>
diff --git a/plugins/CoreHome/templates/datatable_actions.tpl b/plugins/CoreHome/templates/datatable_actions.tpl
index a383b20383..31300cd878 100644
--- a/plugins/CoreHome/templates/datatable_actions.tpl
+++ b/plugins/CoreHome/templates/datatable_actions.tpl
@@ -20,8 +20,7 @@
<tr {if $row.idsubdatatable}class="rowToProcess subActionsDataTable" id="{$row.idsubdatatable}"{else} class="actionsDataTable rowToProcess"{/if}>
{foreach from=$dataTableColumns item=column}
<td>
- {* sometimes all columns are not set in the datatable, we assume the value 0 *}
- {if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}0{/if}
+ {if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}{$defaultWhenColumnValueNotDefined}{/if}
</td>
{/foreach}
</tr>
diff --git a/plugins/CoreHome/templates/datatable_actions_recursive.tpl b/plugins/CoreHome/templates/datatable_actions_recursive.tpl
index d2f1abc846..be24f32f9d 100644
--- a/plugins/CoreHome/templates/datatable_actions_recursive.tpl
+++ b/plugins/CoreHome/templates/datatable_actions_recursive.tpl
@@ -20,8 +20,7 @@
<tr {if $row.idsubdatatable}class="level{$row.level} rowToProcess subActionsDataTable" id="{$row.idsubdatatable}"{else}class="actionsDataTable rowToProcess level{$row.level}"{/if}>
{foreach from=$dataTableColumns item=column}
<td>
- {* sometimes all columns are not set in the datatable, we assume the value 0 *}
- {if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}0{/if}
+ {if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}{$defaultWhenColumnValueNotDefined}{/if}
</td>
{/foreach}
</tr>
diff --git a/plugins/CoreHome/templates/datatable_actions_subdatable.tpl b/plugins/CoreHome/templates/datatable_actions_subdatable.tpl
index 810002dea3..c040d21941 100644
--- a/plugins/CoreHome/templates/datatable_actions_subdatable.tpl
+++ b/plugins/CoreHome/templates/datatable_actions_subdatable.tpl
@@ -9,8 +9,7 @@
<tr {if $row.idsubdatatable}class="subActionsDataTable" id="{$row.idsubdatatable}"{else}class="actionsDataTable"{/if}>
{foreach from=$dataTableColumns item=column}
<td>
- {* sometimes all columns are not set in the datatable, we assume the value 0 *}
- {if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}0{/if}
+ {if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}{$defaultWhenColumnValueNotDefined}{/if}
</td>
{/foreach}
</tr>
diff --git a/plugins/CoreHome/templates/datatable_footer.tpl b/plugins/CoreHome/templates/datatable_footer.tpl
index ed0c8f21d0..2e44ebbcf7 100644
--- a/plugins/CoreHome/templates/datatable_footer.tpl
+++ b/plugins/CoreHome/templates/datatable_footer.tpl
@@ -29,9 +29,11 @@
<a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="PHP" filter_limit="100">Php</a> |
<a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="RSS" filter_limit="100" date="last10"><img border="0" src="{$piwikUrl}themes/default/images/feed.png"></a>
</span>
- <a class="viewDataTable" format="cloud"><img width="16" height="16" src="{$piwikUrl}themes/default/images/tagcloud.png" title="{'General_TagCloud'|translate}" /></a>
- <a class="viewDataTable" format="graphVerticalBar"><img width="16" height="16" src="{$piwikUrl}themes/default/images/chart_bar.png" title="{'General_VBarGraph'|translate}" /></a>
- <a class="viewDataTable" format="graphPie"><img width="16" height="16" src="{$piwikUrl}themes/default/images/chart_pie.png" title="{'General_Piechart'|translate}" /></a>
+ {if $properties.show_all_views_icons}
+ <a class="viewDataTable" format="cloud"><img width="16" height="16" src="{$piwikUrl}themes/default/images/tagcloud.png" title="{'General_TagCloud'|translate}" /></a>
+ <a class="viewDataTable" format="graphVerticalBar"><img width="16" height="16" src="{$piwikUrl}themes/default/images/chart_bar.png" title="{'General_VBarGraph'|translate}" /></a>
+ <a class="viewDataTable" format="graphPie"><img width="16" height="16" src="{$piwikUrl}themes/default/images/chart_pie.png" title="{'General_Piechart'|translate}" /></a>
+ {/if}
</span>
<span id="dataTableFooterIconsShow" style="display:none;padding-left:4px;">
<img src="{$piwikUrl}plugins/CoreHome/templates/images/more.png" />
diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php
index 87141b7705..e165f5ff79 100644
--- a/plugins/Referers/Referers.php
+++ b/plugins/Referers/Referers.php
@@ -39,11 +39,6 @@ class Piwik_Referers extends Piwik_Plugin
return $hooks;
}
- public function setCategoryDelimiter($delimiter)
- {
- self::$actionCategoryDelimiter = $delimiter;
- }
-
function addWidgets()
{
Piwik_AddWidget( 'Referers', 'getKeywords', Piwik_Translate('Referers_WidgetKeywords'));
diff --git a/tests/core/ArchiveProcessing/Day.test.php b/tests/core/ArchiveProcessing/Day.test.php
index 630d415a0a..ec0f7305b7 100644
--- a/tests/core/ArchiveProcessing/Day.test.php
+++ b/tests/core/ArchiveProcessing/Day.test.php
@@ -245,58 +245,6 @@ class Test_Piwik_ArchiveProcessing_Day extends UnitTestCase
$r1->setTable($table);
$r2 = new Piwik_DataTable_Renderer_Console();
$r2->setTable($tableGenerated);
-// echo "r1=".$r1;
-// echo "r2=".$r2;
-
$this->assertTrue(Piwik_DataTable::isEqual($table,$tableGenerated));
}
-
-
- /*
- public function test_getActionCategoryFromName_normal()
- {
- $name = 'DGgieqho gea ga ae gae / 3145245 / geq geqa ga eag ae';
-
- $expected = array(
- 'DGgieqho gea ga ae gae',
- '3145245',
- 'geq geqa ga eag ae'
- );
- Piwik_ArchiveProcessing_Day::setCategoryDelimiter('/');
- $this->assertEqual( Piwik_ArchiveProcessing_Day::getActionCategoryFromName($name),
- $expected
- );
- }
-
- public function test_getActionCategoryFromName_emptyCat()
- {
- $name = '// / / /DGgieqho gea ga ae gae / 314//5245 / geq geqa ga eag ae/ ';
-
- $expected = array(
- 'DGgieqho gea ga ae gae',
- '314',
- '5245',
- 'geq geqa ga eag ae'
- );
- Piwik_ArchiveProcessing_Day::setCategoryDelimiter('/');
- $this->assertEqual( Piwik_ArchiveProcessing_Day::getActionCategoryFromName($name),
- $expected
- );
- }
- public function test_getActionCategoryFromName_strangeChar()
- {
- $name = '// / / / £$%^&*())(&*&%}{~@:>897864564DGgieqho gea ga ae gae / 314//5245 / geq geqa ga eag ae/ ';
-
- $expected = array(
- '£$%^&*())(&*&%}{~@:>897864564DGgieqho gea ga ae gae',
- '314',
- '5245',
- 'geq geqa ga eag ae'
- );
- Piwik_ArchiveProcessing_Day::setCategoryDelimiter('/');
- $this->assertEqual( Piwik_ArchiveProcessing_Day::getActionCategoryFromName($name),
- $expected
- );
- }*/
-
}
diff --git a/tests/core/Common.test.php b/tests/core/Common.test.php
index f39c8dd7f6..e3aa6cd022 100755
--- a/tests/core/Common.test.php
+++ b/tests/core/Common.test.php
@@ -52,6 +52,8 @@ class Test_Piwik_Common extends UnitTestCase
'/\/\/\/\/\/\\\http://test.com////',
'jmleslangues.php',
'http://',
+ ' http://',
+ 'testhttp://test.com'
);
foreach($notValid as $url)
diff --git a/tests/core/Tracker/Action.test.php b/tests/core/Tracker/Action.test.php
new file mode 100644
index 0000000000..f18d28abbc
--- /dev/null
+++ b/tests/core/Tracker/Action.test.php
@@ -0,0 +1,102 @@
+<?php
+if(!defined("PATH_TEST_TO_ROOT")) {
+ define('PATH_TEST_TO_ROOT', getcwd().'/../../..');
+}
+if(!defined('CONFIG_TEST_INCLUDED'))
+{
+ require_once PATH_TEST_TO_ROOT . "/tests/config_test.php";
+}
+
+require_once 'Tracker/Action.php';
+require_once 'Tracker/Config.php';
+class Test_Piwik_TrackerAction extends UnitTestCase
+{
+ function test_extractUrlAndActionNameFromRequest()
+ {
+ $userFile = PATH_TEST_TO_ROOT . '/tests/resources/Tracker/Action.config.ini.php';
+ $config = Piwik_Tracker_Config::getInstance();
+ $config->init($userFile);
+
+ $action = new Test_Piwik_TrackerAction_extractUrlAndActionNameFromRequest();
+
+ $tests = array(
+ // outlinks
+ array(
+ 'request' => array( 'link' => 'http://example.org'),
+ 'expected' => array( 'name' => 'http://example.org',
+ 'url' => 'http://example.org',
+ 'type' => Piwik_Tracker_Action::TYPE_OUTLINK),
+ ),
+ // keep the case in urls, but trim
+ array(
+ 'request' => array( 'link' => ' http://example.org/Category/Test/ '),
+ 'expected' => array( 'name' => 'http://example.org/Category/Test/',
+ 'url' => 'http://example.org/Category/Test/',
+ 'type' => Piwik_Tracker_Action::TYPE_OUTLINK),
+ ),
+
+ // downloads
+ array(
+ 'request' => array( 'download' => 'http://example.org/*$test.zip'),
+ 'expected' => array( 'name' => 'http://example.org/*$test.zip',
+ 'url' => 'http://example.org/*$test.zip',
+ 'type' => Piwik_Tracker_Action::TYPE_DOWNLOAD),
+ ),
+ // keep the case and multiple / in urls
+ array(
+ 'request' => array( 'download' => 'http://example.org/CATEGORY/test///test.pdf'),
+ 'expected' => array( 'name' => 'http://example.org/CATEGORY/test///test.pdf',
+ 'url' => 'http://example.org/CATEGORY/test///test.pdf',
+ 'type' => Piwik_Tracker_Action::TYPE_DOWNLOAD),
+ ),
+
+ // page view
+ array(
+ 'request' => array( 'url' => 'http://example.org/'),
+ 'expected' => array( 'name' => 'index',
+ 'url' => 'http://example.org/',
+ 'type' => Piwik_Tracker_Action::TYPE_ACTION),
+ ),
+ array(
+ 'request' => array( 'url' => 'http://example.org/CATEGORY/'),
+ 'expected' => array( 'name' => 'CATEGORY/index',
+ 'url' => 'http://example.org/CATEGORY/',
+ 'type' => Piwik_Tracker_Action::TYPE_ACTION),
+ ),
+ array(
+ 'request' => array( 'url' => 'http://example.org/category/',
+ 'action_name' => 'custom name with/one delimiter/two delimiters/'),
+ 'expected' => array( 'name' => 'custom name with/one delimiter/two delimiters',
+ 'url' => 'http://example.org/category/',
+ 'type' => Piwik_Tracker_Action::TYPE_ACTION),
+ ),
+ array(
+ 'request' => array( 'url' => 'http://example.org/category/',
+ 'action_name' => 'http://custom action name look like url/'),
+ 'expected' => array( 'name' => 'http:/custom action name look like url',
+ 'url' => 'http://example.org/category/',
+ 'type' => Piwik_Tracker_Action::TYPE_ACTION),
+ ),
+ // testing: delete tab, trimmed, not strtolowered
+ array(
+ 'request' => array( 'url' => "http://example.org/category/test///test wOw "),
+ 'expected' => array( 'name' => 'category/test/test wOw',
+ 'url' => 'http://example.org/category/test///test wOw',
+ 'type' => Piwik_Tracker_Action::TYPE_ACTION),
+ ),
+ );
+ foreach($tests as $test) {
+ $request = $test['request'];
+ $expected = $test['expected'];
+ $action->setRequest($request);
+ $this->assertEqual($action->public_extractUrlAndActionNameFromRequest(), $expected);
+ }
+ }
+}
+
+class Test_Piwik_TrackerAction_extractUrlAndActionNameFromRequest extends Piwik_Tracker_Action{
+ public function public_extractUrlAndActionNameFromRequest()
+ {
+ return $this->extractUrlAndActionNameFromRequest();
+ }
+} \ No newline at end of file
diff --git a/tests/resources/Tracker/Action.config.ini.php b/tests/resources/Tracker/Action.config.ini.php
new file mode 100644
index 0000000000..c46de41d96
--- /dev/null
+++ b/tests/resources/Tracker/Action.config.ini.php
@@ -0,0 +1,5 @@
+[Tracker]
+action_category_delimiter = /
+download_url_var_name = download
+outlink_url_var_name = link
+