| Server IP : 167.99.224.18 / Your IP : 216.73.216.136 Web Server : Apache/2.4.41 (Ubuntu) System : Linux wordpress-ubuntu-s-1vcpu-1gb-nyc1-01 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.0.25 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins-old/matomo/app/core/Plugin/Dimension/ |
Upload File : |
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugin\Dimension;
use Piwik\CacheId;
use Piwik\Cache as PiwikCache;
use Piwik\Columns\Dimension;
use Piwik\Plugin\Manager as PluginManager;
use Piwik\Tracker\Action;
use Piwik\Tracker\GoalManager;
use Piwik\Tracker\Request;
use Piwik\Tracker\Visitor;
use Piwik\Plugin;
/**
* Defines a new conversion dimension that records any visit related information during tracking.
*
* You can record any visit information by implementing one of the following events:
* {@link onEcommerceOrderConversion()}, {@link onEcommerceCartUpdateConversion()} or {@link onGoalConversion()}.
* By defining a {@link $columnName} and {@link $columnType} a new column will be created in the database
* (table `log_conversion`) automatically and the values you return in the previous mentioned events will be saved in
* this column.
*
* You can create a new dimension using the console command `./console generate:dimension`.
*
* @api
* @since 2.5.0
*/
abstract class ConversionDimension extends Dimension
{
public const INSTALLER_PREFIX = 'log_conversion.';
protected $dbTableName = 'log_conversion';
protected $category = 'Goals_Conversion';
/**
* Get all conversion dimensions that are defined by all activated plugins.
* @ignore
*/
public static function getAllDimensions()
{
$cacheId = CacheId::pluginAware('ConversionDimensions');
$cache = PiwikCache::getTransientCache();
if (!$cache->contains($cacheId)) {
$plugins = PluginManager::getInstance()->getPluginsLoadedAndActivated();
$instances = array();
foreach ($plugins as $plugin) {
foreach (self::getDimensions($plugin) as $instance) {
$instances[] = $instance;
}
}
$cache->save($cacheId, $instances);
}
return $cache->fetch($cacheId);
}
/**
* Get all conversion dimensions that are defined by the given plugin.
* @param Plugin $plugin
* @return ConversionDimension[]
* @ignore
*/
public static function getDimensions(Plugin $plugin)
{
$dimensions = $plugin->findMultipleComponents('Columns', '\\Piwik\\Plugin\\Dimension\\ConversionDimension');
$instances = array();
foreach ($dimensions as $dimension) {
$instances[] = new $dimension();
}
return $instances;
}
/**
* This event is triggered when an ecommerce order is converted. Any returned value will be persist in the database.
* Return boolean `false` if you do not want to change the value in some cases.
*
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @param GoalManager $goalManager
*
* @return mixed|false
* @api
*/
public function onEcommerceOrderConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
{
return \false;
}
/**
* This event is triggered when an ecommerce cart update is converted. Any returned value will be persist in the
* database. Return boolean `false` if you do not want to change the value in some cases.
*
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @param GoalManager $goalManager
*
* @return mixed|false
* @api
*/
public function onEcommerceCartUpdateConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
{
return \false;
}
/**
* This event is triggered when an any custom goal is converted. Any returned value will be persist in the
* database. Return boolean `false` if you do not want to change the value in some cases.
*
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @param GoalManager $goalManager
*
* @return mixed|false
* @api
*/
public function onGoalConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
{
return \false;
}
}