Is the info Top Referred Topics/ Top Traffic Sources stored in a table in the database?

这是一个 Data Explorer 查询,用于返回指定时间段内被引用次数最多的主题。我很快会添加一个关于主要流量来源的查询。

该查询返回 Discourse 主题列表,以及从外部来源点击每个主题链接的次数。查询要求您提供 start_date 和 end_date 参数,格式为 ‘yyyy-mm-dd’,例如 2020-01-08。结果按点击次数降序排列。将返回该时间段内被引用次数最多的前 100 个主题。如果您需要更多结果,请调整查询中的 LIMIT 值。

--[params]
-- date :start_date
-- date :end_date

SELECT
t.id AS topic_id,
COUNT(p.id) AS external_click_count
FROM incoming_links il
JOIN posts p
ON p.id = il.post_id
JOIN topics t
ON t.id = p.topic_id
WHERE t.archetype = 'regular'
AND il.created_at::date BETWEEN :start_date::date AND :end_date::date
GROUP BY p.id, t.id
ORDER BY external_click_count DESC
LIMIT 100