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

Per le fonti di traffico, prova questa query.

Restituisce il nome del dominio della fonte di traffico, il numero di clic dalla fonte di traffico nell’arco temporale specificato e il numero di argomenti distinti collegati dalla fonte di traffico. I risultati sono ordinati per numero di clic in ordine decrescente. La query richiede di impostare i parametri start_date e end_date. Le date devono essere nel formato ‘aaaa-mm-gg’, ad esempio 2020-01-09.

La query limita il numero di risultati a 100. Se necessario, modifica il valore LIMIT nella query.

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

WITH links AS (
SELECT
ind.name,
t.id AS topic_id
FROM incoming_links il
JOIN posts p
ON p.id = il.post_id
JOIN topics t
ON t.id = p.topic_id
JOIN incoming_referers ir
ON ir.id = il.incoming_referer_id
JOIN incoming_domains ind
ON ind.id = ir.incoming_domain_id
WHERE t.archetype = 'regular'
AND il.created_at::date BETWEEN :start_date::date AND :end_date::date
)
SELECT
name,
COUNT(name) AS clicks,
COUNT(DISTINCT topic_id) AS topics
FROM links
GROUP BY name
ORDER BY clicks DESC
LIMIT 100