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:
authormattpiwik <matthieu.aubry@gmail.com>2011-01-19 07:24:49 +0300
committermattpiwik <matthieu.aubry@gmail.com>2011-01-19 07:24:49 +0300
commit1afa106695c16ed20888419a67e7812ef77bbd0c (patch)
tree6dbd9b3e7718685b2fffbe535fee213616baeb30 /plugins/CustomVariables/API.php
parenta852b0e89b05ba9bc184586fba0fe242d0cf4f79 (diff)
Refs #1984 - New plugins CustomVariables
* Now possible to track up to 5 Custom variables per Visit. Also, Goal conversions will be reported 'By custom variable name & value' * New report in Visitors > Custom Variables, new CustomVars API * Updated schema * Updated PiwikTracker PHP api to allow setting the name,value pairs Code style * Refatoring some API code, and Archiving queries * Changing text from 'segment' to 'dimension' as this is better description + we want to build actual segmentation later * removing getJs calls in some plugins since they only included sparkline.js, moved to CoreHome git-svn-id: http://dev.piwik.org/svn/trunk@3780 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/CustomVariables/API.php')
-rw-r--r--plugins/CustomVariables/API.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/plugins/CustomVariables/API.php b/plugins/CustomVariables/API.php
new file mode 100644
index 0000000000..e5af3bd21f
--- /dev/null
+++ b/plugins/CustomVariables/API.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ * @version $Id$
+ *
+ * @category Piwik_Plugins
+ * @package Piwik_CustomVariables
+ */
+
+/**
+ *
+ * @package Piwik_CustomVariables
+ */
+class Piwik_CustomVariables_API
+{
+ static private $instance = null;
+
+ static public function getInstance()
+ {
+ if (self::$instance == null)
+ {
+ self::$instance = new self;
+ }
+ return self::$instance;
+ }
+
+ protected function getDataTable($idSite, $period, $date, $expanded, $idSubtable)
+ {
+ $dataTable = Piwik_Archive::getDataTableFromArchive('CustomVariables_valueByName', $idSite, $period, $date, $expanded, $idSubtable);
+ $dataTable->filter('Sort', array(Piwik_Archive::INDEX_NB_VISITS, 'desc', $naturalSort = false, $expanded));
+ $dataTable->queueFilter('ReplaceColumnNames', array($expanded));
+ return $dataTable;
+ }
+
+ public function getCustomVariables($idSite, $period, $date, $expanded = false)
+ {
+ $dataTable = $this->getDataTable($idSite, $period, $date, $expanded, $idSubtable = null);
+ return $dataTable;
+ }
+
+ public function getCustomVariablesValuesFromNameId($idSite, $period, $date, $idSubtable)
+ {
+ $dataTable = $this->getDataTable($idSite, $period, $date, $expanded = false, $idSubtable);
+ return $dataTable;
+ }
+}
+