我有一个网站 www.xxxxx.com,如果访问者使用移动设备,该网站会将访问者引导至 www.xxxxx.com/mobile。我使用 JavaScript 代码来检测它们是否在移动设备上并将它们定向到移动子文件夹。代码如下:
<script type="text/javascript">
<!--
if (screen.width <= 679) {
window.location = "http://www.xxxxx.com/mobile/";
}
//-->
</script>
一切都运行良好,但问题是,如果访问者被定向到移动设备,谷歌分析不会保留主网站的原始引荐来源网址。例如,如果客户搜索 X 公司并通过手机访问我们的 www.xxxxx.com,并且他们被定向至 www.xxxxx.co/mobile,则 Google 分析会将此访问者显示为“直接访问者”,而不是显示“推荐人”网站”或搜索的关键字。
如何查看原始推荐人和搜索到的关键词? 提前谢谢了。
最佳答案
查看有关 Causes for self-referrals > Redirects and Self-referrals 的 Google 文档:
meta refresh and javascript based redirects
Non server-side invoked redirects such as the meta refresh html tag or javascript window.location methods may hide or obscure referrer information from Google Analytics, therefore we don’t recommend using such methods on any page that is likely to be a landing page.
关于javascript - 当定向到移动网站时,谷歌分析会丢失引荐来源网址的跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24695365/