Необходимо подключить Google Analytics
Код: Выделить всё
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-1111111111-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-1111111111-1');
</script>
Код: Выделить всё
<?php
namespace frontend\assets;
use yii\web\AssetBundle;
use yii\web\View;
class GoogleAnalyticsAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $js = [
[
'https://www.googletagmanager.com/gtag/js?id=UA-1111111111-1',
'async' => 'async',
],
'js/gtag.js',
];
public $jsOptions = [
'position' => View::POS_HEAD,
];
}
Где ошибка?