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

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

问题描述

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

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

我们为生产机器设置了 Google Analytics,并且运行良好.我想设置一个 Google Analytics 帐户来监控我们的测试系统,这样我就可以在不影响/污染我们的生产数据的情况下测试各种功能.我设置了一个测试系统和一个测试 Google Analytics 帐户.但是,测试 Google Analytics 帐户永远不会从测试系统接收数据.

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.

根据我的调查,问题似乎是我的测试系统被称为localhost"而不是test.mycompany.com",因此 Javascript 使用的 document.domain 属性是localhost"而不是它应该是test.mycompany.com" URL.这导致 Google Analytics cookie 被错误地写入(我认为),因此 Google Analytics Javascript 代码永远不会向我的 Google Analytics 帐户发送数据.

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.

有什么办法可以在 Tomcat 6 中设置这个document.domain"属性,让这个系统认为它是test.mycompany.com"而不是localhost"?

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"?

我已经检查了 Tomcat 文档和 Google Analytics 文档,但它们都没有直接解决这一点.

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

任何帮助将不胜感激.

推荐答案

在测试服务器上打开你的防火墙,以便 google 可以访问它并使用 add this in the snipet

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

也为 ga 打开防火墙

also open your firewall for ga

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

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

因此,HTTP 端口 80,HTTPS 端口 443 和站点:

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天全站免登陆