Hacker News new | ask | show | jobs
by nrbafna 4471 days ago
I am wondering what the 5 lines for MVP were. Anyone mind taking a shot?
1 comments

This is referring to the integration code itself. It was something like:

  var DOMEvents = ['click', 'submit', 'change'];
  for (var i = 0; i < DOMEvents.length; i++) {
    window.addEventListener(DOMEvents[i], function(e){
      $.post('/collector', {type: e.type, target_id: e.target.id, target_class: e.target.className});
    });
  }
That's interesting and immediately obvious how it could both be useful and valuable in the right domain. Logging what people are doing on modern event-driven websites definitely is a problem worth solving. My let's-made-a-complicated-version-first mindset would have extended jQuery's .bind or .on prototype in case the site is using event.stopPropagation(), and that's why I never finish anything. Thanks for sharing.
This is rocksolid basic script..one quick question..if you post on every event then dont you think so that it will generate huge traffic..how did you handle that