# Stats on theme utilisation

**URL:** https://meta.discourse.org/t/stats-on-theme-utilisation/249187
**Category:** Support
**Created:** [December 16, 2022, 8:57pm UTC](https://meta.discourse.org/t/stats-on-theme-utilisation/249187 "2022-12-16T20:57:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Alec](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alec/32/137283_2.png) [@Alec](https://meta.discourse.org/u/Alec)
#### Post date: [December 16, 2022, 8:57pm UTC](https://meta.discourse.org/t/stats-on-theme-utilisation/249187/1 "2022-12-16T20:57:44Z")

</div>

On my forum I created multiple themes (with different colour schemes and features). I liked the customisation 😉

After a few years, I am now doing a refresh. I want to eliminate the old themes that are poorly utilised and consolidate on just 3 or 4. Is there any easy way of determining which themes are being utilised by my community?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 16, 2022, 9:22pm UTC](https://meta.discourse.org/t/stats-on-theme-utilisation/249187/2 "2022-12-16T21:22:11Z")

</div>

Here’s my best answer before my battery dies:

```
UserOption.where("theme_ids is not null").pluck(:theme_ids)

```

Better would be to search for where that array is longer than 0, but I don’t know how to do that. This will get you all of them. You can then do something clever to sort and count.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [December 16, 2022, 9:23pm UTC](https://meta.discourse.org/t/stats-on-theme-utilisation/249187/3 "2022-12-16T21:23:43Z")

</div>

See also

> [@Is there any way of telling how popular a Theme is?](https://meta.discourse.org/t/is-there-any-way-of-telling-how-popular-a-theme-is/93796/4):
>
> You don’t really need to look at the users table here to display usernames. [Data Explorer](https://meta.discourse.org/t/32566?silent=true) will automatically display avatars and username if the result of your query has a user\_id column which the user\_options table does have. slight_smile Anyway, this topic got me personally interested so I spent a few minutes playing with [data explorer](https://meta.discourse.org/t/32566?silent=true) and I got this little query which shows you user-selectable themes with the number of users using each theme: WITH theme\_stats AS ( SELECT theme\_ids[1]…

---

<div class="post-metadata">

### Author: ![Alec](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alec/32/137283_2.png) [@Alec](https://meta.discourse.org/u/Alec)
#### Post date: [December 16, 2022, 9:31pm UTC](https://meta.discourse.org/t/stats-on-theme-utilisation/249187/4 "2022-12-16T21:31:48Z")

</div>

Brillant. Thank you goes !

🙂

---

<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: [January 15, 2023, 9:32pm UTC](https://meta.discourse.org/t/stats-on-theme-utilisation/249187/5 "2023-01-15T21:32:14Z")

</div>

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