Google analytics 做谷歌分析';从子域的默认计数视图?

Google analytics 做谷歌分析';从子域的默认计数视图?,google-analytics,Google Analytics,我在谷歌分析上的个人资料是(没有www)。我的网站上的这个脚本: var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-xxxxx-2']); _gaq.push(['_trackPageview']); (function() {

我在谷歌分析上的个人资料是(没有www)。我的网站上的这个脚本:

                        var _gaq = _gaq || [];
                          _gaq.push(['_setAccount', 'UA-xxxxx-2']);
                          _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);
                          })();
Google Analytics将统计subdomain.example.com的浏览量


还有一个问题,我想从static.example.com免费获得google analytics的cookies。我试过put
\u gaq.push(['''u setDomainName','example.com'])但仍然可以在firebug上的static.example.com图像上看到Cookie。

如果您有子域,则应在每个子域上使用以下代码:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-2']);
_gaq.push(['_setDomainName', '.example.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);
})();

但请注意,这将导致cookie也被发送到静态子域。隔离静态域的最佳方法是将其作为不同的域,而不是不同的子域。如果您将GA cookie存储在完整域而不是顶级域中,您将清除静态域,但正确设置GA将困难得多。

事实是,您的GA帐户将在任何包含您的跟踪器(使用您的GA帐户)的页面上“跟踪页面浏览量”(除非您设置了特殊过滤器)。现在,它不会在域/子域之间共享推荐人信息,除非它设置为这样做,但从技术上讲,有人可以在他们的站点上放置你的跟踪代码,以夸大你的站点统计数据

同时,您可以看到包含该代码的内容(页面URL)。我不知道为什么会有人想这样做,但这是假设可能的