mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
FEATURE: Switch to new methods of pageview measurement and reporting (#28729)
### UI changes All of the UI changes described are gated behind the `use_legacy_pageviews` site setting. This commit changes the admin dashboard pageviews report to use the "Consolidated Pageviews with Browser Detection" report introduced in 2f2da7274732cba30d03b6c5c3a4194652cb6783 with the following changes: * The report name is changed to "Site traffic" * The pageview count on the dashboard is counting only using the new method * The old "Consolidated Pageviews" report is renamed as "Consolidated Legacy Pageviews" * By default "known crawlers" and "other" sources of pageviews are hidden on the report When `use_legacy_pageviews` is `true`, we do not show or allow running the "Site traffic" report for admins. When `use_legacy_pageviews` is `false`, we do not show or allow running the following legacy reports: * consolidated_page_views * consolidated_page_views_browser_detection * page_view_anon_reqs * page_view_logged_in_reqs ### Historical data changes Also part of this change is that, since we introduced our new "Consolidated Pageviews with Browser Detection" report, some admins are confused at either: * The lack of data before a certain date , which didn’t exist before we started collecting it * Comparing this and the current "Consolidated Pageviews" report data, which rolls up "Other Pageviews" into "Anonymous Browser" and so it appears inaccurate All pageview data in the new report before the date where the _first_ anon or logged in browser pageview was recorded is now hidden.
This commit is contained in:
@ -20,6 +20,7 @@ class Report
|
||||
include Reports::ConsolidatedApiRequests
|
||||
include Reports::ConsolidatedPageViews
|
||||
include Reports::ConsolidatedPageViewsBrowserDetection
|
||||
include Reports::SiteTraffic
|
||||
include Reports::DailyEngagedUsers
|
||||
include Reports::DauByMau
|
||||
include Reports::Emails
|
||||
@ -294,19 +295,35 @@ class Report
|
||||
report
|
||||
end
|
||||
|
||||
# NOTE: Once use_legacy_pageviews is always false or no longer needed
|
||||
# we will no longer support the page_view_anon and page_view_logged_in reports,
|
||||
# they can be removed.
|
||||
def self.req_report(report, filter = nil)
|
||||
data =
|
||||
if filter == :page_view_total
|
||||
# For this report we intentionally do not want to count mobile pageviews
|
||||
# or "browser" pageviews. See `ConsolidatedPageViewsBrowserDetection` for
|
||||
# browser pageviews.
|
||||
ApplicationRequest.where(
|
||||
req_type: [
|
||||
ApplicationRequest.req_types[:page_view_crawler],
|
||||
ApplicationRequest.req_types[:page_view_anon],
|
||||
ApplicationRequest.req_types[:page_view_logged_in],
|
||||
].flatten,
|
||||
)
|
||||
# For this report we intentionally do not want to count mobile pageviews.
|
||||
if SiteSetting.use_legacy_pageviews
|
||||
# We purposefully exclude "browser" pageviews. See
|
||||
# `ConsolidatedPageViewsBrowserDetection` for browser pageviews.
|
||||
ApplicationRequest.where(
|
||||
req_type: [
|
||||
ApplicationRequest.req_types[:page_view_crawler],
|
||||
ApplicationRequest.req_types[:page_view_anon],
|
||||
ApplicationRequest.req_types[:page_view_logged_in],
|
||||
].flatten,
|
||||
)
|
||||
else
|
||||
# We purposefully exclude "crawler" pageviews here and by
|
||||
# only doing browser pageviews we are excluding "other" pageviews
|
||||
# too. This is to reflect what is shown in the "Site traffic" report
|
||||
# by default.
|
||||
ApplicationRequest.where(
|
||||
req_type: [
|
||||
ApplicationRequest.req_types[:page_view_anon_browser],
|
||||
ApplicationRequest.req_types[:page_view_logged_in_browser],
|
||||
].flatten,
|
||||
)
|
||||
end
|
||||
else
|
||||
ApplicationRequest.where(req_type: ApplicationRequest.req_types[filter])
|
||||
end
|
||||
|
Reference in New Issue
Block a user