# عد مشاهدات الصفحة لكل موضوع باستخدام إضافة Data-Explorer

**URL:** https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [23 مارس 2019، 5:28م UTC](https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417 "2019-03-23T17:28:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Alexandra\_Diehl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_diehl/32/133158_2.png) [@Alexandra\_Diehl](https://meta.discourse.org/u/Alexandra_Diehl)
#### Post date: [23 مارس 2019، 5:28م UTC](https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417/1 "2019-03-23T17:28:18Z")

</div>

مرحباً بالجميع،

من فضلكم، هل يمكنكم إخباري بكيفية الوصول إلى البيانات التاريخية/الزمنية لعدد مرات مشاهدة الصفحات لكل موضوع؟  
لقد حاولت ذلك باستخدام الجدولين top\_topics و topic\_views، لكن لا يحتوي أي منهما على مجموعة النتائج الكاملة. أحتاج إلى الموضوع، والتاريخ، والعدد لكل يوم…

شكراً جزيلاً!

ألكسندرا.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [24 مارس 2019، 11:36م UTC](https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417/2 "2019-03-24T23:36:04Z")

</div>

I like this idea for a stock report here in [data explorer](https://meta.discourse.org/t/32566?silent=true), @HAWK can you assign this out to a tech advocate?

We still have the `topic_views` table which has tons of info, so we could just break this down per day.

---

<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: [25 مارس 2019، 3:30ص UTC](https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417/5 "2019-03-25T03:30:14Z")

</div>

> [@Alexandra\_Diehl](#):
>
> could you tell me how can I access to history/temporal data about the pageviews per topic?

Can you clarify what you mean by that? You can sort topics by pageviews in the topic list interface. Just click the views column header.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [25 مارس 2019، 3:48ص UTC](https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417/6 "2019-03-25T03:48:35Z")

</div>

My understanding is that @Alexandra_Diehl wants to see that on Monday 100 people visited the topic and on Wednesday 32 people. We actually store data at that fidelity.

Though we do need a bit of an internal refactor cause we only count any given user once and any given IP once. A simpler rollup table would take up far less storage and give more interesting results.

---

<div class="post-metadata">

### Author: ![Alexandra\_Diehl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_diehl/32/133158_2.png) [@Alexandra\_Diehl](https://meta.discourse.org/u/Alexandra_Diehl)
#### Post date: [25 مارس 2019، 1:45م UTC](https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417/7 "2019-03-25T13:45:02Z")

</div>

Hi, Sam!

Thanks so much for your quick response!

Yes, that’s right. I am interested in understanding how specific temporal events affect pageviews. For example, when an influential user replies a post.  
It will be fantastic to count with that info and I am very much looking forward to your news.

Cheers!

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [27 مارس 2019، 12:25ص UTC](https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417/12 "2019-03-27T00:25:05Z")

</div>

Hi Alexandra,

Until a refactor takes places, I believe the following is the best we can do:

```sql
-- [params]
-- date :view_date = 2019-03-26
SELECT t.id AS topic_id, COUNT(t.id) AS first_time_views
FROM topics t 
JOIN topic_views tv ON t.id = tv.topic_id
GROUP BY t.id, viewed_at
HAVING viewed_at = :view_date
ORDER BY first_time_views DESC

```

You can specify a date using the field in the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) UI. The first column of the results will show linked topic titles with their reply count in parenthesis. The second column is the number of first time views of the topic on the day you specified.

---

<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: [25 يونيو 2022، 12:07ص UTC](https://meta.discourse.org/t/counting-pageviews-per-topic-using-the-data-explorer-plugin/112417/14 "2022-06-25T00:07:52Z")

</div>

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