# What does \`incoming link count\` in discourse database mean?

**URL:** https://meta.discourse.org/t/what-does-incoming-link-count-in-discourse-database-mean/122515
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [July 10, 2019, 4:13am UTC](https://meta.discourse.org/t/what-does-incoming-link-count-in-discourse-database-mean/122515 "2019-07-10T04:13:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Akshara\_Goyal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/akshara_goyal/32/148882_2.png) [@Akshara\_Goyal](https://meta.discourse.org/u/Akshara_Goyal)
#### Post date: [July 10, 2019, 4:13am UTC](https://meta.discourse.org/t/what-does-incoming-link-count-in-discourse-database-mean/122515/1 "2019-07-10T04:13:18Z")

</div>

I was hoping that `incoming link count` for a post in discourse database means no. of times external websites have mentioned that post in their content.. But the numbers that I have are too high to believe that.  
Could someone please explain what does `incoming link count` mean?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 16, 2019, 12:07pm UTC](https://meta.discourse.org/t/what-does-incoming-link-count-in-discourse-database-mean/122515/2 "2019-07-16T12:07:41Z")

</div>

I believe it is the number of incoming links from the forum itself, that is, the number of other posts that have linked to that post.

There is no rational way to determine how many times external websites have linked to a place without crawling the entire web, like Google.

---

<div class="post-metadata">

### Author: ![GregAtkinson](https://avatars.discourse-cdn.com/v4/letter/g/96bed5/32.png) [@GregAtkinson](https://meta.discourse.org/u/GregAtkinson)
#### Post date: [September 23, 2022, 11:25pm UTC](https://meta.discourse.org/t/what-does-incoming-link-count-in-discourse-database-mean/122515/3 "2022-09-23T23:25:36Z")

</div>

I looked at the code and it seems like incoming\_link\_count is similar to the “topic\_views” table except it doesn’t increment the incoming\_link\_count when the request format is json.

Here’s the relevant lines in topics\_controller.rb

```plaintext
  def track_visit_to_topic
    topic_id = @topic_view.topic.id
    ip = request.remote_ip
    user_id = (current_user.id if current_user)
    track_visit = should_track_visit_to_topic?

    if !request.format.json?
      hash = {
        referer: request.referer || flash[:referer],
        host: request.host,
        current_user: current_user,
        topic_id: @topic_view.topic.id,
        post_number: @topic_view.current_post_number,
        username: request['u'],
        ip_address: request.remote_ip
      }
      # defer this way so we do not capture the whole controller
      # in the closure
      TopicsController.defer_add_incoming_link(hash)
    end

    TopicsController.defer_track_visit(topic_id, ip, user_id, track_visit)
  end

```

I was hoping this column would tell me the number of times someone arrived at this topic from an external link (including external search engines) vs clicking internal links.

---

<div class="post-metadata">

### Author: ![gassim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gassim/32/220910_2.png) [@gassim](https://meta.discourse.org/u/gassim)
#### Post date: [January 11, 2023, 4:37pm UTC](https://meta.discourse.org/t/what-does-incoming-link-count-in-discourse-database-mean/122515/4 "2023-01-11T16:37:27Z")

</div>

> [@GregAtkinson](#):
>
> I was hoping this column would tell me the number of times someone arrived at this topic from an external link (including external search engines) vs clicking internal links.

Same! It would be great if it’s possible to see which topics are being visited the most from external links 👍👍👍
