I. 为什么
做站点,访问来源数据分析很重要。我的域名没有备案,被百度收录的可能性微乎其微,所以更多的流量可能来自各社群,推特,脸书等的推广,以及谷歌搜索。
就在前两天,在隐身模式下搜索了 limbopro ,已经可以看到一些进展,部分关键词匹配的刚刚好,虽然排名不是很靠前,但未来在内容更新提高各个内容的相关度,谷歌搜索结果应该会好一些。
II. 怎么做
登录你的Google adsense或Google analytics,设置网站的相关信息,并获取 代码,将代码插入到 header.php 和 footer.php 内即可。(全局引入)具体操作如下...
进入管理后台 控制台 外观 编辑当前外观
步骤图
header 部分
Typecho 外观脚本增加谷歌广告与引擎优化
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<!DOCTYPE HTML>
<html class="no-js">
<head>
<meta charset="<?php $this->options->charset(); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
##代码插在这个位置即可
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-4573757070775891",
enable_page_level_ads: true
});
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-140019039-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-140019039-1');
</script>
##到这里结束
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php $this->archiveTitle(array(
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
), '', ' - '); ?><?php $this->options->title(); ?></title>
<!-- 使用url函数转换相关路径 -->
<link rel="stylesheet" href="//cdnjscn.b0.upaiyun.com/libs/normalize/2.1.3/normalize.min.css">
<link rel="stylesheet" href="<?php $this->options->themeUrl('grid.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('style.css'); ?>">
<link rel="shortcut icon" href="https://limbopro.xyz/usr/themes/default/favicon.ico"type="image/x-icon" />
<!--[if lt IE 9]>
<script src="//cdnjscn.b0.upaiyun.com/libs/html5shiv/r29/html5.min.js"></script>
<script src="//cdnjscn.b0.upaiyun.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<!-- 通过自有函数输出HTML头部信息 -->
<?php $this->header(); ?>
</head>
<body>
<!--[if lt IE 8]>
<div class="browsehappy" role="dialog"><?php _e('当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>'); ?>.</div>
<![endif]-->
<header id="header" class="clearfix">
<div class="container">
<div class="row">
<div class="site-name col-mb-12 col-9">
<?php if ($this->options->logoUrl): ?>
<a id="logo" href="<?php $this->options->siteUrl(); ?>">
<img src="<?php $this->options->logoUrl() ?>" alt="<?php $this->options->title() ?>" />
</a>
<?php else: ?>
<a id="logo" href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a>
<p class="description"><?php $this->options->description() ?></p>
<?php endif; ?>
</div>
<div class="site-search col-3 kit-hidden-tb">
<form id="search" method="post" action="<?php $this->options->siteUrl(); ?>" role="search">
<label for="s" class="sr-only"><?php _e('搜索关键字'); ?></label>
<input type="text" id="s" name="s" class="text" placeholder="<?php _e('输入关键字搜索'); ?>" />
<button type="submit" class="submit"><?php _e('搜索'); ?></button>
</form>
</div>
<div class="col-mb-12">
<nav id="nav-menu" class="clearfix" role="navigation">
<a<?php if($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a>
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while($pages->next()): ?>
<a<?php if($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
<?php endwhile; ?>
</nav>
</div>
</div><!-- end .row -->
</div>
</header><!-- end #header -->
<div id="body">
<div class="container">
<div class="row">
footer部分
III. Typecho 外观脚本增加谷歌广告与引擎优化
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
</div><!-- end .row -->
</div>
</div><!-- end #body -->
<footer id="footer" role="contentinfo">
© <?php echo date('Y'); ?> <a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title(); ?></a>.
<?php _e('由 <a href="http://www.typecho.org">Typecho</a> 强力驱动'); ?>.
</footer><!-- end #footer -->
<?php $this->footer(); ?>
###只要插在 Body 中间任意位置均可
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-140019039-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-140019039-1');
</script>
###结束
</body>
</html>
版权属于:毒奶
联系我们: https://limbopro.xyz/6.html
毒奶搜索: https://limbopro.xyz/search.html点击展开探索更多资讯频道: https://t.me/limboprossr
春潮频道: https://t.me/limboprogarden
推特账号: https://twitter.com/limboprossr
爱菊账号: https://www.instagram.com/limboprossr/
油管账号 : http://bit.ly/2VJcz7o/
机场推荐: https://limbopro.xyz/865.html
上网必会: https://limbopro.xyz/archives/2910.html
广告屏蔽: https://limbopro.xyz/archives/adguard.html
实用工具: https://limbopro.xyz/category/tools/
网站优化: https://limbopro.xyz/category/Typecho/
美图欣赏: https://limbopro.xyz/category/instagram/
开车专栏: https://limbopro.xyz/category/NSFW/
博客镜像: https://limbopro.github.io(每日0点更新)本文链接:https://limbopro.xyz/archives/396.html
本文采用 CC BY-NC-SA 4.0 许可协议 ,转载和引用时请注意遵守协议!