I’ve got a Data Explorer query for this (which shows username to enable csv / groups / pms stuff):
-- Who viewed this topic? https://meta.discourse.org/t/see-who-viewed-topic/29277/11
-- [params]
-- int :topic_id
SELECT tu.user_id, u.username, total_msecs_viewed/1000 AS seconds_viewed
FROM topic_users tu
JOIN users u ON tu.user_id = u.id
WHERE tu.topic_id = :topic_id
AND total_msecs_viewed > 0
GROUP BY tu.user_id, u.username, tu.total_msecs_viewed
ORDER BY tu.total_msecs_viewed desc
If it is okay in your context to reveal email addresses, then I suggest this one instead:
-- Who viewed this topic? With emails. https://meta.discourse.org/t/see-who-viewed-topic/29277/11
-- [params]
-- int :topic_id
SELECT tu.user_id, email, total_msecs_viewed/1000 AS seconds_viewed
FROM topic_users tu
JOIN user_emails ue ON tu.user_id = ue.user_id
WHERE tu.topic_id = :topic_id
AND total_msecs_viewed > 0
GROUP BY tu.user_id, ue.email, tu.total_msecs_viewed
ORDER BY tu.total_msecs_viewed desc