21 $helpUrl = \Bitrix\Landing\Help::getHelpUrl(
'PIXEL');
26 'COUNTER' =>
new Field\
Text(
'COUNTER', array(
30 ?
'<a href="' . $helpUrl .
'" target="_blank">' .
63 return $this->fields[
'USE']->getValue() ==
'Y';
70 private static function getBusinessPixelFromSeo(): ?string
72 if (\
Bitrix\Main\Loader::includeModule(
'seo'))
75 if ($businessSuite->isInstalled())
77 return $businessSuite->getCurrentInstalls()->getPixel();
88 private function getBusinessPixel(): ?string
91 if ($pixelStored ===
null)
93 $pixelStored = $this->getBusinessPixelFromSeo();
108 Option::delete(
'landing', [
'name' =>
'business_pixel']);
125 if (Loader::includeModule(
'bitrix24'))
127 $zone = \CBitrix24::getPortalZone();
129 elseif (file_exists($_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/lang/ru")
130 && !file_exists($_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/lang/ua"))
140 $businessPixel = $this->getBusinessPixel();
142 if ($this->fields[
'USE']->getValue() ===
'Y')
144 $counter = \htmlspecialcharsbx(trim($this->fields[
'COUNTER']));
145 $counter = \CUtil::jsEscape($counter);
148 if (!$counter || $counter === $businessPixel)
150 $counter = $businessPixel;
151 $businessPixel =
null;
158 '!function(f,b,e,v,n,t,s)
159 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
160 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
161 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version=\'2.0\';n.agent=\'plbitrix\';
162 n.queue=[];t=b.createElement(e);t.async=!0;
163 t.src=v;s=b.getElementsByTagName(e)[0];
164 s.parentNode.insertBefore(t,s)}(window, document,\'script\',
165 \'https://connect.facebook.net/en_US/fbevents.js\');
166 fbq(\'init\', \'' . $counter .
'\');
167 fbq(\
'track\', \'PageView\');'.
169 ?
"\n fbq('init', '{$businessPixel}');" .
170 "\n fbq('track', 'PageView');"
176 <img height="1" width="1" style="display:none" alt="" src="https://www.facebook.com/tr?id=' .$counter .
'&ev=PageView&noscript=1"/>
static addCookieScript(string $cookieCode, string $functionBody)
static changeBusinessPixel()
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)