During code-review of 443569 , some potential performance optimizations to the ReadingDepth.js code were identified. See: https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WikimediaEvents/+/443569/6/modules/all/ext.wikimediaEvents.readingDepth.js@271
Specifically, it would be beneficial to exit the function early when a browser don't support event-logging (or sendBeacon specifically). That would avoid unnecessarily accessing localStorage to get the value of mw.user.sessionId. To achieve this, some logic should be factored out to check for browser-compatibility first, before deciding whether to enable the logging.