Commit 627baba06ed207f8e604499d5f893ce274249191
1 parent
05186f71
google analitics
Showing
1 changed file
with
12 additions
and
19 deletions
Show diff stats
frontend/views/layouts/main.php
... | ... | @@ -93,28 +93,21 @@ JS; |
93 | 93 | <link type="image/x-icon" href="/img/favicon.ico" rel="icon"> |
94 | 94 | <title><?= Html::encode($seo->title) ?></title> |
95 | 95 | <?php $this->head() ?> |
96 | - </head> | |
97 | - <body> | |
98 | - <?php $this->beginBody() ?> | |
99 | - <!-- Google Analytics --> | |
96 | + | |
97 | + <!-- Google Analytics --> | |
100 | 98 | <?php if (!empty($settings->ga_code)) { ?> |
101 | - <script> | |
102 | - (function(i, s, o, g, r, a, m) { | |
103 | - i[ 'GoogleAnalyticsObject' ] = r; | |
104 | - i[ r ] = i[ r ] || function() { | |
105 | - (i[ r ].q = i[ r ].q || []).push(arguments) | |
106 | - }, i[ r ].l = 1 * new Date(); | |
107 | - a = s.createElement(o), m = s.getElementsByTagName(o)[ 0 ]; | |
108 | - a.async = 1; | |
109 | - a.src = g; | |
110 | - m.parentNode.insertBefore(a, m) | |
111 | - })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); | |
99 | + <script async src="https://www.googletagmanager.com/gtag/js?id=UA-109405172-1"></script> | |
100 | + <script> | |
101 | + window.dataLayer = window.dataLayer || []; | |
102 | + function gtag(){dataLayer.push(arguments);} | |
103 | + gtag('js', new Date()); | |
112 | 104 | |
113 | - ga('create', '<?=$settings->ga_code?>', 'auto'); | |
114 | - ga('send', 'pageview'); | |
115 | - | |
116 | - </script> | |
105 | + gtag('config', '<?=$settings->ga_code?>'); | |
106 | + </script> | |
117 | 107 | <?php } ?> |
108 | + </head> | |
109 | + <body> | |
110 | + <?php $this->beginBody() ?> | |
118 | 111 | <div id="all"> |
119 | 112 | <header> |
120 | 113 | <!-- *** TOP *** | ... | ... |