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-05-20 00:03:24 +0400
committermattpiwik <matthieu.aubry@gmail.com>2011-05-20 00:03:24 +0400
commit3aca2890aa4b1931733c4c536f17c433e163990b (patch)
tree9e40406b9af6766e570b13c37cca13f65ef26383 /plugins/CustomVariables/API.php
parent7391099be195546175817756424075f7fa50a3cf (diff)
Refs #898
* Adding Product page/Category page view tracking via Tracking function: setEcommerceView: function(sku, name, category) This is using the Custom Variables per page, using slot 3/4/5 to track sku/name/category * UPdated PHP tracker + JS tracker + adding tests * Items reports (best SKU/Name/Category) will automatically call the Custom Vars API and enrich the items reports with "Visits", "Conversion rate" * Updating integration tests + fixing bug when item is deleted from Cart, then added again (or purchased) git-svn-id: http://dev.piwik.org/svn/trunk@4723 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/CustomVariables/API.php')
-rw-r--r--plugins/CustomVariables/API.php32
1 files changed, 31 insertions, 1 deletions
diff --git a/plugins/CustomVariables/API.php b/plugins/CustomVariables/API.php
index bb9b68b330..3969d53d84 100644
--- a/plugins/CustomVariables/API.php
+++ b/plugins/CustomVariables/API.php
@@ -19,6 +19,9 @@ class Piwik_CustomVariables_API
{
static private $instance = null;
+ /**
+ * @return Piwik_CustomVariables_API
+ */
static public function getInstance()
{
if (self::$instance == null)
@@ -28,6 +31,9 @@ class Piwik_CustomVariables_API
return self::$instance;
}
+ /**
+ * @return Piwik_DataTable
+ */
protected function getDataTable($idSite, $period, $date, $segment, $expanded, $idSubtable)
{
$dataTable = Piwik_Archive::getDataTableFromArchive('CustomVariables_valueByName', $idSite, $period, $date, $segment, $expanded, $idSubtable);
@@ -36,12 +42,36 @@ class Piwik_CustomVariables_API
return $dataTable;
}
- public function getCustomVariables($idSite, $period, $date, $segment = false, $expanded = false)
+ /**
+ * @return Piwik_DataTable
+ */
+ public function getCustomVariables($idSite, $period, $date, $segment = false, $expanded = false, $_leavePiwikCoreVariables = false)
{
$dataTable = $this->getDataTable($idSite, $period, $date, $segment, $expanded, $idSubtable = null);
+
+ if($dataTable instanceof Piwik_DataTable
+ && !$_leavePiwikCoreVariables)
+ {
+ $mapping = array(
+ '_pks' => Piwik_Translate('Goals_ProductSKU'),
+ '_pkn' => Piwik_Translate('Goals_ProductName'),
+ '_pkc' => Piwik_Translate('Goals_ProductCategory'),
+ );
+ foreach($mapping as $core => $friendly)
+ {
+ $row = $dataTable->getRowFromLabel($core);
+ if($row)
+ {
+ $row->setColumn('label', $friendly);
+ }
+ }
+ }
return $dataTable;
}
+ /**
+ * @return Piwik_DataTable
+ */
public function getCustomVariablesValuesFromNameId($idSite, $period, $date, $idSubtable, $segment = false)
{
$dataTable = $this->getDataTable($idSite, $period, $date, $segment, $expanded = false, $idSubtable);