Page MenuHomePhabricator

Consider moving echo.unseen counter to JS
Open, Needs TriagePublic

Description

We have two counters that, together, aim to measure the click rate on notifications badges that indicate that there are unseen notifications. The echo.unseen counter is incremented every time an unseen badge is rendered; this is done [[https://github.com/wikimedia/mediawiki-extensions-Echo/blob/f402ecd31fd080481447a85d5a5f2ab2c0bf92cb/includes/EchoHooks.php#L1046-L1049|server-side in EchoHooks::onPersonalUrls()]]. The echo.unseen.click counter is incremented every time an unseen badge is clicked; this is done client-side in ext.echo.int.js.The idea appears to be that echo.unseen.click / echo.unseen is the click rate for unseen badges (I can't find any dashboards that graph this currently, but I believe this rate was graphed in the past). However, this is not an apples-to-apples comparison, because page views with JS disabled will increment the echo.unseen counter but not the echo.unseen.click counter.

I think we should consider moving the code that increments the echo.unseen counter to JS, so that we only increment it if we know we're also going to be able to increment the echo.unseen.click counter if the badge is clicked.

Alternatively, if the goal is to find out how many page views it takes for unseen notifications to become seen (either through JS or through visiting Special:Notifications), then we could have a separate server-side counter for that purpose. This was explored (with some code too) in T114841.