# How to see exact link of ‘top referred topics’

**URL:** https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250
**Category:** Data & reporting
**Tags:** sql-query, dashboard-reports
**Created:** [August 15, 2023, 2:53pm UTC](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250 "2023-08-15T14:53:13Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kynic](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@kynic](https://meta.discourse.org/u/kynic)
#### Post date: [August 15, 2023, 2:53pm UTC](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250/1 "2023-08-15T14:53:13Z")

</div>

Hi,

I want to see the exact link of the topic post that has been shared which appears in "‘top referred topics’ "Can anyone guide me on how to see this data in the [data explorer](https://meta.discourse.org/t/32566?silent=true)?

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 26, 2023, 9:32pm UTC](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250/3 "2023-09-26T21:32:51Z")

</div>

Is this what you are looking for?

> [@Is the info Top Referred Topics/ Top Traffic Sources stored in a table in the database?](https://meta.discourse.org/t/is-the-info-top-referred-topics-top-traffic-sources-stored-in-a-table-in-the-database/73301/9):
>
> For traffic sources, give this query a try. It returns the traffic source domain name, the number of clicks from the traffic source within the time period, and the number of distinct topics that were linked to from the traffic source. Results are ordered by click count in descending order. The query requires you to set start\_date and end\_date parameters. Dates should be in the form ‘yyyy-mm-dd’, for example 2020-01-09. The query limits the number of results to 100. If you need to change that, …

---

<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: [September 27, 2023, 12:38pm UTC](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250/4 "2023-09-27T12:38:06Z")

</div>

Just to clarify, you want the actual URL and not the pretty title? eg. `https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250` and not [How to see exact link of ‘top referred topics’](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250)

---

<div class="post-metadata">

### Author: ![kynic](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@kynic](https://meta.discourse.org/u/kynic)
#### Post date: [September 27, 2023, 3:41pm UTC](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250/5 "2023-09-27T15:41:32Z")

</div>

No, I want to see the link to the top-referred topics. It only shows the topic URL. What I want is to see the URL of the shared comment or post within the thread, like this link:

`Example: https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250/2`

I want to know which post of a thread is shared, but it only shows the topic URL, not the specific post that was shared and clicked in the top-referred topics.

---

<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: [September 27, 2023, 8:31pm UTC](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250/6 "2023-09-27T20:31:30Z")

</div>

Would something like this fit the bill?

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

SELECT
	'https://meta.discourse.org/' || 't/' || t.slug || '/' || t.id || '/' || p.post_number AS post_url,
	COUNT(*) AS external_click_count
FROM incoming_links il
  INNER JOIN posts p ON p.id = il.post_id
  INNER JOIN topics t ON t.id = p.topic_id
WHERE t.archetype = 'regular'
  AND il.created_at::date BETWEEN :start_date AND :end_date
GROUP BY p.id, t.id
ORDER BY external_click_count DESC

```

(Though swop out your own site link rather than `https://meta.discourse.org` 🙂 )

---

<div class="post-metadata">

### Author: ![kynic](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@kynic](https://meta.discourse.org/u/kynic)
#### Post date: [September 29, 2023, 2:59pm UTC](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250/7 "2023-09-29T14:59:48Z")

</div>

Thank you it works you are awesome. 😀

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 29, 2023, 2:59pm UTC](https://meta.discourse.org/t/how-to-see-exact-link-of-top-referred-topics/275250/8 "2023-10-29T14:59:52Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
