From 8a870ea7e9cad301668075307b07f22ae70ff382 Mon Sep 17 00:00:00 2001
From: benakamoorthi <benaka.moorthi@gmail.com>
Date: Thu, 16 Aug 2012 22:37:38 +0000
Subject: [PATCH] Fixes #2742, added support for getting subtable reports
 through metadata API and added necessary metadata so existing subtable
 reports can be obtained.

Notes:

  * Added ability to test subtable API actions.
  * Added subtable metadata to methods in Actions, CustomVariables & Referers APIs.


git-svn-id: http://dev.piwik.org/svn/trunk@6800 59fd770c-687e-43c8-a1e3-f5a4ff64c105
---
 plugins/API/API.php                           | 24 ++++--
 plugins/Actions/Actions.php                   |  8 ++
 plugins/CustomVariables/CustomVariables.php   | 33 +++++---
 plugins/Referers/Referers.php                 | 54 ++++++++++++-
 .../Integration/OneVisitorTwoVisitsTest.php   |  9 +++
 .../TwoVisitsWithCustomVariablesTest.php      |  9 +++
 tests/PHPUnit/IntegrationTestCase.php         | 41 +++++++++-
 tests/integration/CsvExport.test.php          |  5 ++
 ..._DateIsLastN_MetadataAndNormalAPI.test.php |  5 ++
 .../TwoVisitsWithCustomVariables.test.php     | 15 ++++
 ...thCustomVariables_SegmentContains.test.php |  5 ++
 ...iables_SegmentMatchALL_NoGoalData.test.php |  5 ++
 ...hCustomVariables_SegmentMatchNONE.test.php |  5 ++
 ...Variables_SegmentMatchVisitorType.test.php |  5 ++
 ..._subtable__API.getProcessedReport_week.xml | 58 ++++++++++++++
 ...Site_lastN__API.getProcessedReport_day.xml |  1 +
 ...Site_lastN__API.getProcessedReport_day.xml |  1 +
 ...Site_lastN__API.getProcessedReport_day.xml |  1 +
 ...Site_lastN__API.getProcessedReport_day.xml |  2 +-
 ...ortMetadata__API.getReportMetadata_day.xml | 30 ++++---
 ...__subtable__API.getProcessedReport_day.xml | 78 +++++++++++++++++++
 21 files changed, 357 insertions(+), 37 deletions(-)
 create mode 100755 tests/integration/expected/test_OneVisitorTwoVisits__subtable__API.getProcessedReport_week.xml
 create mode 100755 tests/integration/expected/test_twoVisitsWithCustomVariables__subtable__API.getProcessedReport_day.xml

diff --git a/plugins/API/API.php b/plugins/API/API.php
index 4cd995dc23..fe28e96be8 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -473,10 +473,10 @@ class Piwik_API_API
      * matching optional API parameters.
      */
 	public function getMetadata($idSite, $apiModule, $apiAction, $apiParameters = array(), $language = false,
-								$period = false, $date = false, $hideMetricsDoc = false)
+								$period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false)
     {
     	Piwik_Translate::getInstance()->reloadLanguage($language);
-    	$reportsMetadata = $this->getReportMetadata($idSite, $period, $date, $hideMetricsDoc);
+    	$reportsMetadata = $this->getReportMetadata($idSite, $period, $date, $hideMetricsDoc, $showSubtableReports);
     	
     	foreach($reportsMetadata as $report)
     	{
@@ -517,7 +517,8 @@ class Piwik_API_API
 	 * @param string $idSites Comma separated list of website Ids
 	 * @return array
 	 */
-	public function getReportMetadata($idSites = '', $period = false, $date = false, $hideMetricsDoc = false)
+	public function getReportMetadata($idSites = '', $period = false, $date = false, $hideMetricsDoc = false,
+									  $showSubtableReports = false)
 	{
 		$idSites = Piwik_Site::getIdSitesFromIdSitesString($idSites);
 		if(!empty($idSites))
@@ -610,6 +611,18 @@ class Piwik_API_API
 			unset($availableReport['order']);
 		}
 		
+		// remove subtable reports
+		if (!$showSubtableReports)
+		{
+			foreach ($availableReports as $idx => $report)
+			{
+				if (isset($report['isSubtableReport']) && $report['isSubtableReport'])
+				{
+					unset($availableReports[$idx]);
+				}
+			}
+		}
+		
 		return $availableReports;
 	}
 	
@@ -653,7 +666,7 @@ class Piwik_API_API
 
 	public function getProcessedReport( $idSite, $period, $date, $apiModule, $apiAction, $segment = false,
 										$apiParameters = false, $idGoal = false, $language = false,
-										$showTimer = true, $hideMetricsDoc = false)
+										$showTimer = true, $hideMetricsDoc = false, $idSubtable = false)
     {
     	$timer = new Piwik_Timer();
     	if($apiParameters === false)
@@ -667,7 +680,7 @@ class Piwik_API_API
 		}
         // Is this report found in the Metadata available reports?
         $reportMetadata = $this->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language,
-        									 $period, $date, $hideMetricsDoc);
+        									 $period, $date, $hideMetricsDoc, $showSubtableReports = true);
         if(empty($reportMetadata))
         {
         	throw new Exception("Requested report $apiModule.$apiAction for Website id=$idSite not found in the list of available reports. \n");
@@ -683,6 +696,7 @@ class Piwik_API_API
 			'format' => 'original',
 			'serialize' => '0',
 			'language' => $language,
+			'idSubtable' => $idSubtable,
 		));
 		if(!empty($segment)) $parameters['segment'] = $segment;
 		
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php
index 9672070d6e..1bfc8c04bb 100644
--- a/plugins/Actions/Actions.php
+++ b/plugins/Actions/Actions.php
@@ -243,6 +243,7 @@ class Piwik_Actions extends Piwik_Plugin
 			'documentation' => Piwik_Translate('Actions_PagesReportDocumentation', '<br />')
 					.'<br />'.Piwik_Translate('General_UsePlusMinusIconsDocumentation'),
 			'processedMetrics' => false,
+			'actionToLoadSubTables' => 'getPageUrls',
 			'order' => 2
 		);
 		
@@ -266,6 +267,7 @@ class Piwik_Actions extends Piwik_Plugin
 			'documentation' => Piwik_Translate('Actions_EntryPagesReportDocumentation', '<br />')
 					.' '.Piwik_Translate('General_UsePlusMinusIconsDocumentation'),
 			'processedMetrics' => false,
+			'actionToLoadSubTables' => 'getEntryPageUrls',
 			'order' => 3
 		);
 		
@@ -289,6 +291,7 @@ class Piwik_Actions extends Piwik_Plugin
 			'documentation' => Piwik_Translate('Actions_ExitPagesReportDocumentation', '<br />')
 					.' '.Piwik_Translate('General_UsePlusMinusIconsDocumentation'),
 			'processedMetrics' => false,
+			'actionToLoadSubTables' => 'getExitPageUrls',
 			'order' => 4
 		);
 		
@@ -303,6 +306,7 @@ class Piwik_Actions extends Piwik_Plugin
 			'metricsDocumentation' => $documentation,
 			'documentation' => Piwik_Translate('Actions_PageTitlesReportDocumentation', array('<br />', htmlentities('<title>'))),
 			'processedMetrics' => false,
+			'actionToLoadSubTables' => 'getPageTitles',
 			'order' => 5,
 			
 		);
@@ -327,6 +331,7 @@ class Piwik_Actions extends Piwik_Plugin
 			'documentation' => Piwik_Translate('Actions_ExitPageTitlesReportDocumentation', '<br />')
 					.' '.Piwik_Translate('General_UsePlusMinusIconsDocumentation'),
 			'processedMetrics' => false,
+			'actionToLoadSubTables' => 'getEntryPageTitles',
 			'order' => 6
 		);
 		
@@ -350,6 +355,7 @@ class Piwik_Actions extends Piwik_Plugin
 			'documentation' => Piwik_Translate('Actions_EntryPageTitlesReportDocumentation', '<br />')
 					.' '.Piwik_Translate('General_UsePlusMinusIconsDocumentation'),
 			'processedMetrics' => false,
+			'actionToLoadSubTables' => 'getExitPageTitles',
 			'order' => 7
 		);
     	
@@ -374,6 +380,7 @@ class Piwik_Actions extends Piwik_Plugin
 					.Piwik_Translate('Actions_OutlinkDocumentation').'<br />'
 					.Piwik_Translate('General_UsePlusMinusIconsDocumentation'),
 			'processedMetrics' => false,
+			'actionToLoadSubTables' => 'getOutlinks',
 			'order' => 8,
 		);
 		
@@ -391,6 +398,7 @@ class Piwik_Actions extends Piwik_Plugin
 			'metricsDocumentation' => $documentation,
 			'documentation' => Piwik_Translate('Actions_DownloadsReportDocumentation', '<br />'),
 			'processedMetrics' => false,
+			'actionToLoadSubTables' => 'getDownloads',
 			'order' => 9,
 		);
 	}
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php
index 0da2418208..4d83a0f27e 100644
--- a/plugins/CustomVariables/CustomVariables.php
+++ b/plugins/CustomVariables/CustomVariables.php
@@ -65,18 +65,27 @@ class Piwik_CustomVariables extends Piwik_Plugin
 	public function getReportMetadata($notification)
 	{
 		$reports = &$notification->getNotificationObject();
-		$reports = array_merge($reports, array(
-		array(
-        			'category'  => Piwik_Translate('General_Visitors'),
-        			'name'   => Piwik_Translate('CustomVariables_CustomVariables'),
-        			'module' => 'CustomVariables',
-        			'action' => 'getCustomVariables',
-					'actionToLoadSubTables' => 'getCustomVariablesValuesFromNameId',
-        			'dimension' => Piwik_Translate('CustomVariables_ColumnCustomVariableName'),
-        			'documentation' => Piwik_Translate('CustomVariables_CustomVariablesReportDocumentation', array('<br />', '<a href="http://piwik.org/docs/custom-variables/" target="_blank">', '</a>')),
-        			'order' => 10
-		),
-		));
+		
+		$documentation = Piwik_Translate('CustomVariables_CustomVariablesReportDocumentation',
+			array('<br />', '<a href="http://piwik.org/docs/custom-variables/" target="_blank">', '</a>'));
+		
+		$reports[] = array( 'category'  => Piwik_Translate('General_Visitors'),
+							'name'   => Piwik_Translate('CustomVariables_CustomVariables'),
+							'module' => 'CustomVariables',
+							'action' => 'getCustomVariables',
+							'actionToLoadSubTables' => 'getCustomVariablesValuesFromNameId',
+							'dimension' => Piwik_Translate('CustomVariables_ColumnCustomVariableName'),
+							'documentation' => $documentation,
+							'order' => 10 );
+		
+		$reports[] = array( 'category' => Piwik_Translate('General_Visitors'),
+							'name' => Piwik_Translate('CustomVariables_CustomVariables'),
+							'module' => 'CustomVariables',
+							'action' => 'getCustomVariablesValuesFromNameId',
+							'dimension' => Piwik_Translate('CustomVariables_ColumnCustomVariableValue'),
+							'documentation' => $documentation,
+							'isSubtableReport' => true,
+							'order' => 15 );
 	}
 
 	/**
diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php
index 884e0bda98..6537c6052b 100644
--- a/plugins/Referers/Referers.php
+++ b/plugins/Referers/Referers.php
@@ -74,6 +74,7 @@ class Piwik_Referers extends Piwik_Plugin
         							array('<br />', '&quot;'.Piwik_Translate('Referers_SubmenuCampaigns').'&quot;')),
         			'order' => 1,
         		),
+        		
         		array(
         			'category' => Piwik_Translate('Referers_Referers'),
         			'name'   => Piwik_Translate('Referers_Keywords'),
@@ -82,39 +83,84 @@ class Piwik_Referers extends Piwik_Plugin
 					'actionToLoadSubTables' => 'getSearchEnginesFromKeywordId',
         			'dimension' => Piwik_Translate('Referers_ColumnKeyword'),
         			'documentation' => Piwik_Translate('Referers_KeywordsReportDocumentation', '<br />'),
+        			'actionToLoadSubTables' => 'getSearchEnginesFromKeywordId',
         			'order' => 3,
         		),
+				array( // subtable report
+					'category' => Piwik_Translate('Referers_Referers'),
+					'name'   => Piwik_Translate('Referers_Keywords'),
+					'module' => 'Referers',
+					'action' => 'getSearchEnginesFromKeywordId',
+					'dimension' => Piwik_Translate('Referers_ColumnSearchEngine'),
+					'documentation' => Piwik_Translate('Referers_KeywordsReportDocumentation', '<br />'),
+					'isSubtableReport' => true,
+					'order' => 4
+				),
+				
         		array(
         			'category'  => Piwik_Translate('Referers_Referers'),
         			'name'   => Piwik_Translate('Referers_Websites'),
         			'module' => 'Referers',
         			'action' => 'getWebsites',
-					'actionToLoadSubTables' => 'getUrlsFromWebsiteId',
         			'dimension' => Piwik_Translate('Referers_ColumnWebsite'),
         			'documentation' => Piwik_Translate('Referers_WebsitesReportDocumentation', '<br />'),
+					'actionToLoadSubTables' => 'getUrlsFromWebsiteId',
         			'order' => 5
-        		),
+				),
+				array( // subtable report
+					'category' => Piwik_Translate('Referers_Referers'),
+					'name' => Piwik_Translate('Referers_Websites'),
+					'module' => 'Referers',
+					'action' => 'getUrlsFromWebsiteId',
+					'dimension' => Piwik_Translate('Referers_ColumnWebsitePage'),
+					'documentation' => Piwik_Translate('Referers_WebsitesReportDocumentation', '<br />'),
+					'isSubtableReport' => true,
+					'order' => 6,
+				),
+				
         		array(
         			'category'  => Piwik_Translate('Referers_Referers'),
         			'name'   => Piwik_Translate('Referers_SearchEngines'),
         			'module' => 'Referers',
         			'action' => 'getSearchEngines',
-					'actionToLoadSubTables' => 'getKeywordsFromSearchEngineId',
         			'dimension' => Piwik_Translate('Referers_ColumnSearchEngine'),
         			'documentation' => Piwik_Translate('Referers_SearchEnginesReportDocumentation', '<br />'),
+					'actionToLoadSubTables' => 'getKeywordsFromSearchEngineId',
         			'order' => 7,
         		),
+				array( // subtable report
+					'category'  => Piwik_Translate('Referers_Referers'),
+					'name'   => Piwik_Translate('Referers_SearchEngines'),
+					'module' => 'Referers',
+					'action' => 'getKeywordsFromSearchEngineId',
+					'dimension' => Piwik_Translate('Referers_ColumnKeyword'),
+					'documentation' => Piwik_Translate('Referers_SearchEnginesReportDocumentation', '<br />'),
+					'isSubtableReport' => true,
+					'order' => 8,
+				),
+				
         		array(
         			'category'  => Piwik_Translate('Referers_Referers'),
         			'name'   => Piwik_Translate('Referers_Campaigns'),
         			'module' => 'Referers',
         			'action' => 'getCampaigns',
-					'actionToLoadSubTables' => 'getKeywordsFromCampaignId',
         			'dimension' => Piwik_Translate('Referers_ColumnCampaign'),
         			'documentation' => Piwik_Translate('Referers_CampaignsReportDocumentation',
         					array('<br />', '<a href="http://piwik.org/docs/tracking-campaigns/" target="_blank">', '</a>')),
+					'actionToLoadSubTables' => 'getKeywordsFromCampaignId',
         			'order' => 9,
         		),
+				array( // subtable report
+					'category' => Piwik_Translate('Referers_Referers'),
+					'name' => Piwik_Translate('Referers_Campaigns'),
+					'module' => 'Referers',
+					'action' => 'getKeywordsFromCampaignId',
+					'dimension' => Piwik_Translate('Referers_ColumnKeyword'),
+					'documentation' => Piwik_Translate('Referers_CampaignsReportDocumentation',
+						array('<br />', '<a href="http://piwik.org/docs/tracking-campaigns/" target="_blank">', '</a>')),
+					'isSubtableReport' => true,
+					'order' => 10,
+				),
     	));
 	}
 
diff --git a/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php b/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
index 0763e6eef8..933a0a1ab4 100755
--- a/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
+++ b/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
@@ -68,6 +68,15 @@ class Test_Piwik_Integration_OneVisitorTwoVisits extends IntegrationTestCase
                                    'testSuffix'             => '_csv')),
 
             array('API.getBulkRequest', array('otherRequestParameters' => array('urls' => $bulkUrls))),
+            
+            // test API.getProcessedReport w/ report that is its own 'actionToLoadSubTables'
+            array('API.getProcessedReport', array('idSite'		  => self::$idSite,
+            									  'date'		  => self::$dateTime,
+            									  'periods'		  => array('week'),
+            									  'apiModule'	  => 'Actions',
+            									  'apiAction'	  => 'getPageUrls',
+            									  'supertableApi' => 'Actions.getPageUrls',
+            									  'testSuffix'	  => '__subtable')),
         );
     }
 
diff --git a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariablesTest.php b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariablesTest.php
index 395984cd58..d9c771aac2 100755
--- a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariablesTest.php
+++ b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariablesTest.php
@@ -45,6 +45,15 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables extends IntegrationTes
                                     'date'         => self::$dateTime,
                                     'periods'      => array('day', 'week'),
                                     'setDateLastN' => true)),
+			
+			// test getProcessedReport w/ custom variables subtable
+			array('API.getProcessedReport', array('idSite' => self::$idSite,
+												  'date' => self::$dateTime,
+												  'periods' => 'day',
+												  'apiModule' => 'CustomVariables',
+												  'apiAction' => 'getCustomVariablesValuesFromNameId',
+												  'supertableApi' => 'CustomVariables.getCustomVariables',
+												  'testSuffix' => '__subtable' )),
         );
 
         return $return;
diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php
index 4261f7a72b..1566ad1391 100755
--- a/tests/PHPUnit/IntegrationTestCase.php
+++ b/tests/PHPUnit/IntegrationTestCase.php
@@ -286,7 +286,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
      *
      * @return array of API URLs query strings
      */
-    protected function generateUrlsApi( $parametersToSet, $formats, $periods, $setDateLastN = false, $language = false, $segment = false )
+    protected function generateUrlsApi( $parametersToSet, $formats, $periods, $supertableApi = false, $setDateLastN = false, $language = false, $segment = false )
     {
         // Get the URLs to query against the API for all functions starting with get*
         $skipped = $requestUrls = array();
@@ -347,6 +347,38 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
                     {
                         $parametersToSet['language'] = $language;
                     }
+                    
+                    // set idSubtable if subtable API is set
+                    if ($supertableApi !== false)
+                    {
+                    	$request = new Piwik_API_Request(array(
+                    		'module' => 'API',
+                    		'method' => $supertableApi,
+                    		'idSite' => $parametersToSet['idSite'],
+                    		'period' => $parametersToSet['period'],
+                    		'date' => $parametersToSet['date'],
+                    		'format' => 'php',
+                    		'serialize' => 0,
+                    	));
+                    	
+                    	// find first row w/ subtable
+                    	foreach ($request->process() as $row)
+                    	{
+                    		if (isset($row['idsubdatatable']))
+                    		{
+                    			$parametersToSet['idSubtable'] = $row['idsubdatatable'];
+                    			break;
+                    		}
+                    	}
+                    	
+                    	// if no subtable found, throw
+                    	if (!isset($parametersToSet['idSubtable']))
+                    	{
+	                    	throw new Exception(
+	                    		"Cannot find subtable to load for $apiId in $supertableApi.");
+                    	}
+                    }
+                    
                     // Generate for each specified format
                     foreach($formats as $format)
                     {
@@ -400,7 +432,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
      */
     protected function _generateApiUrls($formats = 'xml', $idSite = false, $dateTime = false, $periods = false,
                                          $setDateLastN = false, $language = false, $segment = false, $visitorId = false, $abandonedCarts = false,
-                                         $idGoal = false, $apiModule = false, $apiAction = false, $otherRequestParameters = array())
+                                         $idGoal = false, $apiModule = false, $apiAction = false, $otherRequestParameters = array(), $supertableApi = false)
     {
         list($pathProcessed, $pathExpected) = $this->getProcessedAndExpectedDirs();
 
@@ -465,7 +497,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
             $parametersToSet['idGoal'] = $idGoal;
         }
 
-        $requestUrls = $this->generateUrlsApi($parametersToSet, $formats, $periods, $setDateLastN, $language, $segment);
+        $requestUrls = $this->generateUrlsApi($parametersToSet, $formats, $periods, $supertableApi, $setDateLastN, $language, $segment);
         return $requestUrls;
     }
 
@@ -715,7 +747,8 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
                     isset($params['idGoal']) ? $params['idGoal'] : false,
                     isset($params['apiModule']) ? $params['apiModule'] : false,
                     isset($params['apiAction']) ? $params['apiAction'] : false,
-                    isset($params['otherRequestParameters']) ? $params['otherRequestParameters'] : array());
+                    isset($params['otherRequestParameters']) ? $params['otherRequestParameters'] : array(),
+                    isset($params['supertableApi']) ? $params['supertableApi'] : false);
 
         foreach($requestUrls as $apiId => $requestUrl)
         {
diff --git a/tests/integration/CsvExport.test.php b/tests/integration/CsvExport.test.php
index a4394c0401..83276c651e 100755
--- a/tests/integration/CsvExport.test.php
+++ b/tests/integration/CsvExport.test.php
@@ -41,6 +41,11 @@ class Test_Piwik_Integration_CsvExport extends Test_Piwik_Integration_TwoVisitsW
 		);
 	}
 
+	public function getAnotherApiToTest()
+	{
+		return array();
+	}
+
 	public function getControllerActionsToTest()
 	{
 		return array();
diff --git a/tests/integration/PeriodIsRange_DateIsLastN_MetadataAndNormalAPI.test.php b/tests/integration/PeriodIsRange_DateIsLastN_MetadataAndNormalAPI.test.php
index 94a8f819db..c68c20d76e 100755
--- a/tests/integration/PeriodIsRange_DateIsLastN_MetadataAndNormalAPI.test.php
+++ b/tests/integration/PeriodIsRange_DateIsLastN_MetadataAndNormalAPI.test.php
@@ -57,6 +57,11 @@ class Test_Piwik_Integration_PeriodIsRange_DateIsLastN_MetadataAndNormalAPI exte
 		return $result;
 	}
 
+	public function getAnotherApiToTest()
+	{
+		return array();
+	}
+
 	public function getControllerActionsToTest()
 	{
 		return array();
diff --git a/tests/integration/TwoVisitsWithCustomVariables.test.php b/tests/integration/TwoVisitsWithCustomVariables.test.php
index bdd91a753c..da4c42f4ee 100755
--- a/tests/integration/TwoVisitsWithCustomVariables.test.php
+++ b/tests/integration/TwoVisitsWithCustomVariables.test.php
@@ -35,6 +35,21 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables extends Test_Integrati
 		return $return;
 	}
 
+	public function getAnotherApiToTest()
+	{
+		$table = Piwik_CustomVariables_API::getInstance()->getCustomVariables($this->idSite, 'day', '2010-01-03');
+		$idsubtable = reset($table->getRows())->getIdSubDataTable();
+
+		// test getProcessedReport w/ custom variables
+		return array(
+					array('API.getProcessedReport', array('idSite' => $this->idSite, 'date' => $this->dateTime,
+														  'periods' => 'day', 'apiModule' => 'CustomVariables',
+														  'apiAction' => 'getCustomVariablesValuesFromNameId',
+														  'testSuffix' => '__subtable',
+														  'otherRequestParameters' => array('idSubtable' => $idsubtable) )),
+		);
+	}
+
 	public function getControllerActionsToTest()
 	{
 		return array();
diff --git a/tests/integration/TwoVisitsWithCustomVariables_SegmentContains.test.php b/tests/integration/TwoVisitsWithCustomVariables_SegmentContains.test.php
index 194b1aaa4c..1825a63464 100644
--- a/tests/integration/TwoVisitsWithCustomVariables_SegmentContains.test.php
+++ b/tests/integration/TwoVisitsWithCustomVariables_SegmentContains.test.php
@@ -44,6 +44,11 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentContains extend
 		return $return;
 	}
 
+	public function getAnotherApiToTest()
+	{
+		return array();
+	}
+
 	public function getControllerActionsToTest()
 	{
 		return array();
diff --git a/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoalData.test.php b/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoalData.test.php
index a72f061394..073fed65d0 100755
--- a/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoalData.test.php
+++ b/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoalData.test.php
@@ -32,6 +32,11 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoal
 		);
 	}
 
+	public function getAnotherApiToTest()
+	{
+		return array();
+	}
+
 	public function getControllerActionsToTest()
 	{
 		return array();
diff --git a/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchNONE.test.php b/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchNONE.test.php
index 027afc5c11..51fb22b68a 100755
--- a/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchNONE.test.php
+++ b/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchNONE.test.php
@@ -68,6 +68,11 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentMatchNONE exten
 		return $this->segment;
 	}
 
+	public function getAnotherApiToTest()
+	{
+		return array();
+	}
+
 	public function getControllerActionsToTest()
 	{
 		return array();
diff --git a/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorType.test.php b/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorType.test.php
index 3a6b37e17a..ef57ca6691 100755
--- a/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorType.test.php
+++ b/tests/integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorType.test.php
@@ -48,6 +48,11 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentMatchVisitorTyp
 	{
 		return array();
 	}
+
+	public function getAnotherApiToTest()
+	{
+		return array();
+	}
 	
 	public function getOutputPrefix()
 	{
diff --git a/tests/integration/expected/test_OneVisitorTwoVisits__subtable__API.getProcessedReport_week.xml b/tests/integration/expected/test_OneVisitorTwoVisits__subtable__API.getProcessedReport_week.xml
new file mode 100755
index 0000000000..d3ae531063
--- /dev/null
+++ b/tests/integration/expected/test_OneVisitorTwoVisits__subtable__API.getProcessedReport_week.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+	<website>new name</website>
+	<prettyDate>Week 1 March - 7 March 2010</prettyDate>
+	<metadata>
+		<category>Actions</category>
+		<name>Page URLs</name>
+		<module>Actions</module>
+		<action>getPageUrls</action>
+		<dimension>Page URL</dimension>
+		<metrics>
+			<nb_hits>Pageviews</nb_hits>
+			<nb_visits>Unique Pageviews</nb_visits>
+			<bounce_rate>Bounce Rate</bounce_rate>
+			<avg_time_on_page>Avg. time on page</avg_time_on_page>
+			<exit_rate>Exit rate</exit_rate>
+
+		</metrics>
+		<metricsDocumentation>
+			<nb_hits>The number of times this page was visited.</nb_hits>
+			<nb_visits>The number of visits that included this page. If a page was viewed multiple times during one visit, it is only counted once.</nb_visits>
+			<bounce_rate>The percentage of visits that started on this page and left the website straight away.</bounce_rate>
+			<avg_time_on_page>The average amount of time visitors spent on this page (only the page, not the entire website).</avg_time_on_page>
+			<exit_rate>The percentage of visits that left the website after viewing this page.</exit_rate>
+
+		</metricsDocumentation>
+		<documentation>This report contains information about the page URLs that have been visited. &lt;br /&gt; The table is organized hierarchically, the URLs are displayed as a folder structure.&lt;br /&gt;Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getPageUrls</actionToLoadSubTables>
+		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getPageUrls&amp;period=week&amp;date=2010-03-06</imageGraphUrl>
+		<uniqueId>Actions_getPageUrls</uniqueId>
+
+	</metadata>
+	<columns>
+		<label>Page URL</label>
+		<nb_hits>Pageviews</nb_hits>
+		<nb_visits>Unique Pageviews</nb_visits>
+		<bounce_rate>Bounce Rate</bounce_rate>
+		<avg_time_on_page>Avg. time on page</avg_time_on_page>
+		<exit_rate>Exit rate</exit_rate>
+
+	</columns>
+	<reportData>
+		<row>
+			<label>/purchase.htm</label>
+			<nb_visits>1</nb_visits>
+			<nb_hits>1</nb_hits>
+			<avg_time_on_page>00:00:00</avg_time_on_page>
+			<bounce_rate>100%</bounce_rate>
+			<exit_rate>100%</exit_rate>
+		</row>
+	</reportData>
+	<reportMetadata>
+		<row>
+			<url>http://example.org/store/purchase.htm</url>
+		</row>
+	</reportMetadata>
+
+</result>
\ No newline at end of file
diff --git a/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getOutlinks_firstSite_lastN__API.getProcessedReport_day.xml b/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getOutlinks_firstSite_lastN__API.getProcessedReport_day.xml
index 7874c8bb3a..593064e097 100644
--- a/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getOutlinks_firstSite_lastN__API.getProcessedReport_day.xml
+++ b/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getOutlinks_firstSite_lastN__API.getProcessedReport_day.xml
@@ -19,6 +19,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report shows a hierarchical list of outlink URLs that were clicked by your visitors. An outlink is a link that leads the visitor away from your website (to another domain).&lt;br /&gt;Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getOutlinks</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getOutlinks&amp;period=range&amp;date=2010-01-03%2C2010-01-09</imageGraphUrl>
 		<uniqueId>Actions_getOutlinks</uniqueId>
 
diff --git a/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getPageTitles_firstSite_lastN__API.getProcessedReport_day.xml b/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getPageTitles_firstSite_lastN__API.getProcessedReport_day.xml
index a18fe482f2..5c90ab102a 100644
--- a/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getPageTitles_firstSite_lastN__API.getProcessedReport_day.xml
+++ b/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getPageTitles_firstSite_lastN__API.getProcessedReport_day.xml
@@ -25,6 +25,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report contains information about the titles of the pages that have been visited. &lt;br /&gt; The page title is the HTML &lt;title&gt; Tag that most browsers show in their window title.</documentation>
+		<actionToLoadSubTables>getPageTitles</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getPageTitles&amp;period=range&amp;date=2010-01-03%2C2010-01-09</imageGraphUrl>
 		<uniqueId>Actions_getPageTitles</uniqueId>
 
diff --git a/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getPageUrls_firstSite_lastN__API.getProcessedReport_day.xml b/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getPageUrls_firstSite_lastN__API.getProcessedReport_day.xml
index 3362ad9134..03bb0536a0 100644
--- a/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getPageUrls_firstSite_lastN__API.getProcessedReport_day.xml
+++ b/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Actions.getPageUrls_firstSite_lastN__API.getProcessedReport_day.xml
@@ -25,6 +25,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report contains information about the page URLs that have been visited. &lt;br /&gt; The table is organized hierarchically, the URLs are displayed as a folder structure.&lt;br /&gt;Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getPageUrls</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getPageUrls&amp;period=range&amp;date=2010-01-03%2C2010-01-09</imageGraphUrl>
 		<uniqueId>Actions_getPageUrls</uniqueId>
 
diff --git a/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Referers.getWebsites_firstSite_lastN__API.getProcessedReport_day.xml b/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Referers.getWebsites_firstSite_lastN__API.getProcessedReport_day.xml
index 04c8080709..18eb1fe0ea 100644
--- a/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Referers.getWebsites_firstSite_lastN__API.getProcessedReport_day.xml
+++ b/tests/integration/expected/test_TwoVisitors_twoWebsites_differentDays_Referers.getWebsites_firstSite_lastN__API.getProcessedReport_day.xml
@@ -7,9 +7,9 @@
 		<name>Websites</name>
 		<module>Referers</module>
 		<action>getWebsites</action>
-		<actionToLoadSubTables>getUrlsFromWebsiteId</actionToLoadSubTables>
 		<dimension>Website</dimension>
 		<documentation>In this table, you can see which websites referred visitors to your site. &lt;br /&gt; By clicking on a row in the table, you can see which URLs the links to your website were on.</documentation>
+		<actionToLoadSubTables>getUrlsFromWebsiteId</actionToLoadSubTables>
 		<metrics>
 			<nb_visits>Visits</nb_visits>
 			<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
diff --git a/tests/integration/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml b/tests/integration/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml
index 01204a4e9d..2bffcc4c8b 100644
--- a/tests/integration/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml
+++ b/tests/integration/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml
@@ -2,9 +2,9 @@
 <result>
 	<row>
 		<category>All Websites</category>
-		<name>Single Website dashboard</name>
+		<name>All Websites dashboard</name>
 		<module>MultiSites</module>
-		<action>getOne</action>
+		<action>getAll</action>
 		<dimension>Website</dimension>
 		<metrics>
 			<nb_visits>Visits</nb_visits>
@@ -34,15 +34,15 @@
 			<exit_rate>The percentage of visits that left the website after viewing this page.</exit_rate>
 
 		</metricsDocumentation>
-		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=MultiSites&amp;apiAction=getOne&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
-		<uniqueId>MultiSites_getOne</uniqueId>
+		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=MultiSites&amp;apiAction=getAll&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
+		<uniqueId>MultiSites_getAll</uniqueId>
 
 	</row>
 	<row>
 		<category>All Websites</category>
-		<name>All Websites dashboard</name>
+		<name>Single Website dashboard</name>
 		<module>MultiSites</module>
-		<action>getAll</action>
+		<action>getOne</action>
 		<dimension>Website</dimension>
 		<metrics>
 			<nb_visits>Visits</nb_visits>
@@ -72,8 +72,8 @@
 			<exit_rate>The percentage of visits that left the website after viewing this page.</exit_rate>
 
 		</metricsDocumentation>
-		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=MultiSites&amp;apiAction=getAll&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
-		<uniqueId>MultiSites_getAll</uniqueId>
+		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=MultiSites&amp;apiAction=getOne&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
+		<uniqueId>MultiSites_getOne</uniqueId>
 
 	</row>
 	<row>
@@ -458,6 +458,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report contains information about the page URLs that have been visited. &lt;br /&gt; The table is organized hierarchically, the URLs are displayed as a folder structure.&lt;br /&gt;Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getPageUrls</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getPageUrls&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
 		<uniqueId>Actions_getPageUrls</uniqueId>
 
@@ -481,6 +482,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report contains information about the entry pages that were used during the specified period. An entry page is the first page that a user views during his visit. &lt;br /&gt; The entry URLs are displayed as a folder structure. Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getEntryPageUrls</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getEntryPageUrls&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
 		<uniqueId>Actions_getEntryPageUrls</uniqueId>
 
@@ -504,6 +506,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report contains information about the exit pages that occurred during the specified period. An exit page is the last page that a user views during his visit. &lt;br /&gt; The exit URLs are displayed as a folder structure. Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getExitPageUrls</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getExitPageUrls&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
 		<uniqueId>Actions_getExitPageUrls</uniqueId>
 
@@ -531,6 +534,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report contains information about the titles of the pages that have been visited. &lt;br /&gt; The page title is the HTML &lt;title&gt; Tag that most browsers show in their window title.</documentation>
+		<actionToLoadSubTables>getPageTitles</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getPageTitles&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
 		<uniqueId>Actions_getPageTitles</uniqueId>
 
@@ -554,6 +558,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report contains information about the titles of exit pages that occurred during the specified period. Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getEntryPageTitles</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getEntryPageTitles&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
 		<uniqueId>Actions_getEntryPageTitles</uniqueId>
 
@@ -577,6 +582,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report contains information about the titles of entry pages that were used during the specified period. Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getExitPageTitles</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getExitPageTitles&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
 		<uniqueId>Actions_getExitPageTitles</uniqueId>
 
@@ -598,6 +604,7 @@
 
 		</metricsDocumentation>
 		<documentation>This report shows a hierarchical list of outlink URLs that were clicked by your visitors. An outlink is a link that leads the visitor away from your website (to another domain).&lt;br /&gt;Use the plus and minus icons on the left to navigate.</documentation>
+		<actionToLoadSubTables>getOutlinks</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getOutlinks&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
 		<uniqueId>Actions_getOutlinks</uniqueId>
 
@@ -619,6 +626,7 @@
 
 		</metricsDocumentation>
 		<documentation>In this report, you can see which files your visitors have downloaded. &lt;br /&gt; What Piwik counts as a download is the click on a download link. Whether the download was completed or not isn't known to Piwik.</documentation>
+		<actionToLoadSubTables>getDownloads</actionToLoadSubTables>
 		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getDownloads&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
 		<uniqueId>Actions_getDownloads</uniqueId>
 
@@ -719,9 +727,9 @@
 		<name>Websites</name>
 		<module>Referers</module>
 		<action>getWebsites</action>
-		<actionToLoadSubTables>getUrlsFromWebsiteId</actionToLoadSubTables>
 		<dimension>Website</dimension>
 		<documentation>In this table, you can see which websites referred visitors to your site. &lt;br /&gt; By clicking on a row in the table, you can see which URLs the links to your website were on.</documentation>
+		<actionToLoadSubTables>getUrlsFromWebsiteId</actionToLoadSubTables>
 		<metrics>
 			<nb_visits>Visits</nb_visits>
 			<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
@@ -765,9 +773,9 @@
 		<name>Search Engines</name>
 		<module>Referers</module>
 		<action>getSearchEngines</action>
-		<actionToLoadSubTables>getKeywordsFromSearchEngineId</actionToLoadSubTables>
 		<dimension>Search Engine</dimension>
 		<documentation>This report shows which search engines referred users to your website. &lt;br /&gt; By clicking on a row in the table, you can see what users were searching for using a specific search engine.</documentation>
+		<actionToLoadSubTables>getKeywordsFromSearchEngineId</actionToLoadSubTables>
 		<metrics>
 			<nb_visits>Visits</nb_visits>
 			<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
@@ -811,9 +819,9 @@
 		<name>Campaigns</name>
 		<module>Referers</module>
 		<action>getCampaigns</action>
-		<actionToLoadSubTables>getKeywordsFromCampaignId</actionToLoadSubTables>
 		<dimension>Campaign</dimension>
 		<documentation>This report shows which campaigns led visitors to your website. &lt;br /&gt; For more information about tracking campaigns, read the &lt;a href=&quot;http://piwik.org/docs/tracking-campaigns/&quot; target=&quot;_blank&quot;&gt;campaigns documentation on piwik.org&lt;/a&gt;</documentation>
+		<actionToLoadSubTables>getKeywordsFromCampaignId</actionToLoadSubTables>
 		<metrics>
 			<nb_visits>Visits</nb_visits>
 			<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
diff --git a/tests/integration/expected/test_twoVisitsWithCustomVariables__subtable__API.getProcessedReport_day.xml b/tests/integration/expected/test_twoVisitsWithCustomVariables__subtable__API.getProcessedReport_day.xml
new file mode 100755
index 0000000000..31eef13c85
--- /dev/null
+++ b/tests/integration/expected/test_twoVisitsWithCustomVariables__subtable__API.getProcessedReport_day.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+	<website>Piwik test</website>
+	<prettyDate>Sunday 3 January 2010</prettyDate>
+	<metadata>
+		<category>Visitors</category>
+		<name>Custom Variables</name>
+		<module>CustomVariables</module>
+		<action>getCustomVariablesValuesFromNameId</action>
+		<dimension>Custom Variable value</dimension>
+		<documentation>This report contains information about your Custom Variables. Click on a variable name to see the distribution of the values. &lt;br /&gt; For more information about Custom Variables in general, read the &lt;a href=&quot;http://piwik.org/docs/custom-variables/&quot; target=&quot;_blank&quot;&gt;Custom Variables documentation on piwik.org&lt;/a&gt;</documentation>
+		<isSubtableReport>1</isSubtableReport>
+		<metrics>
+			<nb_visits>Visits</nb_visits>
+			<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
+			<nb_actions>Actions</nb_actions>
+
+		</metrics>
+		<processedMetrics>
+			<nb_actions_per_visit>Actions per Visit</nb_actions_per_visit>
+			<avg_time_on_site>Avg. Time on Website</avg_time_on_site>
+			<bounce_rate>Bounce Rate</bounce_rate>
+			<conversion_rate>Conversion Rate</conversion_rate>
+
+		</processedMetrics>
+		<metricsDocumentation>
+			<nb_visits>If a visitor comes to your website for the first time or if he visits a page more than 30 minutes after his last page view, this will be recorded as a new visit.</nb_visits>
+			<nb_uniq_visitors>The number of unduplicated visitors coming to your website. Every user is only counted once, even if he visits the website multiple times a day.</nb_uniq_visitors>
+			<nb_actions>The number of actions performed by your visitors. Actions can be page views, downloads or outlinks.</nb_actions>
+			<nb_actions_per_visit>The average number of actions (page views, downloads or outlinks) that were performed during the visits.</nb_actions_per_visit>
+			<avg_time_on_site>The average duration of a visit.</avg_time_on_site>
+			<bounce_rate>The percentage of visits that only had a single pageview. This means, that the visitor left the website directly from the entrance page.</bounce_rate>
+			<conversion_rate>The percentage of visits that triggered a goal conversion.</conversion_rate>
+			<avg_time_on_page>The average amount of time visitors spent on this page (only the page, not the entire website).</avg_time_on_page>
+			<nb_hits>The number of times this page was visited.</nb_hits>
+			<exit_rate>The percentage of visits that left the website after viewing this page.</exit_rate>
+
+		</metricsDocumentation>
+		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=CustomVariables&amp;apiAction=getCustomVariablesValuesFromNameId&amp;period=day&amp;date=2010-01-03</imageGraphUrl>
+		<uniqueId>CustomVariables_getCustomVariablesValuesFromNameId</uniqueId>
+
+	</metadata>
+	<columns>
+		<label>Custom Variable value</label>
+		<nb_visits>Visits</nb_visits>
+		<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
+		<nb_actions>Actions</nb_actions>
+		<nb_actions_per_visit>Actions per Visit</nb_actions_per_visit>
+		<avg_time_on_site>Avg. Time on Website</avg_time_on_site>
+		<bounce_rate>Bounce Rate</bounce_rate>
+		<conversion_rate>Conversion Rate</conversion_rate>
+
+	</columns>
+	<reportData>
+		<row>
+			<label>LoggedOut</label>
+			<nb_uniq_visitors>1</nb_uniq_visitors>
+			<nb_visits>2</nb_visits>
+			<nb_actions>2</nb_actions>
+			<nb_actions_per_visit>1</nb_actions_per_visit>
+			<avg_time_on_site>00:03:01</avg_time_on_site>
+			<bounce_rate>100%</bounce_rate>
+			<conversion_rate>0%</conversion_rate>
+		</row>
+		<row>
+			<label>LoggedIn</label>
+			<nb_uniq_visitors>1</nb_uniq_visitors>
+			<nb_visits>1</nb_visits>
+			<nb_actions>4</nb_actions>
+			<nb_actions_per_visit>4</nb_actions_per_visit>
+			<avg_time_on_site>00:06:01</avg_time_on_site>
+			<bounce_rate>0%</bounce_rate>
+			<conversion_rate>0%</conversion_rate>
+		</row>
+	</reportData>
+	<reportMetadata/>
+
+</result>
\ No newline at end of file
-- 
GitLab