在没有 Javascript 的情况下使用 Google Analytics? [英] Using Google Analytics without Javascript?

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

问题描述

是否可以在不支持 javascript 或任何服务器端脚本的网站上使用 Google Analytics 代码?(例如网站上的个人资料页面,它只允许使用 HTML).

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).

我发现通过直接调用跟踪图像并随其发送一些数据,可以在不使用 javascript 的情况下使用分析代码.我还找到了几个链接,但它们也使用服务器端代码.

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.

推荐答案

从技术上讲,是的,因为您需要做的就是从 Google 请求 __utm.gif 并附加一个合理的查询字符串.这篇关于 没有 javascript 或 cookie 的 Google Analytics 很好地概述了 __utm.gif 请求的外观.

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 实际上有一个非常标准的 php 实现,但我相信你想要在完全不使用任何动态语言的情况下执行此操作 - 只需一个静态跟踪像素来记录浏览量计数?

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?

如果没有动态语言,GA 无法 100% 工作(并且可能根本无法工作)的原因有很多.首先,GA 依赖 javascript(或服务器端语言)来设置用户的 utm cookie,它跟踪有关访问者来源的信息,并帮助关联来自单次访问的综合浏览量.

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.

由于您可能只想跟踪单个页面的点击次数,因此我们可以取消此操作,尽管我不完全确定 GA 不会仅使用某种垃圾过滤器自动过滤我们的点击次数.

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.

但是,综上所述,如果您想尝试此操作,我会在页面上放置一个 1x1 图像,其来源如下:

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~

您需要稍微调整来源以适应您正在跟踪的网站 - 请参阅此 LunaMetrics 帖子 供参考.至少,您需要更改 utmhn(主机名)、utmr(引用者)、utmp(当前 URI)和 utmac(您的 GA 帐号).

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).

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

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