-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #6022 separate goals and ecommerce menu items, added goals manag…
…ement menu item
- Loading branch information
Showing
16 changed files
with
227 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Piwik - free/libre analytics platform | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
namespace Piwik\Plugins\Ecommerce; | ||
|
||
use Exception; | ||
use Piwik\DataTable; | ||
use Piwik\FrontController; | ||
use Piwik\Piwik; | ||
use Piwik\View; | ||
|
||
class Controller extends \Piwik\Plugins\Goals\Controller | ||
{ | ||
public function ecommerceReport() | ||
{ | ||
if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('CustomVariables')) { | ||
throw new Exception("Ecommerce Tracking requires that the plugin Custom Variables is enabled. Please enable the plugin CustomVariables (or ask your admin)."); | ||
} | ||
|
||
$view = $this->getGoalReportView($idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER); | ||
$view->displayFullReport = false; | ||
$view->showHeadline = true; | ||
return $view->render(); | ||
} | ||
|
||
public function getEcommerceLog($fetch = false) | ||
{ | ||
$saveGET = $_GET; | ||
$_GET['segment'] = urlencode('visitEcommerceStatus!=none'); | ||
$_GET['widget'] = 1; | ||
$output = FrontController::getInstance()->dispatch('Live', 'getVisitorLog', array($fetch)); | ||
$_GET = $saveGET; | ||
return $output; | ||
} | ||
|
||
public function index() | ||
{ | ||
return $this->ecommerceReport(); | ||
} | ||
|
||
public function ecommerceProducts() | ||
{ | ||
$viewOverview = $this->getGoalReportView(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER); | ||
$reportsByDimension = $viewOverview->goalReportsByDimension; | ||
|
||
$view = new View('@Ecommerce/ecommerceProducts'); | ||
$this->setGeneralVariablesView($view); | ||
|
||
$view->goalReportsByDimension = $reportsByDimension; | ||
return $view->render(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Piwik - free/libre analytics platform | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
namespace Piwik\Plugins\Ecommerce; | ||
|
||
use Piwik\Piwik; | ||
|
||
class Ecommerce extends \Piwik\Plugin | ||
{ | ||
public function getInformation() | ||
{ | ||
$suffix = Piwik::translate('SitesManager_PiwikOffersEcommerceAnalytics', | ||
array('<a href="http://piwik.org/docs/ecommerce-analytics/" rel="noreferrer" target="_blank">', '</a>')); | ||
$info = parent::getInformation(); | ||
$info['description'] = $suffix; | ||
return $info; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* Piwik - free/libre analytics platform | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
namespace Piwik\Plugins\Ecommerce; | ||
|
||
use Piwik\Common; | ||
use Piwik\Menu\MenuReporting; | ||
use Piwik\Menu\MenuUser; | ||
use Piwik\Piwik; | ||
use Piwik\Site; | ||
use Piwik\Translate; | ||
|
||
/** | ||
*/ | ||
class Menu extends \Piwik\Plugin\Menu | ||
{ | ||
|
||
public function configureReportingMenu(MenuReporting $menu) | ||
{ | ||
$idSite = Common::getRequestVar('idSite', null, 'int'); | ||
|
||
$site = new Site($idSite); | ||
|
||
if ($site->isEcommerceEnabled()) { | ||
$ecommerceParams = array('idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER); | ||
$ecommerceUrl = $this->urlForAction('ecommerceReport', $ecommerceParams); | ||
|
||
$menu->addItem('Goals_Ecommerce', '', $ecommerceUrl, 24); | ||
$menu->addItem('Goals_Ecommerce', 'Goals_EcommerceOverview', $ecommerceUrl, 1); | ||
$menu->addItem('Goals_Ecommerce', 'Goals_EcommerceLog', $this->urlForAction('getEcommerceLog'), 2); | ||
$menu->addItem('Goals_Ecommerce', 'Goals_Products', $this->urlForAction('ecommerceProducts', $ecommerceParams), 3); | ||
} | ||
|
||
} | ||
public function configureUserMenu(MenuUser $menu) | ||
{ | ||
$idSite = Common::getRequestVar('idSite', null, 'int'); | ||
|
||
if (Piwik::isUserHasAdminAccess($idSite)) { | ||
$menu->addManageItem('Goals_GoalsManagement', $this->urlForAction('manage'), 15); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<h2 piwik-enriched-headline>{{ 'Goals_Products'|translate }}</h2> | ||
|
||
{{ goalReportsByDimension|raw }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.