We noticed that link counters won’t increase if you right-click on them and select ‘open in new tab’, or if you use the middle mouse button on them.
That’s because it’s a browser function, there’s no click action to catch. AFAIK the destination page won’t see a referrer either, it’s akin to copy-pasting the URL into the address bar.
does the same issue happen for middle click or control click?
That makes sense, thanks!
It does. I included that in my post
The <a ping> attribute could be used to increment the counter.
Caveats:
- It’s disabled by default in Firefox.
- there don’t seem to be any JS events for it, so the counter would only visibly be updated the next time the post was visited.
NB: It seems like “mousedown
” events are triggered on middle click, but that would have false positives as not every click ends up being a navigation - eg. copy link, customised browser settings.
There is MouseEvent.button
, which is 1
which is for “Auxiliary button pressed, usually the wheel button or the middle button (if present)”.
I think this is fine. I don’t think we want to count strictly the amount of times the linked page was loaded, rather just “link interactions”. I think “copy link” should also increase the counter, just as simply left clicking the link does.
In addition, I think most people don’t simply left-click such links: they usually want to open it in a new tab such that the original forum post is still open and they don’t have to navigate back and forth.
I middle-click everything. Except on Discourse, where I middle-click, remember that doesn’t increment the counter, and then return to the page to left-click.
I know it’s documented behaviour, but I really hate this.
I’m sure most people would be fine with the counters over-counting rather than under-counting. At least that way you know people interacted with a link, whereas currently lots of people can follow a link but the damn counter never goes up.
What makes you think this @Pod?
The counters exist to display engagement. Every kind of click is some form of engagement, thus the over counting method is far more reflective of the actual engagement, and I imagine that most other people would want to see how frequently the links are engaged with.
Conversely, I doubt anyone wants to see a count of how many times a link was clicked with only the left mouse button, or a short-press on a phone. That specific detail doesn’t seem important to non-developers.
I’ve seen plenty of conversations happen around links that have only 1 or 2 clicks listed, despite 10s of people discussing the item. The undercounting method you currently use is very inaccurate as all of those people followed the link, but they didn’t do so in the narrow set of parameters Discourse currently tracks.
I didn’t know this attribute.
Here’s the current browsers compatibility:
Generally supported except for Firefox by default, indeed.