Using something like Mixpanel, you should be able to track anything that happens in your JavaScript code. However, it's not just a insert-a-script-and-sit-back solution; you have to be diligent about the actions you want to track and actually add code to track them as they happen.