discourse/app/assets/javascripts/admin/addon/templates/dashboard_general.hbs
Martin Brennan 14b436923c
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 2f2da72747 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.
2024-09-10 09:51:49 +10:00

212 lines
6.5 KiB
Handlebars

<ConditionalLoadingSpinner @condition={{this.isLoading}}>
<PluginOutlet @name="admin-dashboard-general-top" @connectorTagName="div" />
{{#if this.isCommunityHealthVisible}}
<div class="community-health section">
<div class="period-section">
<div class="section-title">
<h2>
<a href={{get-url "/admin/dashboard/reports"}}>
{{i18n "admin.dashboard.community_health"}}
</a>
</h2>
<DashboardPeriodSelector
@period={{this.period}}
@setPeriod={{this.setPeriod}}
@startDate={{this.startDate}}
@endDate={{this.endDate}}
@setCustomDateRange={{this.setCustomDateRange}}
/>
</div>
<div class="section-body">
<div class="charts">
{{#if this.siteSettings.use_legacy_pageviews}}
<AdminReport
@dataSourceName="consolidated_page_views"
@forcedModes="stacked-chart"
@filters={{this.filters}}
/>
{{else}}
<AdminReport
@dataSourceName="site_traffic"
@forcedModes="stacked-chart"
@reportOptions={{this.siteTrafficOptions}}
@filters={{this.filters}}
/>
{{/if}}
<AdminReport
@dataSourceName="signups"
@showTrend={{true}}
@forcedModes="chart"
@filters={{this.filters}}
/>
<AdminReport
@dataSourceName="topics"
@showTrend={{true}}
@forcedModes="chart"
@filters={{this.filters}}
/>
<AdminReport
@dataSourceName="posts"
@showTrend={{true}}
@forcedModes="chart"
@filters={{this.filters}}
/>
<AdminReport
@dataSourceName="dau_by_mau"
@showTrend={{true}}
@forcedModes="chart"
@filters={{this.filters}}
/>
<AdminReport
@dataSourceName="daily_engaged_users"
@showTrend={{true}}
@forcedModes="chart"
@filters={{this.filters}}
/>
<AdminReport
@dataSourceName="new_contributors"
@showTrend={{true}}
@forcedModes="chart"
@filters={{this.filters}}
/>
</div>
</div>
</div>
</div>
{{/if}}
<div class="section-columns">
<div class="section-column">
{{#if this.isActivityMetricsVisible}}
{{#if this.activityMetrics.length}}
<div class="admin-report activity-metrics">
<div class="header">
<ul class="breadcrumb">
<li class="item report">
<LinkTo @route="adminReports" class="report-url">
{{i18n "admin.dashboard.activity_metrics"}}
</LinkTo>
</li>
</ul>
</div>
<div class="report-body">
<div class="counters-list">
<div class="counters-header">
<div class="counters-cell"></div>
<div class="counters-cell">{{i18n
"admin.dashboard.reports.today"
}}</div>
<div class="counters-cell">{{i18n
"admin.dashboard.reports.yesterday"
}}</div>
<div class="counters-cell">{{i18n
"admin.dashboard.reports.last_7_days"
}}</div>
<div class="counters-cell">{{i18n
"admin.dashboard.reports.last_30_days"
}}</div>
</div>
{{#each this.activityMetrics as |metric|}}
<AdminReport
@showHeader={{false}}
@filters={{this.activityMetricsFilters}}
@forcedModes="counters"
@dataSourceName={{metric}}
/>
{{/each}}
</div>
</div>
</div>
{{/if}}
{{/if}}
<div class="user-metrics">
<ConditionalLoadingSection @isLoading={{this.isLoading}}>
<AdminReport
@forcedModes="inline-table"
@dataSourceName="users_by_type"
/>
<AdminReport
@forcedModes="inline-table"
@dataSourceName="users_by_trust_level"
/>
</ConditionalLoadingSection>
</div>
<div class="misc">
<AdminReport
@forcedModes="storage-stats"
@dataSourceName="storage_stats"
@showHeader={{false}}
/>
<div class="last-dashboard-update">
<div>
<h4>{{i18n "admin.dashboard.last_updated"}} </h4>
<p>{{format-date
this.model.attributes.updated_at
leaveAgo="true"
}}</p>
</div>
{{#if this.model.attributes.discourse_updated_at}}
<div>
<h4>{{i18n "admin.dashboard.discourse_last_updated"}} </h4>
<p>{{format-date
this.model.attributes.discourse_updated_at
leaveAgo="true"
}}</p>
<a
rel="noopener noreferrer"
target="_blank"
href={{this.model.attributes.release_notes_link}}
class="btn btn-default"
>
{{i18n "admin.dashboard.whats_new_in_discourse"}}
</a>
</div>
{{/if}}
</div>
</div>
</div>
{{#if this.isSearchReportsVisible}}
<div class="section-column">
<AdminReport
@filters={{this.topReferredTopicsFilters}}
@dataSourceName="top_referred_topics"
@reportOptions={{this.topReferredTopicsOptions}}
/>
<AdminReport
@dataSourceName="trending_search"
@reportOptions={{this.trendingSearchOptions}}
@filters={{this.trendingSearchFilters}}
@isEnabled={{this.logSearchQueriesEnabled}}
@disabledLabel={{this.trendingSearchDisabledLabel}}
/>
{{html-safe
(i18n
"admin.dashboard.reports.trending_search.more" basePath=(base-path)
)
}}
</div>
{{/if}}
</div>
<PluginOutlet
@name="admin-dashboard-general-bottom"
@connectorTagName="div"
@outletArgs={{hash filters=this.filters}}
/>
</ConditionalLoadingSpinner>