Log client side events in javascript