Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
conversion.php
1<?php
2
4
10
11abstract class Conversion extends AbstractBase
12{
18 protected function getData(array $events) : array
19 {
20 return array_filter(array_map(
21 function($item) {
22 return $item instanceof Event && $item->validate()? $item->prepareData() : null;
23 },
24 $events
25 ));
26 }
27
34 public function fireEvents(array $events) : ?Retargeting\Response
35 {
36 $facade = ExtensionFacade::getInstance();
37 if($facade->isInstalled() && !empty($events = $this->getData($events)))
38 {
39
40 return $this->getRequest()->send([
41 'methodName' => $this->getMethodName('conversion.event.fire'),
42 'parameters' => array_filter([
43 'fbe_external_business_id' => $facade->getCurrentSetup()->get(Facebook\Setup::BUSINESS_ID),
44 'business_manager_id' => $facade->getCurrentInstalls()->getBusinessManager(),
45 'pixel_id' => $facade->getCurrentInstalls()->getPixel(),
46 'test_code' => Config\Option::get('seo', 'facebook_conversion_test_code', null),
47 'events' => $events
48 ])
49 ]);
50 }
51
52 return null;
53 }
54}