Tracking of Pageviews and Unique Users at Category and Tag Level

I am curious if you have advice on tracking community health metrics at the category and/or tag level.
For example, I’d love to have a clearer sense of the daily number of pageviews and user visits (both known and anonymous users, and ideally by specific group-members) on topic-threads under each category and tag.

In /admin/dashboard/reports, new topics and new post have reports that can be filtered to the category level, user profile_views can be filtered by group, and there are sitewide metrics on page views and other useful info.

I suspect some of this can be set-up somehow in Google Analytics, but that’s not obvious to me since it’s not obvious how to associate topic urls with tags and categories in google analytics. I also suspect this may be done via the /admin/plugins/explorer, but I haven’t had any success.

Your advice would be greatly appreciated.

4 إعجابات

Do you have any advice here @hawk? It seems like a reasonable question and maybe new dashboard / reports covers this a bit?

إعجابَين (2)

It does seem like a reasonable request, yes. At the moment the reports on the dashboard aren’t segment-able but if we can work out a way to do that I think it would be an excellent addition to v2. We’ve also talked about exposing approved Data Explorer queries on the dashboard.

cc @j.jaffeux – do you have plans to revisit the dashboard any time soon?

6 إعجابات

Yes, it will be step by step but might come to something close to this. I don‘t want it to become too complex though and it will never be a “combine any segment you want”, there’s sql (and data-explorer) for this. But will probably try to provide this on a per report basis where we think it makes sense.

4 إعجابات

This query is specifically about pageviews per category, which I don’t think can be handled with Data Explorer can they?

إعجابَين (2)

Yes, I would also be interested in a report about the unique users on my site.

Yes this specific report is using ApplicationRequest table, which doesn’t have any notion of category. So not possible through reports, data-explorer or raw sql.

إعجابَين (2)

Can we pull a report on the number of anonymous users instead of the number of pages viewed anonymously?

إعجاب واحد (1)

Do you mean the number of people that have used the anonymous posting feature? They all get unique anonymous usernames so it will be very easy to pull a report from Data Explorer

إعجابَين (2)

I’m trying to find out how many people are visiting the site who have not logged in at all and do not have an account.

إعجابَين (2)

Would love to see this as well! Any advice on how to construct a query? Thx!

We also want this number (PVs per category, excluding crawler activity). Is there a way to get this from the Data Explorer?

I don’t believe so. We don’t granularly track page views like that. You would need to hook up your GA and use that.

إعجاب واحد (1)

@HAWK: Do you reckon this won’t be possible then? Counting Pageviews for users (non-staff, non-crawler)

Has anyone found a solution to count page views for all posts within a specific category? Possible with GA?

إعجاب واحد (1)

من الممكن الحصول على إجمالي مشاهدات الفئات من مستكشف البيانات عن طريق جمع مشاهدات جميع المواضيع ضمن فئة:

SELECT 
       c.id as category_id, 
       SUM(views) as "total views"
FROM categories c 
JOIN topics t ON t.category_id = c.id
WHERE read_restricted is false
GROUP BY c.id
order by sum(views) desc

الحصول على إجمالي المشاهدات حسب العلامة مشابه:

SELECT tags.name,
       sum(views)
from topics t
     join topic_tags tt on t.id = topic_id
     join tags on tags.id = tt.tag_id
group by tags.name
order by sum(views) desc

يوجد أيضًا جدول topic_views والذي يمكن، من الناحية النظرية، استخدامه لتقسيم المشاهدات حسب المستخدم والتاريخ. لم أجد هذا الجدول مفيدًا بشكل خاص، ومع ذلك، لأن الاستعلامات تنتهي بمهلة عندما يكون للمواضيع عدد كبير من المشاهدات. كما أنه يعرض عددًا أقل بكثير من المشاهدات لكل موضوع لأنه، إذا فهمت بشكل صحيح، فهو لا يحسب المشاهدات المجهولة. أعتقد أيضًا أن topic.views قد يشمل المشاهدات المجهولة بالإضافة إلى حركة مرور الروبوتات؟ إنه أكثر بكثير مما أراه في GA.

بالحديث عن GA، فهو يحتوي على جميع البيانات التي تحتاجها، ولكنه ليس من السهل تجميعها حسب الفئة أو العلامة. أفضل ما يمكنني فعله هو محاولة تحليل pageTitle للعثور على الفئات. أقوم بذلك في R باستخدام googleAnalyticsR. اتبع التعليمات في الدليل لتفويض حساب Google الخاص بك والحصول على المقاييس التي تريدها. تأكد من تضمين pageTitle كبعد. تبدو استدعاءات API الخاصة بي شيئًا كهذا:

ga_this_year <- ga_data(ga_id, 
                        date_range = c("2023-01-01", "2023-05-30" ),
                        metrics=c("screenPageViews","averageSessionDuration", "sessions"), 
                        dimensions = c("pageTitle", "deviceCategory")
                       )

المفتاح لفهم الجزء التالي هو رؤية أن pageTitles تتناسب مع هذا التنسيق العام:

Topic title - Category - Site title

إذا لم يكن الموضوع مصنفًا، فإن الفئة مفقودة. هناك أيضًا مجموعة من صفحات الأدوات المساعدة (“أحدث المواضيع”، “مواضيع جديدة”، إلخ) التي لا تحتوي على فئات. (أنا لا أحسب “أحدث مواضيع [الفئة]” كجزء من الفئة، على الرغم من أنه قد يكون من الأفضل تضمينها.) أخيرًا، تستخدم الصفحة الرئيسية Site title - short site description لعنوان الصفحة. نحن لا نهتم بأي من هذه، ومع ذلك. لذا فإن التعبير العادي الذي أستخدمه هو:

str_extract(pageTitle,
            str_glue(".*? - (.*) - {sitename}"),
            group=1)

بوضع كل شيء معًا في دالة تجمع حسب الفئة، أحصل على شيء كهذا:

category_views <- function(data, sitename = "Meta Jon") {
  data %>% 
  mutate(category = str_extract(
                                pageTitle,
                                str_glue(".*? - (.*) - {sitename}"),
                                group=1
                                )) %>% 
  group_by(category) %>% 
  summarise(views = sum(screenPageViews)) %>% 
  arrange(desc(views)) #%>% head(20)
}

category_views(ga_this_year)

(من الواضح أن تغيير “Meta Jon” لاسم موقعك الخاص.)

لا أعرف حاليًا كيفية استخراج بيانات GA بناءً على العلامة.

إعجابَين (2)

هل تشمل هذه المشاهدات الإجمالية الروبوتات، المعروفة أيضًا باسم المجهولين؟

يستبعد GA حركة الروبوتات، وفقًا لـ وثائقهم. لا يمكنني العثور على وثائق لـ topic_views، ولكن تعليقًا في الكود يقول:

# تخزين المشاهدة مرة واحدة فقط في اليوم لكل شيء لكل (مستخدم || IP)

لا أعرف على وجه اليقين، ولكن يبدو أن topic.views يعرض مشاهدات الصفحات بواسطة الروبوتات لأنه يعرض مشاهدات أكثر بكثير مما يفعله GA لنفس الصفحة.

نعم ولكن هل يتم احتسابها من Discourse عند استخدام مستكشف البيانات؟

في وقت سابق، أخبرت GA بنفس الشيء ويمكن أن يكون ذلك صحيحًا عندما تكون هناك روبوتات شرعية. لكن الغالبية العظمى من المكالمات تحدث بواسطة الروبوتات المارقة، وروبوتات تحسين محركات البحث سيئة السلوك، و knckers وما إلى ذلك، وعندئذٍ ستنتهك قاعدة الزيارة الواحدة. أو هكذا أعتقد بصراحة.

على أي حال، أنا أستخدم Matomo. لست سمكة كبيرة لدرجة أنني سأحتاج إلى GA.

للعلم فقط، هذا في الواقع لأن جدول topic_views يحد من حساب مشاهدة جديدة واحدة في اليوم، بينما يسمح حقل topics.views بمشاهدة جديدة كل 8 ساعات (بشكل افتراضي، ولكن يمكن تغييره باستخدام topic view duration hours). وهو يشمل المستخدمين والمجهولين. :+1:

تحديث
اتضح أن جدول topic_views لا يحسب حتى مشاهدة جديدة واحدة في اليوم… بل يحسب المرة الأولى التي يشاهد فيها شخص ما موضوعًا ولا مزيد من المشاهدات بعد ذلك. لذلك لن يكون هناك سوى سجل واحد لكل مستخدم أو عنوان IP لكل موضوع.

إعجابَين (2)