I have a friend who worked in computer vision at Carnegie Mellon and talked about automatically estimating focus levels. I'm not aware of any successful product that gathers these metrics though. Here's some papers from a quick web search:
- Monitoring Students’ Attention in a Classroom Through Computer Vision: https://link.springer.com/chapter/10.1007/978-3-319-94779-2_...
- Focus Estimation in Academic Environments Using Computer Vision: https://link.springer.com/chapter/10.1007/978-3-030-31332-6_...