Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
conversionhandlers.php
1<?php
2
4
9
10Loc::loadMessages(__FILE__);
11
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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29