# View count difference in category vs data-explorer

**URL:** https://meta.discourse.org/t/view-count-difference-in-category-vs-data-explorer/314227
**Category:** Data & reporting
**Created:** [June 28, 2024, 8:05pm UTC](https://meta.discourse.org/t/view-count-difference-in-category-vs-data-explorer/314227 "2024-06-28T20:05:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![philip-ellis-sp](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@philip-ellis-sp](https://meta.discourse.org/u/philip-ellis-sp)
#### Post date: [June 28, 2024, 8:05pm UTC](https://meta.discourse.org/t/view-count-difference-in-category-vs-data-explorer/314227/1 "2024-06-28T20:05:22Z")

</div>

I’m using [data explorer](https://meta.discourse.org/t/32566?silent=true) to count the number of views on a category using the topic\_views table, but when I count the number of views for that category vs the number of views on the topic (topic.views) the number of views in the topic\_views table is much less. Any idea why this is?

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 28, 2024, 9:15pm UTC](https://meta.discourse.org/t/view-count-difference-in-category-vs-data-explorer/314227/2 "2024-06-28T21:15:53Z")

</div>

The `topic_views` table only records the first view of a topic for each user (or IP Address for anyone not logged in), whereas `topics.views` from the `topics` table records one new view every 8 hours (default, but configurable using the `topic view duration hours` admin setting).

We do have a new table to collect topic view data that can be reported on over a timeframe, which may also be of interest (quite new still, so the data won’t go back too far). That’s in the `topic_view_stats` table, and can give an aggregate amount of views per topic (for both anon and logged in users) per day.

---

<div class="post-metadata">

### Author: ![d4v1d](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@d4v1d](https://meta.discourse.org/u/d4v1d)
#### Post date: [September 23, 2024, 10:09am UTC](https://meta.discourse.org/t/view-count-difference-in-category-vs-data-explorer/314227/3 "2024-09-23T10:09:54Z")

</div>

hi @JammyDodger , i noticed that some topic Views are 0 but there are comments inside, do you know why?

 ![The image displays a screenshot of a web page with a search query result showing a JSON file's content. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/3/3/0/330b5e6e777648533aaae9e3964261a21b8cac22.png)

---

<div class="post-metadata">

### Author: ![Mike\_Taku](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mike_taku/32/458580_2.png) [@Mike\_Taku](https://meta.discourse.org/u/Mike_Taku)
#### Post date: [November 9, 2024, 9:16am UTC](https://meta.discourse.org/t/view-count-difference-in-category-vs-data-explorer/314227/4 "2024-11-09T09:16:42Z")

</div>

Hi there, I hope you are doing well.  
The difference in view counts is likely because the topic views table tracks individual view records (like per user or IP), while the views count in the topic table is a total that includes all views. This total might also account for repeated or guest views that aren’t always in topic views. So, the topic table usually shows a higher, more complete view count.  
Thank You,  
Mike Taku.
