# Aggregated click number on forum click counter

**URL:** https://meta.discourse.org/t/aggregated-click-number-on-forum-click-counter/26846
**Category:** Feature
**Created:** [26 במרץ,‏ 2015,‏ 9:23pm UTC](https://meta.discourse.org/t/aggregated-click-number-on-forum-click-counter/26846 "2015-03-26T21:23:17Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [27 במרץ,‏ 2015,‏ 4:49pm UTC](https://meta.discourse.org/t/aggregated-click-number-on-forum-click-counter/26846/5 "2015-03-27T16:49:14Z")

</div>

I believe what you’re interested in is the topic\_links table (in /db/structure.sql)

```plaintext
CREATE TABLE topic_links (
    id integer NOT NULL,
    topic_id integer NOT NULL,
    post_id integer,
    user_id integer NOT NULL,
    url character varying(500) NOT NULL,
    domain character varying(100) NOT NULL,
    internal boolean DEFAULT false NOT NULL,
    link_topic_id integer,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    reflection boolean DEFAULT false,
    clicks integer DEFAULT 0 NOT NULL,
    link_post_id integer,
    title character varying(255),
    crawled_at timestamp without time zone,
    quote boolean DEFAULT false NOT NULL
);

```

In the Rails console you could do something like  
`TopicLink.order("clicks DESC").limit(1)`  
which gives this from my localhost Discourse

```plaintext
=> [#<TopicLink id: 2, topic_id: 18, post_id: 18, user_id: 2, url: "/faq", domai
n: "localhost:4000", internal: true, link_topic_id: nil, created_at: "2013-01-29
 05:25:59", updated_at: "2013-01-29 05:25:59", reflection: false, clicks: 1, lin
k_post_id: nil, title: nil, crawled_at: nil, quote: false>]

```

---

_[View the full topic](https://meta.discourse.org/t/aggregated-click-number-on-forum-click-counter/26846)._
