支持Google analysis、Microsoft Clarify集成
This commit is contained in:
parent
e166bb2991
commit
b0cc9c6400
@ -29,6 +29,34 @@ $this->registerCssFile('@web/css/fuckyou-navpadding.css');
|
||||
<head>
|
||||
<title><?= Html::encode($this->title).' | '.Yii::$app->name ?></title>
|
||||
<?php $this->head() ?>
|
||||
<?php
|
||||
if ($_ENV['CLARITY_ENABLED'] === 'true') {
|
||||
$clarityId = $_ENV['CLARITY_ID'];
|
||||
echo <<<EOL
|
||||
<script type="text/javascript">
|
||||
(function(c,l,a,r,i,t,y){
|
||||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
||||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
||||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
||||
})(window, document, "clarity", "script", "$clarityId");
|
||||
</script>
|
||||
EOL;
|
||||
}
|
||||
if ($_ENV['GA_ENABLED'] === 'true') {
|
||||
$gaId = $_ENV['GA_ID'];
|
||||
echo <<<EOL
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=$gaId"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '$gaId');
|
||||
</script>
|
||||
EOL;
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
<body class="d-flex flex-column h-100">
|
||||
<?php $this->beginBody() ?>
|
||||
|
@ -26,6 +26,34 @@ $this->registerLinkTag(['rel' => 'icon', 'type' => 'image/x-icon', 'href' => Yii
|
||||
<head>
|
||||
<title><?= Html::encode($this->title).' | '.Yii::$app->name ?></title>
|
||||
<?php $this->head() ?>
|
||||
<?php
|
||||
if ($_ENV['CLARITY_ENABLED'] === 'true') {
|
||||
$clarityId = $_ENV['CLARITY_ID'];
|
||||
echo <<<EOL
|
||||
<script type="text/javascript">
|
||||
(function(c,l,a,r,i,t,y){
|
||||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
||||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
||||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
||||
})(window, document, "clarity", "script", "$clarityId");
|
||||
</script>
|
||||
EOL;
|
||||
}
|
||||
if ($_ENV['GA_ENABLED'] === 'true') {
|
||||
$gaId = $_ENV['GA_ID'];
|
||||
echo <<<EOL
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=$gaId"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '$gaId');
|
||||
</script>
|
||||
EOL;
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
<body class="d-flex flex-column h-100">
|
||||
<?php $this->beginBody() ?>
|
||||
|
@ -24,10 +24,38 @@ $darkMode = Yii::$app->user->isGuest ? 0 : Yii::$app->user->identity->dark_mode;
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>" class="h-100" <?= $darkMode===1?'data-bs-theme="dark"':''?> >
|
||||
<html lang="<?= Yii::$app->language ?>" class="h-100" <?= $darkMode === 1 ? 'data-bs-theme="dark"' : '' ?> >
|
||||
<head>
|
||||
<title><?= Html::encode($this->title).' | '.Yii::$app->name ?></title>
|
||||
<title><?= Html::encode($this->title) . ' | ' . Yii::$app->name ?></title>
|
||||
<?php $this->head() ?>
|
||||
<?php
|
||||
if ($_ENV['CLARITY_ENABLED'] === 'true') {
|
||||
$clarityId = $_ENV['CLARITY_ID'];
|
||||
echo <<<EOL
|
||||
<script type="text/javascript">
|
||||
(function(c,l,a,r,i,t,y){
|
||||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
||||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
||||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
||||
})(window, document, "clarity", "script", "$clarityId");
|
||||
</script>
|
||||
EOL;
|
||||
}
|
||||
if ($_ENV['GA_ENABLED'] === 'true') {
|
||||
$gaId = $_ENV['GA_ID'];
|
||||
echo <<<EOL
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=$gaId"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '$gaId');
|
||||
</script>
|
||||
EOL;
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
<body class="d-flex flex-column h-100">
|
||||
<?php $this->beginBody() ?>
|
||||
@ -90,9 +118,9 @@ $darkMode = Yii::$app->user->isGuest ? 0 : Yii::$app->user->identity->dark_mode;
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
if($darkMode===2){
|
||||
if ($darkMode === 2) {
|
||||
$this->registerJsFile('@web/js/darkmode_auto.js', ['position' => View::POS_BEGIN]);
|
||||
}else if ($darkMode===1){
|
||||
} else if ($darkMode === 1) {
|
||||
$this->registerJsFile('@web/js/darkmode.js', ['position' => View::POS_BEGIN]);
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user