The discussion revolves around topic views not updating via REST API requests in Discourse version 3.4.0.beta4-dev. jandres reports the issue, noting that even with various headers like Discourse-Visible and Discourse-Logged-In, views aren’t tracked. sam clarifies that API requests don’t track views by design, as views are now managed through the browser pageviews system, excluding API traffic. david confirms this shift, explaining that topic views no longer include API activity. Nima1 offers a solution with a plugin, api-topic-views, which enables API traffic to count as topic views. jandres expresses gratitude for the plugin, which addresses the need for API-based view tracking in mobile apps and integrations.
In last Version 3.4.0.beta4-dev I noted that topic views doesn’t update when using rest API requests. Even putting headers likeDiscourse-Visible, X-Requested-With or even more
I would really appreciate any help you can give me with this problem. I’ve tried several things without success. I think I’ve set all the possible headers I’ve seen in the reverse engineering I’ve done, and the views still aren’t updating. I think there must be a header I’m missing.
By the way I’m using admin API keys instead of User api keys. I hope this is not a problem
It hooks into TopicsController#show and counts eligible API/User API requests as topic views, with options for custom headers, rate limiting, crawler filtering, and user-aware tracking.
It’s still new and not fully battle-tested yet, but it should work well for most self-hosted setups. Feedback or PRs are very welcome!