I am interested in learning about the code and mechanism that detects when a specific section of a webpage has been viewed (purely for educational purposes).
For instance, on websites like StackExchange it tracks when someone has thoroughly read the "about" page (and gives them a badge). What kind of function/code/language is responsible for monitoring this?
Or alternatively, how can I locate and identify the source of this function within a webpage's code?