# Topic being viewed by online users?

**URL:** https://meta.discourse.org/t/topic-being-viewed-by-online-users/357577
**Category:** Support
**Tags:** whos-online
**Created:** [March 17, 2025, 3:42pm UTC](https://meta.discourse.org/t/topic-being-viewed-by-online-users/357577 "2025-03-17T15:42:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![haydenjames](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haydenjames/32/255678_2.png) [@haydenjames](https://meta.discourse.org/u/haydenjames)
#### Post date: [March 17, 2025, 3:42pm UTC](https://meta.discourse.org/t/topic-being-viewed-by-online-users/357577/1 "2025-03-17T15:42:50Z")

</div>

I have a member who’s online:  
 ![image](https://global.discourse-cdn.com/meta/original/4X/a/c/b/acbf72489300c34a487de25a2364f1d2722dd7d0.png)

Has been online every day for the past 6 days, but only 1 topic viewed. Is there any way to see what topic this user is viewing? Could this be a bot?

Edit:

7 hours later, still online and only view 1 topic:

 ![The image is a social media user profile snippet displaying fields such as "Last Email," "Seen," "Topics Viewed," "Posts Read," "Read Time," and "Created," with some entries and timings for these fields visible. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/2/9/0/290eafeb4ec5a5c1b36f74d0df713d0fba975803.jpeg)

---

<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: [May 10, 2025, 8:49am UTC](https://meta.discourse.org/t/topic-being-viewed-by-online-users/357577/3 "2025-05-10T08:49:15Z")

</div>

You should be able to find this out using the [data explorer](https://meta.discourse.org/t/32566?silent=true). Maybe something like this:

```sql
-- [params]
-- user_id :user

SELECT *
FROM topic_views
WHERE user_id = :user
ORDER BY viewed_at DESC

```

The `topic_views` table only records the first time someone views a topic, so you can’t tell how often they visited it over the last x amount of time, but maybe this is enough?

Alternatively, you could impersonate that user and then view their /activity/read page in their profile.

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [May 10, 2025, 9:20am UTC](https://meta.discourse.org/t/topic-being-viewed-by-online-users/357577/4 "2025-05-10T09:20:57Z")

</div>

I have used this query to find out which topic the test user I created used for testing something. It returns the topic, category, and the number of the post that was read, ordered by most recent view. Usually the most recently viewed topic is the one I was looking for 🙂

```sql
-- [params]
-- user_id
SELECT 
    tu.topic_id, 
    category_id, 
    tu.last_read_post_number, 
    tu.last_visited_at 
FROM 
    topics 
LEFT OUTER JOIN 
    topic_users AS tu 
    ON topics.id = tu.topic_id 
WHERE 
    tu.user_id = :user_id 
    AND tu.last_visited_at IS NOT NULL 
ORDER BY 
    tu.last_visited_at DESC

```
