from Hacker News

Open Source Visitor.js

by codejoust on 1/6/12, 10:39 PM with 52 comments

  • by memnips on 1/7/12, 12:58 AM

    It is now apparently Session.js https://github.com/codejoust/session.js
  • by bradly on 1/7/12, 12:38 AM

    Here is a live demo showing your own information. http://visitorjs.herokuapp.com/

    Fyi: I am not storing the information.

  • by dsl on 1/7/12, 12:55 AM

    Damn, you beat me to it. After I saw the original visitor.js was a paid service (which blew my mind), I started hacking together the JS implementations of most of the functionality I had laying around already.
  • by gojomo on 1/7/12, 2:12 AM

    The original visitor.js identified my city correctly; this only put me in the USA.

    Is there a free reliable precise geolocation service that can take as many hits as a script like this could throw at it?

  • by peteretep on 1/7/12, 1:13 AM

    I'm glad you've done this, because I'd have wasted a few hours on it I didn't have otherwise :-)
  • by tonywebster on 1/7/12, 12:18 AM

    I love when disruption disrupts disruption.
  • by grantjgordon on 1/7/12, 1:04 AM

    I don't think there are any ethical issues here. The paid service is doing something that was mostly, if not completely, available in other open source projects such as piwik and OWA in the first place. It's very educational to look at the differences in the way codejoust implemented his javascript vs. these other projects, and very convenient that you don't have to dig through a gigantor open source code base to do it.
  • by slavin on 1/7/12, 12:28 AM

    I don't understand the pricing model behind visitorjs, and we had to implement a similar solution at my company. But the fact is - they created something and shared it here. If you think you can do a better job at it - fine, but why haven't you done it before, or at the very least named it differently. I don't mean to exaggerate, but it just doesn't feel ethical to me.
  • by DannyPage on 1/7/12, 6:40 AM

    What are the ethical concerns about using this and storing the data? If I wanted to use this on my site, should I let visitors know, or is this data fair game to store? I rather not use the location data (or any of it) if there could be an issue.
  • by Flimm on 1/7/12, 12:02 AM

    Is this version created or endorsed by the authors of the other Visitor.js implementation?
  • by latchkey on 1/6/12, 11:56 PM

    The best part about this whole thing is the location lookup. Seriously nice job.
  • by josscrowcroft on 1/7/12, 2:36 AM

    I'm super impressed you turned this out so quickly. I think that really sums up the spirit in the HN community...

    When you look at something that seems overpriced (or wrongly-priced) and you say "hey, I bet I could do this"

    I still see value in potentially paying for a service like this when it's a big enough pain-point. But I really think they'd have had more traction with a open-source-to-paid model, where anyone can use the client-side code for free, but the extra stats and support provided are worth paying for.

  • by mise on 1/7/12, 8:45 PM

    Having a "first session" and "current session" exposes very interesting functionality. It suddenly provides a quick way to keep track of what search keywords they used to get to the site, and could be later linked to an account if later created.
  • by sbarre on 1/7/12, 1:49 PM

    location is either "null" or "err/google" for me all the time.

    Although I am probably an edge-case, I'm tethering from an iPhone on Rogers in Canada.

    Visitor.js (the paid service) correctly positions me in Toronto, Canada though.

  • by wehriam on 1/7/12, 5:16 AM

    Outstanding! I also was going to have to re-implement this.
  • by dchuk on 1/6/12, 11:45 PM

    well...that didn't take long
  • by jpulgarin on 1/7/12, 3:13 AM

    Localization doesn't seem to work very well. I'm in Waterloo, Canada. This is what the script outputs for me:

    > session.locale.country

    "US"

    > session.locale.location

    undefined

  • by kmax12 on 1/6/12, 11:41 PM

    where's the server stuff? is google providing everything that the pay service did, but for free?
  • by tomhallett on 1/7/12, 12:16 AM

    i'm curious about the timing here.

    did you see vistor.js hit HN and rewrite it in a few hours? or were you working on this in isolation and when you saw it on HN decided it was the perfect time to ship?

  • by dlitz on 1/8/12, 4:38 PM

    Visitor.js should be the new FizzBuzz
  • by desireco42 on 1/7/12, 2:35 AM

    The only thing that would make this better is to have it in coffeescript... :) which I might do for you if you don't.
  • by alpb on 1/7/12, 12:55 AM

    Gives 404?
  • by buremba on 1/7/12, 12:58 AM

    404?
  • by necenzurat on 1/7/12, 1:28 AM

    after reading visitorjs.com thread i asked myself WHY

    Question: who would pay 10 bucks a month for using a js file for 30K requests?