Context: we have a responsive web application developed in React.js, which we have successfully used a few times to run user studies on Amazon Mechanical Turk. Now, we would like to add interactivity tracking to this app. Concretely, we want to track interaction events, which can be either multi-touch gestures (pinch, zoom, swipe, tap, etc.), mouse clicks, scrolling, etc. We would like to keep track of these things in real time and save them in the app's DB, which currently is a relational database (Postgres). There are many engineering decisions to make, from the library (if any) to use for tracking interactivity events, the granularity of the events (especially for events like pinch, zoom, swipe, scroll which can fire a lot of times per second) and also how to efficiently send the data back to our server and how to store everything in the DB, without degrading the user experience of potentially hundreds of users using the app concurrently.
Does anybody know how to accomplish something like this? Any help will be very appreciated.