1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
gtm.php
См. документацию.
1
<?php
2
namespace
Bitrix\Landing\Hook\Page;
3
4
use \Bitrix\Landing\Manager;
5
use \Bitrix\Landing\Field;
6
use \Bitrix\Main\Localization\Loc;
7
8
Loc::loadMessages(__FILE__);
9
10
class
GTM
extends
\Bitrix\Landing\Hook\Page
11
{
16
protected
function
getMap
()
17
{
18
$helpUrl =
\Bitrix\Landing\Help::getHelpUrl
(
'GTM'
);
19
return
array
(
20
'USE'
=>
new
Field
\
Checkbox
(
'USE'
,
array
(
21
'title'
=>
'Google Tag Manager'
22
)),
23
'COUNTER'
=>
new
Field
\
Text
(
'COUNTER'
,
array
(
24
'title'
=>
'Google Tag Manager'
,
25
'placeholder'
=> Loc::getMessage(
'LANDING_HOOK_GTM_PLACEHOLDER'
),
26
'help'
=> $helpUrl
27
?
'<a href="'
. $helpUrl .
'" target="_blank">'
.
28
Loc::getMessage(
'LANDING_HOOK_DETAIL_HELP'
) .
29
'</a>'
30
:
''
31
))
32
);
33
}
34
39
public
function
isFree
()
40
{
41
return
false
;
42
}
43
48
public
function
isLocked
()
49
{
50
return
!
\Bitrix\Landing\Restriction\Manager::isAllowed
(
51
'limit_sites_google_analytics'
52
);
53
}
54
59
public
function
enabled
()
60
{
61
if
($this->
isLocked
())
62
{
63
return
false
;
64
}
65
66
if
($this->
issetCustomExec
())
67
{
68
return
true
;
69
}
70
71
return
$this->fields[
'USE'
]->getValue() ==
'Y'
;
72
}
73
78
public
function
enabledInEditMode
()
79
{
80
return
false
;
81
}
82
87
public
function
exec
()
88
{
89
if
($this->
execCustom
())
90
{
91
return
;
92
}
93
94
$counter
=
\htmlspecialcharsbx
(trim($this->fields[
'COUNTER'
]));
95
$counter
= \CUtil::jsEscape(
$counter
);
96
if
(
$counter
)
97
{
98
Cookies::addCookieScript
(
99
'gtm'
,
100
'(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({\'gtm.start\':new Date().getTime(),event:\'gtm.js\'});
101
var f=d.getElementsByTagName(s)[0],
102
j=d.createElement(s),
103
dl=l!=\'dataLayer\'?\'&l=\'+l:\'\';
104
j.async=true;
105
j.src=\'https://www.googletagmanager.com/gtm.js?id=\'+i+dl;
106
f.parentNode.insertBefore(j,f);})(window,document,\'script\',\'dataLayer\',\''
.
$counter
.
'\'
);
'
107
);
108
Manager::setPageView(
109
'
Noscript
',
110
'
<noscript>
111
<iframe src=
"https://www.googletagmanager.com/ns.html?id=' . $counter . '"
height
=
"0"
width
=
"0"
style
=
"display:none;visibility:hidden"
></iframe>
112
</noscript>
');
113
}
114
}
115
}
Bitrix\Landing\Field\Checkbox
Определения
checkbox.php:5
Bitrix\Landing\Help\getHelpUrl
static getHelpUrl(string $code)
Определения
help.php:174
Bitrix\Landing\Hook\Page\Cookies\addCookieScript
static addCookieScript(string $cookieCode, string $functionBody)
Определения
cookies.php:167
Bitrix\Landing\Hook\Page\GTM
Определения
gtm.php:11
Bitrix\Landing\Hook\Page\GTM\isLocked
isLocked()
Определения
gtm.php:48
Bitrix\Landing\Hook\Page\GTM\getMap
getMap()
Определения
gtm.php:16
Bitrix\Landing\Hook\Page\GTM\enabledInEditMode
enabledInEditMode()
Определения
gtm.php:78
Bitrix\Landing\Hook\Page\GTM\enabled
enabled()
Определения
gtm.php:59
Bitrix\Landing\Hook\Page\GTM\exec
exec()
Определения
gtm.php:87
Bitrix\Landing\Hook\Page\GTM\isFree
isFree()
Определения
gtm.php:39
Bitrix\Landing\Hook\Page\issetCustomExec
issetCustomExec()
Определения
page.php:253
Bitrix\Landing\Hook\Page\execCustom
execCustom()
Определения
page.php:262
Bitrix\Landing\Restriction\Manager\isAllowed
static isAllowed(string $code, array $params=[], string $cacheSalt='')
Определения
manager.php:214
height
hidden PROPERTY[<?=$propertyIndex?>][CODE]<?=htmlspecialcharsEx( $propertyCode)?> height
Определения
file_new.php:759
width
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения
file_new.php:677
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
htmlspecialcharsbx
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения
tools.php:2701
Bitrix\Landing\Field
Определения
checkbox.php:2
Bitrix\Landing\Hook\Page
Определения
b24button.php:2
Bitrix\Main\Text
Определения
base32.php:2
$counter
$counter
Определения
options.php:5
style
font style
Определения
invoice.php:442
bitrix
modules
landing
lib
hook
page
gtm.php
Создано системой
1.14.0