Commit 216957b054229dbfe3021e6d3f71d08dfefab2ec

Authored by alex
1 parent fe6e76b5

add google analitics

frontend/assets/AppAsset.php
... ... @@ -21,6 +21,7 @@
21 21 "js/script.js",
22 22 "js/markerclusterer.js",
23 23 "js/map.js",
  24 +
24 25 ];
25 26 public $depends = [
26 27 'yii\web\YiiAsset',
... ...
frontend/views/layouts/main.php
... ... @@ -21,6 +21,7 @@ $seo=\Yii::$app->get('seo');
21 21 \frontend\assets\AppAsset::register($this);
22 22 ?>
23 23  
  24 +
24 25 <?php $this->beginPage() ?>
25 26 <!DOCTYPE html>
26 27 <html lang="<?= \Yii::$app->language ?>">
... ... @@ -32,6 +33,15 @@ $seo=\Yii::$app-&gt;get(&#39;seo&#39;);
32 33 <?= Html::csrfMetaTags() ?>
33 34 <title><?= Html::encode($seo->title) ?></title>
34 35 <?php $this->head() ?>
  36 + <!-- Global site tag (gtag.js) - Google Analytics -->
  37 + <script async src="https://www.googletagmanager.com/gtag/js?id=UA-124411316-1"></script>
  38 + <script>
  39 + window.dataLayer = window.dataLayer || [];
  40 + function gtag(){dataLayer.push(arguments);}
  41 + gtag('js', new Date());
  42 +
  43 + gtag('config', 'UA-124411316-1');
  44 + </script>
35 45 </head>
36 46 <body>
37 47 <?php $this->beginBody() ?>
... ...