JavaScript Detection / Browser Statistics

荒凉一梦 提交于 2019-12-21 07:37:26

问题


This has been asked few times but I think it's still worth checking with you guys for some more input.

All my websites use Google Analytics for stats. Since it relies on JavaScript I thought it was important for me to check how many people actually have JS enabled in their browsers enabled/disabled.

I remember I usually checked w3schools browser statistics, and recent results show something around 95% which was quite satisfactory for me. But since it applies purely on their website, I thought I'd check what was it on mine. I tried few methods but recently I count all page views and all downloads of my main.js file (caching prevented by "cache killer" variable added to file path). This method has few drawbacks, since it doesn't recognise google's robot (or any other), but it's still accurate enough.

Surprisingly only 68% of people visiting my biggest website has JS enabled (other methods - e.g. using cookies - I tried showed similar number). I'd love to be told that my method is completely wrong and that's why the number is so low.

Since I build websites that don't rely on JS to work, that's still ok from functional point of view, but this also means that 32% of entries to my websites are being counted by Analytics! That's a huge drawback.

Is there any other website (other than w3schools) that shares their stats? Or a survey I could compare my numbers to? Maybe even some of you could share yours?

Now I am considering creating my own stats engine. But is there any other (than Analytics) reliable (and free) stats solution you could suggest? One that would actually check if people have JS enabled?

Any suggestions on JS detection are also more than welcome.


回答1:


Is there any other website (other than w3schools) that shares their stats?

Thecounter.com has a couple statistical analysis: http://www.thecounter.com/stats/

Here is a link with javascript stats from March 2009.

Javascript 1.2+: 61865673 (93%)
Javascript <1.2: 112854 (0%)
Javascript false: 4393090 (6%)

Or a survey I could compare my numbers to?

My recommandation would be to make your own stats. Your own users are the ones that matter. For instance building an website for people with accesibility issues or one for a mobile device would mean that you're not expecting too many visits with js enabled.

But is there any other (than Analytics) reliable (and free) stats solution you could suggest? One that would actually check if people have JS enabled?

Statcounter seems to have what you need: http://www.statcounter.com/features/#javascript-stats

Here is a list with a few others: http://www.hongkiat.com/blog/top-14-free-web-statistics-tools/




回答2:


This method has few drawbacks, since it doesn't recognise google's robot (or any other)

So, in theory it is possible that all those 32% of visits were done by bots?

I'd say it's a huge drawback.

You should try removing bots from the equation and see how it looks then.




回答3:


Testing to see if a JS file downloaded or not is not a good way to test to see if JS is supported as the file could be downloaded, parsed, and then not used. Or it could just not be downloaded.

One way to test to see if JS is enabled is to have a stat counting every page hit and adding that to the database. Then have a JS function that posts to a special page that appends a value to the page listing using AJAX that tells it that JS is working on that page. Then you can filter your db and see how many of those pages have JS enabled or not.



来源:https://stackoverflow.com/questions/985784/javascript-detection-browser-statistics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!