How do I create a log/statistics of on page events?
Since, you've built everything in js, next thing to do is send the data from the client. You could do that with an endpoint in a custom module and sending everything you want there with ajax.
From there it depends how often you anticipate db writes from these data and you can assess the next step to take. You could: 


Create a content type and programmatically save data to it.
Create a custom db table with only the fields you want and implement some db logic to save data.
Use mongoDB and setup a document table to store these data. This is the best option performance wise. You would need to setup the mongoDB module for it.