数据探索器 - 查询以确定用户主题偏好

大家好,

不知是否有人能帮我解决以下问题。

我正在尝试统计使用 darklight 主题的用户数量,为此我在数据探索器中拼凑了以下查询:

/* light theme */
SELECT COUNT(*)
FROM user_options
WHERE theme_ids[1] = 6

据我所知,主题 ID 存储在 theme_ids 字段中,且位于数组索引 1 的位置,能否有人确认一下?

在我们的配置中,dark 主题对应的值为 7,light 主题对应的值为 6。

然而,当我运行这些查询时,结果显示有 140 人使用深色主题,32 人使用浅色主题。鉴于我们有数千名用户,这个数据似乎偏低,因此我猜测是我拼凑的查询有误——或者这些值仅针对 明确设置 了主题的用户存储,而如果用户仅使用默认主题,则不会存储这些数据?

任何相关信息都将不胜感激。

I believe @osama has already created a query that allows you to check a theme’s popularity. Have a look here

5 个赞

Hi Joe,

Many thanks for the link, and the swift response! I’m pleased to see that I was looking at the right fields.

Just to confirm, is the data that is returned for only the users that have specifically set their theme, e.g. any users who haven’t set it wouldn’t be returned in the data set, so we could just assume that they are using the default theme?

Perfectly fine if this is the case, just want the clarification please :slight_smile:

3 个赞

No worries Rob,

I checked with @Osama and indeed, the query would only show those who’ve set a theme in their preferences that’s different from the default on your site.

It also includes those who’ve changed back to the default theme after choosing some other non-default theme.

For all intents and purposes, all users that the query returns that use the default theme + any users that don’t show up can be counted as users that use the default theme.

The query will also return a breakdown of the number of users that chose any other user-selectable themes on your site.

7 个赞

Hey Joe,

Awesome, many thanks for the confirmation and info and thanks for @Osama who’s query looks better than mine - albeit I got the same results - but I’ll pinch that one :wink:

4 个赞

This topic was automatically closed after 39 hours. New replies are no longer allowed.