谷歌分析将“内部页面”放在首位来自推荐的流量

发布于 2024-11-04 18:16:15 字数 1658 浏览 1 评论 0原文

我有一个技术上的 5 合 1 网站:

5 个链接是: www.purimas-lombok.com(HTML 格式的登陆页面) beachresort.purimas-lombok.com(wordpress 3.0.4) Sparesort.purimas-lombok.com(wordpress 3.0.4) 等

在 WordPress 中,我正在使用 WordPress 的插件谷歌分析。

在谷歌分析中,我希望这 5 个网站看起来像 1 个网站。我在谷歌代码中使用 setDomainName (见下文)。它有效,但“有时”我仍然从推荐中获得不同网站的流量来源。我写“有时”是因为并非一直如此(每天最多 0 到 4 次)。

你知道为什么会这样吗? 插件生成的代码(几乎)相同(见下文) 我检查了它是否存在于 sitescanga.com 的所有页面上,没问题,

谢谢

GA 代码:

#
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
_gaq.push(['_setDomainName', '.purimas-lombok.com']);
_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);
})();
#

由 WordPress 中的插件生成的代码(对我来说是相同的):

#
<script type="text/javascript">//<![CDATA[
// Google Analytics for WordPress by Yoast v4.0.13 | http://yoast.com/wordpress/google-analytics/
var _gaq = _gaq || [];
_gaq.push(['_setAccount','UA-17865992-1']);
_gaq.push(['_setDomainName','.purimas-lombok.com'],['_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>
#

I have a technically 5 in 1 website:

the 5 links are:
www.purimas-lombok.com (landing page in HTML)
beachresort.purimas-lombok.com (wordpress 3.0.4)
sparesort.purimas-lombok.com (wordpress 3.0.4)
etc

In wordpress i'm using the plugin google analytics for wordpress.

In google analytics, I want those 5 website to appear like 1 website. I am using the setDomainName in the google code (see below). It's working but "sometimes" I still get the different websites in traffic source from refferals. I write "sometimes" because it's not all the time (between 0 and 4 max a day).

Do you have any ideas why it's like that ?
The code generated by the plugin is (almost) the same (see below)
I checked it's present on all pages with sitescanga.com and it's oke

Thank you

GA code:

#

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
_gaq.push(['_setDomainName', '.purimas-lombok.com']);
_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);
})();

#

Code generated by the plugin in wordpress (for me is the same):

#

<script type="text/javascript">//<![CDATA[
// Google Analytics for WordPress by Yoast v4.0.13 | http://yoast.com/wordpress/google-analytics/
var _gaq = _gaq || [];
_gaq.push(['_setAccount','UA-17865992-1']);
_gaq.push(['_setDomainName','.purimas-lombok.com'],['_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>

#

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走过海棠暮 2024-11-11 18:16:15

如果人们在您添加 _setDomainName 调用之前访问过该网站,那么他们可能为子域和主域设置了跟踪 Cookie。例如,如果您删除函数调用,然后访问 beachresort.purimas-lombok.com,您将获得 beachresort.purimas-lombok.com< 的 __utma cookie。 /代码>。如果您随后再次添加代码并访问该网站,您将获得 .purimas-lombok.com 的另一个 __utma cookie。

当 GA JavaScript 运行时,它将获取第一组 cookie,但当用户浏览到另一个子域时,它不会识别旧域中的 cookie 并设置新的 cookie。例如,使用与上述相同的情况,当您从以下位置访问 sparesort.purimas-lombok.com
beachresort.purimas-lombok.com 它将查找来自 .purimas-lombok.com 的 cookie,但找不到它们,因为只有来自 beachresort.purimas-lombok 的 cookie .com 将出现在浏览器上(事实上,由于跨域安全策略,脚本甚至无法访问它们)。创建新 Cookie 时,__utmz Cookie 将使用新的引荐来源网址 (beachresort.purimas-lombok.com) 设置。

随着时间的推移,这个问题应该会减少,但如果这是一个严重的问题,那么您可以编写一个脚本,在运行 GA 代码之前删除旧的 cookie。 JavaScript 需要检查页面上的 cookie,并删除使用 GA __utm 方案命名并链接到完整域名的 cookie。

If people visited the site before you added the _setDomainName call then it's possible they have tracking cookies set for both the subdomain and main domain. For example, if you remove the function call then visit beachresort.purimas-lombok.com you will get a __utma cookie for beachresort.purimas-lombok.com. If you then add the code again and visit the site you will get another __utma cookie for .purimas-lombok.com.

When the GA JavaScript runs it will pick up the first set of cookies but when the user browses to another subdomain it won't recognize the cookies from the old domain and set new ones. For example, using the same situation as above, when you visit sparesort.purimas-lombok.com from
beachresort.purimas-lombok.com it will look for cookies from .purimas-lombok.com but not find them because only the cookies from beachresort.purimas-lombok.com will be present on the browser (in fact the script won't even have access to them because of the cross domain security policy). When the new cookies are created, the __utmz cookie will be set with the new referrer (beachresort.purimas-lombok.com).

This problem should reduce over time but if it's a serious issue then you could write a script that removes the old cookies before running the GA code. The JavaScript would need to go through cookies on a page and delete ones named using the GA __utm scheme and linked to the full domain name.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文