Editing a post removes link count

This is something I’ve noticed as of late and I don’t know if it’s related to this topic

This not very consistent and a little random so it hard to pin down but sometimes when I edit a post, if there’s a link in that post with a “clicked” counter (on the same community but a different topic), when I save the post, the counter disappears. As it not reset, but disappears. Now when someone clicks on it it no longer registers how many clicks.

Why is the behavior inconsistent? The ones I’ve seen this happen with are posts with just one link in them.

Just for clarity, I don’t touch the links while editing the post but edit other content in the post, e.g. replace the image or modify the text

There’s been a lot of issues in the past


Both @david and @zogstrip have worked on this previously.

So it works if there are multiple links? We need a consistent repro.

I do understand the value/need for a consistent repro, unfortunately it is not. I’m seeing it on other forums running discourse like samsung ST. Trying to gleam more details, at this time it only seems to affect posts with a single link sometimes.

Here’s the weird thing, say a link e.g. https://meta.discourse.org/t/editing-a-post-removes-link-count/119961 was collecting link counts. Now I edit the post (don’t touch the link) and save it.

Not only is the post no longer showing the count, its’ stopped counting the number of times the link is being used.

That’s the really weird part, what would cause the post to stop counting the links at all? In your post it doesn’t count the number of time the link you posted was clicked, but in some posts it does even for internal links.

Did you refresh the browser after editing.

1 Like

Yes multiple times, it’s stopped tracking the link counts when this happens. Tried a different computer as well just to ensure.

What are the exact repro steps? Can you repro this @justindirose?

The exact steps I’ve followed steps are simply, edit a post, change some content (don’t touch the link) -> Save it. The link count disappears and the link count is no longer tracked (still clickable)

I’ve seen this happen with BOTH, internal AND external links.

However as I mentioned, it doesn’t happen with all links/posts. It seems to happen with posts with one link but I can also PM URLs’ where it’s happening with posts with multiple external links which are no longer showing the link counter.

I just tried repro’ing this on a dev instance and wasn’t able to get it to fire. I tried:

  • Editing a post as the OP with one link and two links
  • Editing a post as a moderator (not OP)

Link counting did not disappear or stop functioning, locally anyway.

@RBoy What Discourse version are you running?


It’s one of your customer sites, I’ll PM the details to you.

1 Like

Thanks for providing the examples @RBoy.

While I see the issue in practice, I unfortunately cannot reproduce it locally or in production. I can’t find anything in the console or error logs signifying anything breaking at time of post edit.

I did gather some info though. In looking at raw data, it looks like the clicks are not getting counted on the server for the affected links (0 click count). While the links were added in previous revisions, the database shows the links were created at the time of an edit. I don’t see anything orphaned by doing a quick search on topic links, but I could be missing something.

Is it possible the click tracker could be looking for an old version of the link to update, and is pulling the click information from the new version? I’m not quite sure how to answer that question myself.

Edit: There’s at least one reproducible case with internal topics. If the destination topic title has changed, but the URL has not, the click tracking breaks. Thanks @david for pointing this one out.