Hi!
I’ve been searching for a while but couldn’t find anything similar, not even in the cool Data Explorer queries.
I want to see the history of views/visits that a specific topic has received for a period of time.
Ideally, I’d like to have something like this, but for each individual topic:
I don’t mind if it’s just a table day by day or if it can include a graph (I can build that outside Discourse). I’m also really interested in having all visits (user & anon).
This would help me track and analyze topics usage within certain periods of time (in where I expect more or less activity).
Do you know if is there some data explorer query for this?
Thank you in advance!
-- [params]
-- int :topic_id =
-- date :start_date =
-- date :end_date =
SELECT COUNT(*) AS views
FROM topic_views
WHERE topic_id = :topic_id
AND viewed_at BETWEEN :start_date AND :end_date
you will need to specify the topic id (from the topic URL) and the date range parameters in YYYY-MM-DD format.
I’m afraid I have recently found out that the topic_views table only records the very first view of a topic by a user and not one topic view per user/ip per day.
Unfortunately this makes doing a time-based breakdown on views a little skewed, and can only be done on ‘viewed for the first time’.