I’m trying to determine how many users are using either the dark or light themes, I’ve cobbled this together for the Data Explorer;
/* light theme */
SELECT COUNT(*)
FROM user_options
WHERE theme_ids[1] = 6
From what I can tell the ID of the theme is stored in the field theme_ids and in array element 1, could anyone confirm this?
In our set up the dark theme appears as a value of 7, and the light theme a value of 6.
However, when I run the queries I get 140 people using dark, 32 using light. As we have several thousand users this seems a bit out so I’m guessing my cobbled together query is either wrong - or - are these values only stored for users that have specifically set a theme, where-as if they are just using the default this data isn’t stored?
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
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.
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