'How to track when all elements of a webpage have been viewed, clicked or changed

I am fairly new to react and i'm trying to implement some code in my application which will track when a user has interacted with any of the elements in the webpage. Any clicks, views or changes in value must be captured and stored.

I have tried adding event-listeners to all the elements in the page but surely there has to be a more efficient way of achieving this? Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source