使用Google Analytics没有Javascript? [英] Using Google Analytics without Javascript?

查看:112
本文介绍了使用Google Analytics没有Javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在不支持JavaScript或任何服务器端脚本的网站上使用Google Analytics代码? (例如网站上的一个简档页面,允许使用HTML )。



我发现分析代码可以不用通过直接调用跟踪图像来使用JavaScript并使用它发送一些数据。我还发现了一些链接,但他们也使用服务器端代码。 解决方案

技术上来说,是的,因为所有你需要做的是来自Google的__utm.gif请求,并附有合理的查询字符串。这篇没有javascript或cookie的Google Analytics(分析)可以很好地概述__utm.gif请求的样子。



Google Analytics实际上有一个非常标准的

如果没有动态语言,GA不会100%工作(并且根本无法工作)。首先,GA依赖于javascript(或服务器端语言)来设置用户的utm cookies,该cookie用于跟踪访问者信息的来源,以及哪些帮助将单次访问的浏览量关联起来。



由于您可能只想跟踪单个页面的点击次数,我们可能会取消这一点,尽管我不完全确定GA不会仅仅通过某种形式垃圾邮件过滤器。



但是,所有这一切,如果你想尝试这样做,我会在页面上放置一个1x1图片,其代码如下:

  http://www.google-analytics.com/__utm.gif?utmwv=5.1.7&utms=1&utmn=1894752493& utmhn = www.lunametrics.com&安培; utmcs = UTF-8和; utmsr = 1280×1024安培; utmsc = 24比特及utmul = EN-US&安培; utmje = 1&安培; utmfl = 10.3%20r183&安培; utmdt =跟踪%20QR%20Codes% 20with%20Google%20Analytics&安培; utmhid = 1681965357&安培; utmr = HTTP%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dtracking%2Bqr%2Bcodes%26ie%3Dutf-8%26oe%3Dutf-8%2 6AQ%3DT%26rls%3Dorg.mozilla%3Aen-US%3Aofficial%26client%3Dfirefox-A和UTMP =%2Fblog%2F2011%2F08%2F18%2Ftracking-QR码-谷歌-Anaytics(分析)%2F&安培; utmac = UA-296882 -1&安培; utmcc = __ UTMA%3D230887938.1463229748.1317737798.1317737798.1317737798.1%3B%2B__utmz%3D230887938.1317737798.1.1.utmcsr%3Dgoogle%7Cutmccn%3D(有机)%7Cutmcmd%3Dorganic%7Cutmctr%3Dtracking%2520qr%2520codes%3B&安培; utmu = DC〜

您需要修改源代码以适应您所在的网站跟踪 - 请参阅此 LunaMetrics帖子以供参考。至少,您需要更改utmhn(主机名),utmr(referrer),utmp(当前URI)和utmac(您的GA帐号)。

Is it possible to use the Google Analytics code on a website which does not support javascript or any server side scripting? (For example a profile page on a website which allows to use only HTML).

I have found out that analytics code can be used without using the javascript by calling the tracking image directly and send some data with it. I also found a couple of links but they use server side code also.

解决方案

Technically, yes, since all you need to do is request __utm.gif from Google with a reasonable query string attached. This blog post on Google Analytics without javascript or cookies gives a good overview of what the __utm.gif request looks like.

Google Analytics actually has a pretty standard php implementation, but I take it you want to do this without any dynamic language at all - just one static tracking pixel to register a count of pageviews?

There are a lot of reasons why GA is not going to work 100% (and may not work at all) without a dynamic language. Primarily, GA depends on javascript (or a server side language) to set a user's utm cookies, which keep track of info about the visitor's source, and which help associate pageviews from a single visit.

Since you may just want to track a count of hits to a single page, we may be able to do away with this, although I am not completely sure that GA will not just filter our hits automatically with some sort of junk filter.

But, all that said, if you want to try this, I'd place a 1x1 image on the page with the following source:

http://www.google-analytics.com/__utm.gif?utmwv=5.1.7&utms=1&utmn=1894752493&utmhn=www.lunametrics.com&utmcs=UTF-8&utmsr=1280×1024&utmsc=24-bit&utmul=en-us&utmje=1&utmfl=10.3%20r183&utmdt=Tracking%20QR%20Codes%20with%20Google%20Analytics&utmhid=1681965357&utmr=http%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dtracking%2Bqr%2Bcodes%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dorg.mozilla%3Aen-US%3Aofficial%26client%3Dfirefox-a&utmp=%2Fblog%2F2011%2F08%2F18%2Ftracking-qr-codes-google-anaytics%2F&utmac=UA-296882-1&utmcc=__utma%3D230887938.1463229748.1317737798.1317737798.1317737798.1%3B%2B__utmz%3D230887938.1317737798.1.1.utmcsr%3Dgoogle%7Cutmccn%3D(organic)%7Cutmcmd%3Dorganic%7Cutmctr%3Dtracking%2520qr%2520codes%3B&utmu=DC~

You'll need to adapt the source a little bit to fit the site you are tracking - see this LunaMetrics post for reference. At the very least, you'll need to change utmhn (hostname), utmr (referrer), utmp (current URI), and utmac (your GA account number).

这篇关于使用Google Analytics没有Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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