Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
conversionhandlers.php
1
<?php
2
3
namespace
Bitrix\Advertising\Internals
;
4
5
use
Bitrix\Conversion\Config
;
6
use
Bitrix\Conversion\DayContext
;
7
use
Bitrix\Main\Loader
;
8
use
Bitrix\Main\Localization\Loc
;
9
10
Loc::loadMessages
(__FILE__);
11
12
final
class
ConversionHandlers
13
{
14
20
public
static
function
onGetCounterTypes
()
21
{
22
return
array(
23
'advertising_banner_click_day'
=> array(
'MODULE'
=>
'advertising'
,
'GROUP'
=>
'day'
,
'NAME'
=>
'Banner click'
),
24
);
25
}
26
32
public
static
function
onGetRateTypes
()
33
{
34
$scale = array(0.5, 1, 1.5, 2, 5);
35
36
return
array(
37
'advertising_banner_click'
=> array(
38
'NAME'
=>
Loc::getMessage
(
'ADVERTISING_CONVERSION_RATE_BANNER_CLICK_TITLE'
),
39
'SCALE'
=> $scale,
40
'MODULE'
=>
'advertising'
,
41
'SORT'
=> 5000,
42
'COUNTERS'
=> array(
'conversion_visit_day'
,
'advertising_banner_click_day'
),
43
'CALCULATE'
=>
function
(array $counters)
44
{
45
$denominator = $counters[
'conversion_visit_day'
] ?: 0;
46
$numerator = $counters[
'advertising_banner_click_day'
] ?: 0;
47
48
return
array(
49
'DENOMINATOR'
=> $denominator,
50
'NUMERATOR'
=> $numerator,
51
'RATE'
=> $denominator ? $numerator / $denominator : 0,
52
);
53
},
54
),
55
);
56
}
57
65
public
static
function
onBannerClick
($id, $fields)
66
{
67
if
(Loader::includeModule(
'conversion'
))
68
{
69
$context =
DayContext::getInstance
();
70
$context->addDayCounter(
'advertising_banner_click_day'
, 1);
71
}
72
}
73
74
}
Bitrix\Advertising\Internals\ConversionHandlers
Definition
conversionhandlers.php:13
Bitrix\Advertising\Internals\ConversionHandlers\onBannerClick
static onBannerClick($id, $fields)
Definition
conversionhandlers.php:65
Bitrix\Advertising\Internals\ConversionHandlers\onGetRateTypes
static onGetRateTypes()
Definition
conversionhandlers.php:32
Bitrix\Advertising\Internals\ConversionHandlers\onGetCounterTypes
static onGetCounterTypes()
Definition
conversionhandlers.php:20
Bitrix\Conversion\Config
Definition
config.php:9
Bitrix\Conversion\DayContext
Definition
daycontext.php:14
Bitrix\Conversion\DayContext\getInstance
static getInstance()
Definition
daycontext.php:229
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Advertising\Internals
Definition
conversionhandlers.php:3
modules
advertising
lib
internals
conversionhandlers.php
Создано системой
1.10.0