如何阻止 GA 跟踪页面标题?将
_setDetectTitle
设置为 false
仍会将请求中的页面标题发送到 GA 服务器 (utmdt
)。由于隐私问题,我不希望页面标题离开浏览器。有什么想法吗?
我尝试后效果很好。这是我正在使用的代码:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_setDetectTitle', false]);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>