The website event tracking, statistics user data

  node.js, question

I want to count all the interactive behaviors of users on my website, such as the time spent on a certain page, the jump-out time, and which product (there will be many pages) was clicked. I don’t know how to realize the principle of js, I hope I can answer it if I know.

Do a common onclick, according to the different incoming parameters, record the user’s operations. Store these records in cookie