让Google Analytics查看测试服务器 [英] Getting Google Analytics to see a test server

查看:107
本文介绍了让Google Analytics查看测试服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个涉及Google Analytics和Tomcat的概念性简单问题,但我无法解决它。

我们为我们的生产机器设置了Google Analytics,并且工作正常。我想建立一个Google Analytics帐户来监控我们的测试系统,这样我就可以测试各种功能,而不会影响/污染我们的生产数据。我有一个测试系统设置,并测试谷歌分析帐户。但是,测试Google Analytics(分析)帐户永远不会从测试系统接收数据。

从我的调查来看,问题在于我的测试系统被称为本地主机而不是test.mycompany.com和文档。因此,Javascript使用的域属性是localhost,而不是它应该是的test.mycompany.comURL。这导致Google Analytics Cookie被错误地写入(我认为),因此Google Analytics Javascript代码从未将数据发送到我的Google Analytics帐户。



有没有办法在Tomcat 6中设置这个document.domain属性,这样系统会认为它是test.mycompany.com而不是localhost ?



我已经检查了Tomcat文档和Google Analytics文档,但都没有直接说明这一点。


解决方案

在测试服务器上打开防火墙,以便Google可以访问它并使用添加snipet

  _gaq.push(['_ setDomainName','none']); //必须在_trackPageview之前放置

也打开防火墙for ga

  https://ssl.google-analytics.com/__utm.gif 
http://www.google-analytics.com/__utm。 gif

  http://www.google-analytics.com/ga.js 

所以,端口80用于HTTP,用于HTTPS的端口443和站点:

  ssl.google-analytics.com 
www.google-analytics.com


I have a conceptually simple problem involving Google Analytics and Tomcat, but I cannot solve it.

We have Google Analytics set up for our production machine and it is working fine. I want to set up a Google Analytics account to monitor our test system so I can test various features without affecting/polluting our production data. I have a test system set up, and a test Google Analytics account. However, the test Google Analytics account never receives data from the test system.

From my investigation, it appears that the problem is that my test system is being referred to as "localhost" instead of "test.mycompany.com" and the document.domain property used by Javascript is therefore "localhost" instead of the "test.mycompany.com" URL that it should be. This is causing the Google Analytics cookies to be written incorrectly (I think) and therefore the Google Analytics Javascript code is never sending data to my Google Analytics account.

Is there any way to set this "document.domain" property in Tomcat 6 so that this system will think it is "test.mycompany.com" instead of "localhost"?

I have examined both the Tomcat docs and the Google Analytics docs, but neither of them address this point directly.

Any help would be appreciated.

解决方案

Open your firewall on the test server so google can access it and use add this in the snipet

_gaq.push(['_setDomainName', 'none']); //has to be place before _trackPageview

also open your firewall for ga

https://ssl.google-analytics.com/__utm.gif
http://www.google-analytics.com/__utm.gif

and

http://www.google-analytics.com/ga.js

So, port 80 for HTTP, port 443 for HTTPS and the site(s):

ssl.google-analytics.com
www.google-analytics.com

这篇关于让Google Analytics查看测试服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆