0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/spec/fabricators
Alan Guo Xiang Tan 539eff3f93
FEATURE: Show bounce rate and average session duration on the dashboard (#40936)
This PR adds two KPI tiles to the Traffic section — bounce rate and
average session duration — measured per browsing session as real engaged
time: the seconds a tab is both visible and focused.

It builds on the per-session engagement core already captures
(`browser_pageview_session_engagements`), so the only new table is its
daily summary `browser_pageview_session_engagement_daily_rollups` —
additive, no existing schema changes.

Key technical changes:

1. Reuse core's capture. Engaged time is already recorded per session by
core's `human-activity-tracker` → `/srv/se` beacon →
`browser_pageview_session_engagements`; this PR adds no second tracker,
endpoint, table, or site setting.

2. Key engagement capture on `persist_browser_pageview_events` alone.
`Middleware::RequestTracker#is_engagement_tracking_request?` and the
`discourse-engagement-tracking-enabled` meta tag no longer also require
the `dashboard_improvements` upcoming change, so engagement is captured
wherever pageview events are persisted rather than only where the
redesigned dashboard is enabled.

3. Pre-compute in a scheduled job. The existing
`Jobs::MaintainBrowserPageviewRollups` job, which already maintains the
country and referrer rollups on the same cadence and setting gate, now
also rolls sessions into
`browser_pageview_session_engagement_daily_rollups`, one row per `(date,
logged_in)`, so the dashboard reads this small summary instead of
scanning raw events. A session is bounced when it has a single pageview
and under ten engaged seconds (no engagement counts as zero). Sessions
that started within the last ten minutes are held out of aggregation
until a later run, so a live session is not counted as a zero-engagement
bounce before the client's first engagement flush (three minutes in) has
arrived. Engagement rolls up only from the first engagement row's date
forward, because pageview rows predate this feature and have no
engagement data — counting them would make all of history look like
instant bounces.

4. Show the tiles only when there's data. They render when
`persist_browser_pageview_events` is on, alongside the existing Direct
traffic KPI, with a neutral placeholder until the first visits are
recorded; duration is formatted as `Xm Ys`.
2026-07-03 10:49:32 +08:00
..
access_control_list_fabricator.rb FEATURE: Access control list UI and backend (#41009) 2026-06-29 09:44:58 +10:00
admin_notice_fabricator.rb FEATURE: Add ability to dismiss admin notices (#28916) 2024-09-17 14:43:34 +08:00
allowed_pm_users.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
api_key_fabricator.rb DEV: Backfill API key scope modes (#31606) 2025-03-11 10:00:27 +08:00
api_key_scope_fabricator.rb DEV: Backfill API key scope modes (#31606) 2025-03-11 10:00:27 +08:00
application_request_fabricator.rb FEATURE: Add site traffic dashboard section (#40023) 2026-05-19 14:08:21 +08:00
associated_group_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
badge_fabricator.rb DEV: convert grant badge modal to component API (#23378) 2023-09-11 13:56:31 +08:00
bookmark_fabricator.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
browser_pageview_event_fabricator.rb FIX: Backfill normalized referrer for historical browser pageviews (#40357) 2026-06-09 09:04:57 +08:00
browser_pageview_session_engagement_daily_rollup_fabricator.rb FEATURE: Show bounce rate and average session duration on the dashboard (#40936) 2026-07-03 10:49:32 +08:00
browser_pageview_session_engagement_fabricator.rb FEATURE: Show bounce rate and average session duration on the dashboard (#40936) 2026-07-03 10:49:32 +08:00
category_fabricator.rb UX: First pass at edit categories navigation modal for sidebar (#21963) 2023-06-07 12:09:30 +08:00
category_group_fabricator.rb
category_localization_fabricator.rb FEATURE: Show translated category names from localizations table if they exist for the user locale (#32380) 2025-04-22 15:13:19 +08:00
category_moderation_group_fabricator.rb FEATURE: Support designating multiple groups as mods on category (#28655) 2024-09-04 04:38:46 +03:00
color_scheme_color_fabricator.rb
color_scheme_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
custom_emoji_fabricator.rb DEV: Convert admin emojis UI to new layout (#29615) 2024-11-11 15:04:15 +08:00
dimissed_topic_user.rb
do_not_disturb_fabricator.rb
draft_fabricator.rb FIX: Improvements for uploads:disable_secure_uploads task (#31231) 2025-02-10 14:37:42 +10:00
email_change_request_fabricator.rb
email_log_fabricator.rb
email_token_fabricator.rb
embeddable_host_fabricator.rb
embeddable_host_tag_fabricator.rb FEATURE: Extend embeddable hosts with Individual tags and author assignments (#26868) 2024-05-16 15:47:01 -04:00
external_upload_stub_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
flag_fabricator.rb DEV: Simplify "Admin Flags Page" system test to reduce runtime duration (#32431) 2025-04-24 15:47:22 +08:00
flag_post_action_fabricator.rb DEV: move post flags into database (#27125) 2024-05-23 12:19:07 +10:00
form_template_fabricator.rb FEATURE: Implement tag group selection in dropdown and multi-select for topic creation and preview when using Form Templates (#32108) 2025-04-17 08:38:03 -05:00
group_fabricator.rb DEV: Remove IMAP support in Discourse (#37002) 2026-01-12 10:07:26 +10:00
group_history_fabricator.rb
group_request_fabricator.rb
group_user_fabricator.rb
ignored_user_fabricator.rb
incoming_email_fabricator.rb DEV: Remove IMAP support in Discourse (#37002) 2026-01-12 10:07:26 +10:00
incoming_link_fabricator.rb
invite_fabricator.rb FIX: Don't show that an existing user is invited_by another user (#27665) 2024-07-04 10:27:37 +08:00
invited_user_fabricator.rb
like_fabricator.rb
moved_post_fabricator.rb DEV: Create permanent version of moved_posts table from PostMover class (#29664) 2024-11-12 14:35:20 -06:00
muted_user.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
nested_topic_fabricator.rb FEATURE: First iteration of nested replies (#38888) 2026-04-16 08:06:44 -05:00
notification_fabricator.rb DEV: Added the ability to use users' names in group mention notifications and mentions shown in emails (#33055) 2025-06-03 15:49:55 -05:00
optimized_image_fabricator.rb DEV: Prevent test "leakage" in cooked post processor specs (#33493) 2025-07-07 15:26:41 +02:00
optimized_video_fabricator.rb FEATURE: Add support for aws MediaConvert (#33092) 2025-07-23 11:58:33 -06:00
permalink_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
post_action_fabricator.rb
post_custom_field_fabricator.rb
post_detail_fabricator.rb
post_fabricator.rb DEV: Add theme screenshots system spec and skill (#39426) 2026-05-05 09:36:29 -04:00
post_localization_fabricator.rb DEV: Create topic and post localization resources (#32440) 2025-04-28 12:16:14 +08:00
post_reply_key_fabricator.rb
post_revision_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
problem_check_tracker_fabricator.rb FEATURE: Add problem checks page to admin panel and allow ignoring problem checks (#39103) 2026-04-23 08:28:33 +08:00
published_page_fabricator.rb
push_subscription_fabricator.rb DEV: Skip push notifications for active online users (#19502) 2022-12-19 20:17:40 +00:00
redelivering_webhook_event_fabricator.rb DEV: Specs for redeliver_web_hook_events job (#27779) 2024-07-09 10:35:10 -05:00
reviewable_claimed_topic_fabricator.rb
reviewable_fabricator.rb DEV: Correct reviewable_flagged_post fabricator (#33515) 2025-07-08 21:21:53 +08:00
reviewable_note_fabricator.rb DEV: Add a ReviewableNote model, and tie it into the Reviewable model. (#33047) 2025-06-04 09:33:02 +10:00
reviewable_score_fabricator.rb
screened_email_fabricator.rb DEV: find_each in CSV exports (#22573) 2023-08-17 12:33:52 +10:00
screened_ip_address_fabricator.rb DEV: find_each in CSV exports (#22573) 2023-08-17 12:33:52 +10:00
screened_url_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
search_log_fabricator.rb FEATURE: Add Search section to the redesigned admin dashboard (#40779) 2026-06-11 12:25:10 +08:00
shared_draft_fabricator.rb
sidebar_section_fabricator.rb DEV: configurable custom sidebar sections (#20057) 2023-02-03 14:44:40 +11:00
sidebar_section_link_fabricator.rb PERF: Eager load linkables when loading custom sidebar sections (#20490) 2023-03-01 07:39:35 +08:00
sidebar_url_fabricator.rb PERF: Eager load linkables when loading custom sidebar sections (#20490) 2023-03-01 07:39:35 +08:00
single_sign_on_record_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
site_setting_group_fabricator.rb FEATURE: Add upcoming change CSS classes to <body> (#36586) 2025-12-11 11:09:09 +10:00
skipped_email_log_fabricator.rb
tag_fabricator.rb FEATURE: Implement tag group selection in dropdown and multi-select for topic creation and preview when using Form Templates (#32108) 2025-04-17 08:38:03 -05:00
tag_group_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
tag_group_permission_fabricator.rb
tag_localization_fabricator.rb FEATURE: Introduce tag localizations with API, without UI yet (#36754) 2025-12-18 18:25:58 +08:00
tag_user_fabricator.rb DEV: Ensure unique notification level per tag user (#28638) 2024-09-03 15:43:02 +08:00
theme_fabricator.rb FIX: Hide broken theme about/license URLs (#29930) 2024-11-26 13:53:10 +10:00
theme_field_fabricator.rb FEATURE: Theme settings migrations (#24071) 2023-11-02 08:10:15 +03:00
theme_settings_migration_fabricator.rb FEATURE: Theme settings migrations (#24071) 2023-11-02 08:10:15 +03:00
theme_site_setting_fabricator.rb FEATURE: Themeable site settings (#32233) 2025-07-16 11:00:21 +10:00
topic_allowed_group_fabricator.rb
topic_allowed_user_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_embed_fabricator.rb FEATURE: Prefer topic_embed's cached content when summarizing (#25190) 2024-01-09 14:00:01 -03:00
topic_fabricator.rb SECURITY: Add guardian check on PM to topic conversion 2026-01-28 17:11:14 +00:00
topic_link_click_fabricator.rb FIX: Filter orphaned TopicLinks and normalize http URLs to https (#37098) 2026-01-15 12:12:34 +08:00
topic_link_fabricator.rb FIX: Filter orphaned TopicLinks and normalize http URLs to https (#37098) 2026-01-15 12:12:34 +08:00
topic_localization_fabricator.rb DEV: Create topic and post localization resources (#32440) 2025-04-28 12:16:14 +08:00
topic_tag_fabricator.rb
topic_timer_fabricator.rb FIX: Can't update close based on last post timer to close timer (#35541) 2025-10-28 09:07:43 +08:00
topic_user_fabricator.rb
topic_view_stat_fabricator.rb FEATURE: Topic view stats report (#27760) 2024-07-09 15:39:10 +10:00
translation_override_fabricator.rb FEATURE: Warn about outdated translation overrides in admin dashboard (#22384) 2023-07-10 10:06:40 +08:00
upload_fabricator.rb FIX: In chat messages, filter uploads by UserUpload, not by Upload.user (#34596) 2025-09-01 20:06:27 +10:00
user_action_fabricator.rb
user_api_key_fabricator.rb Require permitted scopes when registering a client (#29718) 2024-11-19 15:28:04 -05:00
user_associated_account_fabricator.rb FEATURE: Merge user associated accounts, favouring the target user upon conflict (#26645) 2024-04-16 17:37:33 +08:00
user_avatar_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
user_badge_fabricator.rb
user_custom_field_fabricator.rb FIX: Move user reindexing into a job (#26753) 2024-04-25 20:58:34 +08:00
user_email_fabricator.rb
user_fabricator.rb FEATURE: welcome banner shouldn't say "welcome back" to new users (#35777) 2025-11-05 09:12:52 +10:00
user_field_fabricator.rb FIX: Show tip for required selectable field on signup when not selected (#33401) 2025-07-02 09:54:23 +08:00
user_field_option_fabricator.rb.rb
user_history_fabricator.rb DEV: Allow for setting a message with SiteSetting.set_and_log (#27447) 2024-06-13 14:59:49 +10:00
user_option_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
user_password_fabricator.rb DEV: Migrate user passwords data to UserPassword table (#28746) 2024-10-10 09:23:06 +08:00
user_profile_fabricator.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
user_second_factor_fabricator.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
user_security_key_fabricator.rb DEV: Refactor webauthn to support passkeys (1/3) (#23586) 2023-10-03 14:59:28 -04:00
user_status_fabricator.rb
user_visit_fabricator.rb FIX: Correct visit counter calculations for stacked report data (#38362) 2026-03-10 14:30:49 +08:00
watched_word_fabricator.rb
watched_word_group_fabricator.rb SECURITY: limit the number of characters in watched word replacements. 2024-07-15 19:25:17 +08:00
web_crawler_request_fabricator.rb
web_hook_event_fabricator.rb FEATURE: Add Filter for Webhook Events by Status (#27332) 2024-06-07 10:26:00 -05:00
web_hook_fabricator.rb FEATURE: granular webhooks (#23070) 2023-10-09 03:35:31 +00:00