# User Page Metrics

**URL:** https://meta.discourse.org/t/user-page-metrics/354906
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [October 31, 2024, 12:52am UTC](https://meta.discourse.org/t/user-page-metrics/354906 "2024-10-31T00:52:40Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![SaraDev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saradev/32/335139_2.png) [@SaraDev](https://meta.discourse.org/u/SaraDev)
#### Post date: [October 31, 2024, 7:54pm UTC](https://meta.discourse.org/t/user-page-metrics/354906/2 "2024-10-31T19:54:37Z")

</div>

Hi @srinivas.chilukuri,

The `/u` user page statistics can be retrieved via the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) by using the `directory_items` table.

**User Directory Page Metrics**

```sql
-- [params]
-- int :period
-- Period Options:
-- 1. all
-- 2. yearly
-- 3. monthly
-- 4. weekly
-- 5. daily
-- 6. quarterly

SELECT 
    di.user_id,
    COALESCE(di.likes_received, 0) AS likes_received,
    COALESCE(di.likes_given, 0) AS likes_given,
    COALESCE(di.topics_entered, 0) AS topics_viewed,
    COALESCE(di.topic_count, 0) AS topic_count,
    COALESCE(di.post_count, 0) AS post_count,
    COALESCE(di.days_visited, 0) AS days_visited,
    COALESCE(di.posts_read, 0) AS posts_read,
    COALESCE(di.solutions, 0) AS solutions,
    COALESCE(di.gamification_score, 0) AS cheers
FROM 
    directory_items di
WHERE 
    di.period_type = :period
ORDER BY 
    di.user_id

```

Instead of the typical `start_date` and `end_date` parameters, data from this table can be filtered using the `period_type` field, where the following values correspond to the different time periods available on the directory page:

- `1`: all time
- `2`: yearly
- `3`: monthly
- `4`: weekly
- `5`: daily
- `6`: quarterly

Example Results for this report would look like:

| user | likes\_received | likes\_given | topics\_viewed | topic\_count | post\_count | days\_visited | posts\_read | solutions | cheers |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Username1 | 4 | 17 | 250 | 69 | 116 | 480 | 217 | 10 | 844100 |
| Username2 | 2 | 5 | 47 | 0 | 2 | 43 | 59 | 1 | 112305 |
| Username3 | 0 | 4 | 2 | 0 | 0 | 2 | 7 | 0 | 3100 |
| … | … | .. | … | … | … | … | … | … | … |

---

_[View the full topic](https://meta.discourse.org/t/user-page-metrics/354906)._
