3 ms·
For smaller websites the "send ping every X seconds", and/or combo of that with "onLoad do +1, onUnload do -1" might work. Though for really big websites - wit
by techcode 5y ago
For smaller websites the "send ping every X seconds", and/or combo of that with "onLoad do +1, onUnload do -1" might work.
Though for really big websites - with millions of users making requests to 1000s of web/api servers spread across DCs in different continents ... It's indeed a variant of what you said.
Analytics can give you confidence to say that X percentile of people spend at least Z seconds/minutes on given page. So you can use initial request + TTL value of Z.
---
PS All of the above is at least order of magnitude (if not even bigger) more complex when your page is not simply one physical product, and instead you've got "product x between Start and End dates" since that's millions of products x millions of combinations.