2 ms·
I agree, a lot of the useful stuff comes from the navigator object - browser, language, plugins etc. The window object provides screen height, width and colour
by richbradshaw 15y ago
I agree, a lot of the useful stuff comes from the navigator object - browser, language, plugins etc.
The window object provides screen height, width and colour depth.
Modern browsers have geolocation as a JS API, but if you want it to be less accurate/less intrusive then an ajax request to a script that does a geo lookup on the IP would supply that.
The time on site and visits can be done by storing information in localStorage, or whatever the IE equivalent is called.
There are a few harder bits, but replicating most of the low hanging fruit is trivial for any web developer.
- sanderjd 15y agoI went to the site expecting it to be an open-source library providing one convenient API into all the things you mention. In fact it wasn't until I went to the top menu looking for a Github or download link that I realized it was a hosted for-pay service. I think a library bringing all those things together (maybe without the geolocation part) would be useful, and I don't personally know of one.
- codejoust 15y agoI liked the idea, and had already needed parts of such a library, so I put together some stuff and made a free/open-source version. https://github.com/codejoust/visitor.js https://github.com/codejoust/visitor.js
- josscrowcroft 15y agoWhoa! Super impressed you turned this out so quickly. You should post it as a 'Show HN' story! Also, props for renaming it to session.js (I think it's unfair to use their name) This might spur the visitor.js guys to release part of their codebase as open source and continue to provide a paid service with extra support and features etc.