PDF rausgenommen
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Plugin\Dimension\ConversionDimension;
|
||||
use Piwik\Tracker\GoalManager;
|
||||
|
||||
abstract class BaseConversion extends ConversionDimension
|
||||
{
|
||||
/**
|
||||
* Returns rounded decimal revenue, or if revenue is integer, then returns as is.
|
||||
*
|
||||
* @param int|float $revenue
|
||||
* @return int|float
|
||||
*/
|
||||
protected function roundRevenueIfNeeded($revenue)
|
||||
{
|
||||
if (false === $revenue) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (round($revenue) == $revenue) {
|
||||
return $revenue;
|
||||
}
|
||||
|
||||
$value = round($revenue, GoalManager::REVENUE_PRECISION);
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
18
msd2/tracking/piwik/plugins/Ecommerce/Columns/Items.php
Normal file
18
msd2/tracking/piwik/plugins/Ecommerce/Columns/Items.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?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\Columns;
|
||||
|
||||
class Items extends BaseConversion
|
||||
{
|
||||
protected $columnName = 'items';
|
||||
protected $type = self::TYPE_NUMBER;
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
protected $nameSingular = 'Ecommerce_NumberOfItems';
|
||||
|
||||
}
|
37
msd2/tracking/piwik/plugins/Ecommerce/Columns/Order.php
Normal file
37
msd2/tracking/piwik/plugins/Ecommerce/Columns/Order.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Columns\DimensionMetricFactory;
|
||||
use Piwik\Columns\Discriminator;
|
||||
use Piwik\Columns\MetricsList;
|
||||
use Piwik\Plugin\ArchivedMetric;
|
||||
use Piwik\Tracker\GoalManager;
|
||||
|
||||
class Order extends BaseConversion
|
||||
{
|
||||
protected $columnName = 'idorder';
|
||||
protected $type = self::TYPE_NUMBER;
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
protected $nameSingular = 'Ecommerce_Order';
|
||||
protected $namePlural = 'Ecommerce_Orders';
|
||||
protected $metricId = 'orders';
|
||||
|
||||
public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
|
||||
{
|
||||
$metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_UNIQUE);
|
||||
$metricsList->addMetric($metric);
|
||||
}
|
||||
|
||||
public function getDbDiscriminator()
|
||||
{
|
||||
return new Discriminator($this->dbTableName, 'idgoal', GoalManager::IDGOAL_ORDER);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Columns\Dimension;
|
||||
use Piwik\Piwik;
|
||||
|
||||
class ProductCategory extends Dimension
|
||||
{
|
||||
protected $type = self::TYPE_TEXT;
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
protected $nameSingular = 'Goals_ProductCategory';
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Columns\Dimension;
|
||||
use Piwik\Columns\Discriminator;
|
||||
use Piwik\Columns\Join\ActionNameJoin;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class ProductName extends Dimension
|
||||
{
|
||||
protected $type = self::TYPE_TEXT;
|
||||
protected $dbTableName = 'log_conversion_item';
|
||||
protected $columnName = 'idaction_name';
|
||||
protected $nameSingular = 'Goals_ProductName';
|
||||
protected $namePlural = 'Goals_ProductNames';
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
|
||||
public function getDbColumnJoin()
|
||||
{
|
||||
return new ActionNameJoin();
|
||||
}
|
||||
|
||||
public function getDbDiscriminator()
|
||||
{
|
||||
return new Discriminator('log_action', 'type', Action::TYPE_ECOMMERCE_ITEM_NAME);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Columns\Dimension;
|
||||
|
||||
class ProductPrice extends Dimension
|
||||
{
|
||||
protected $type = self::TYPE_MONEY;
|
||||
protected $dbTableName = 'log_conversion_item';
|
||||
protected $columnName = 'price';
|
||||
protected $nameSingular = 'Goals_ProductPrice';
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Columns\Dimension;
|
||||
|
||||
class ProductQuantity extends Dimension
|
||||
{
|
||||
protected $type = self::TYPE_NUMBER;
|
||||
protected $dbTableName = 'log_conversion_item';
|
||||
protected $columnName = 'quantity';
|
||||
protected $nameSingular = 'Goals_ProductQuantity';
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
|
||||
}
|
35
msd2/tracking/piwik/plugins/Ecommerce/Columns/ProductSku.php
Normal file
35
msd2/tracking/piwik/plugins/Ecommerce/Columns/ProductSku.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Columns\Dimension;
|
||||
use Piwik\Columns\Discriminator;
|
||||
use Piwik\Columns\Join\ActionNameJoin;
|
||||
use Piwik\Tracker\Action;
|
||||
|
||||
class ProductSku extends Dimension
|
||||
{
|
||||
protected $type = self::TYPE_TEXT;
|
||||
protected $dbTableName = 'log_conversion_item';
|
||||
protected $columnName = 'idaction_sku';
|
||||
protected $nameSingular = 'Goals_ProductSKU';
|
||||
protected $namePlural = 'Goals_ProductSKUs';
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
|
||||
public function getDbColumnJoin()
|
||||
{
|
||||
return new ActionNameJoin();
|
||||
}
|
||||
|
||||
public function getDbDiscriminator()
|
||||
{
|
||||
return new Discriminator('log_action', 'type', Action::TYPE_ECOMMERCE_ITEM_SKU);
|
||||
}
|
||||
|
||||
}
|
74
msd2/tracking/piwik/plugins/Ecommerce/Columns/Revenue.php
Normal file
74
msd2/tracking/piwik/plugins/Ecommerce/Columns/Revenue.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Columns\Discriminator;
|
||||
use Piwik\Tracker\GoalManager;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
|
||||
class Revenue extends BaseConversion
|
||||
{
|
||||
protected $columnName = 'revenue';
|
||||
protected $columnType = 'float default NULL';
|
||||
protected $type = self::TYPE_MONEY;
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
protected $nameSingular = 'Ecommerce_OrderValue';
|
||||
|
||||
public function getDbDiscriminator()
|
||||
{
|
||||
return new Discriminator($this->dbTableName, 'idgoal', GoalManager::IDGOAL_ORDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @param GoalManager $goalManager
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
public function onGoalConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
|
||||
{
|
||||
$defaultRevenue = $goalManager->getGoalColumn('revenue');
|
||||
$revenue = $request->getGoalRevenue($defaultRevenue);
|
||||
|
||||
return $this->roundRevenueIfNeeded($revenue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @param GoalManager $goalManager
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
public function onEcommerceOrderConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
|
||||
{
|
||||
$defaultRevenue = 0;
|
||||
$revenue = $request->getGoalRevenue($defaultRevenue);
|
||||
|
||||
return $this->roundRevenueIfNeeded($revenue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @param GoalManager $goalManager
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
public function onEcommerceCartUpdateConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
|
||||
{
|
||||
return $this->onEcommerceOrderConversion($request, $visitor, $action, $goalManager);
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Tracker\GoalManager;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
|
||||
class RevenueDiscount extends BaseConversion
|
||||
{
|
||||
protected $columnName = 'revenue_discount';
|
||||
protected $columnType = 'float default NULL';
|
||||
protected $type = self::TYPE_MONEY;
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
protected $nameSingular = 'General_Discount';
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @param GoalManager $goalManager
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
public function onEcommerceOrderConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
|
||||
{
|
||||
return $this->roundRevenueIfNeeded($request->getParam('ec_dt'));
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Tracker\GoalManager;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
|
||||
class RevenueShipping extends BaseConversion
|
||||
{
|
||||
protected $columnName = 'revenue_shipping';
|
||||
protected $columnType = 'float default NULL';
|
||||
protected $type = self::TYPE_MONEY;
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
protected $nameSingular = 'General_Shipping';
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @param GoalManager $goalManager
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
public function onEcommerceOrderConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
|
||||
{
|
||||
return $this->roundRevenueIfNeeded($request->getParam('ec_sh'));
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Tracker\GoalManager;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
|
||||
class RevenueSubtotal extends BaseConversion
|
||||
{
|
||||
protected $columnName = 'revenue_subtotal';
|
||||
protected $columnType = 'float default NULL';
|
||||
protected $type = self::TYPE_MONEY;
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
protected $nameSingular = 'General_Subtotal';
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @param GoalManager $goalManager
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
public function onEcommerceOrderConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
|
||||
{
|
||||
return $this->roundRevenueIfNeeded($request->getParam('ec_st'));
|
||||
}
|
||||
}
|
36
msd2/tracking/piwik/plugins/Ecommerce/Columns/RevenueTax.php
Normal file
36
msd2/tracking/piwik/plugins/Ecommerce/Columns/RevenueTax.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?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\Columns;
|
||||
|
||||
use Piwik\Tracker\GoalManager;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
|
||||
class RevenueTax extends BaseConversion
|
||||
{
|
||||
protected $columnName = 'revenue_tax';
|
||||
protected $columnType = 'float default NULL';
|
||||
protected $type = self::TYPE_MONEY;
|
||||
protected $category = 'Goals_Ecommerce';
|
||||
protected $nameSingular = 'General_Tax';
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @param GoalManager $goalManager
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
public function onEcommerceOrderConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
|
||||
{
|
||||
return $this->roundRevenueIfNeeded($request->getParam('ec_tx'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user