| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/a/w/e/awebpaca/piwik/plugins/TagManager/Template/Trigger/ |
Upload File : |
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\TagManager\Template\Trigger;
use Piwik\Settings\FieldConfig;
use Piwik\Validators\NotEmpty;
use Piwik\Validators\NumberRange;
class ScrollReachTrigger extends BaseTrigger
{
public function getCategory()
{
return self::CATEGORY_USER_ENGAGEMENT;
}
public function getParameters()
{
$scrollType = $this->makeSetting('scrollType', 'verticalpercentage', FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = 'Scroll Match Type';
$field->uiControl = FieldConfig::UI_CONTROL_SINGLE_SELECT;
$field->validators[] = new NotEmpty();
$field->availableValues = array(
'verticalpercentage' => 'Vertical - Percentage',
'verticalpixel' => 'Vertical - Pixels',
'horizontalpercentage' => 'Horizontal - Percentage',
'horizontalpixel' => 'Horizontal - Pixels',
);
});
return array(
$scrollType,
$this->makeSetting('pixels', 1, FieldConfig::TYPE_INT, function (FieldConfig $field) use ($scrollType) {
$field->title = 'Pixels';
$field->description = 'The amount in pixels that needs to be visible of this element depending on the selected scroll match type.';
$field->uiControlAttributes = array(
'placeholder' => 'eg. 50, 1020, 3059'
);
$field->condition = 'scrollType == "verticalpixel" || scrollType == "horizontalpixel"';
if ($scrollType->getValue() === 'verticalpixel' || $scrollType->getValue() === 'horizontalpixel') {
$field->validators[] = new NumberRange($min = 1, $max = 900000);
}
}),
$this->makeSetting('percentage', 50, FieldConfig::TYPE_INT, function (FieldConfig $field) use ($scrollType) {
$field->title = 'Percentage';
$field->description = 'You can specify any number between 1 and 100. If you specify 50, then it means the element needs to be at least 50% visible depending on the scroll match type.';
$field->uiControlAttributes = array(
'placeholder' => 'eg. 20, 50, 75, 90'
);
$field->condition = 'scrollType == "verticalpercentage" || scrollType == "horizontalpercentage"';
if ($scrollType->getValue() === 'verticalpercentage' || $scrollType->getValue() === 'horizontalpercentage') {
$field->validators[] = new NumberRange($min = 1, $max = 100);
}
}),
);
}
}