Build an internal user engagement analytics dashboard in Bubble by tracking daily active users, session duration, feature usage, and conversion events. Create a UserSession Data Type that logs login and logout times, use scheduled backend workflows to aggregate metrics into daily snapshots, and display trends using chart plugins — all without external analytics tools.
Monitoring User Engagement Metrics in Your Bubble App
Understanding how users interact with your app is essential for making product decisions. This tutorial shows you how to build an internal analytics system that tracks daily and monthly active users, session duration, feature usage, and key conversion events. You will learn to log events, aggregate them into meaningful metrics, and display dashboards with charts — giving you Google Analytics-level insights built directly into your Bubble app.
Prerequisites
- A Bubble account with an app open in the editor
- User authentication set up (login/logout flows)
- A chart plugin installed (Chart.js or Bubble Chart from the marketplace)
- Backend workflows enabled for metric aggregation
Step-by-step guide
Create Data Types for session and event tracking
Create Data Types for session and event tracking
Go to Data tab → Data types. Create 'UserSession' with fields: user (User), login_time (date), logout_time (date), duration_minutes (number), device_type (text). Create 'EngagementEvent' with fields: user (User), event_name (text, e.g., 'clicked_upgrade', 'viewed_pricing'), event_data (text), timestamp (date). Create 'DailyMetric' with fields: date (date), dau_count (number), new_users (number), avg_session_minutes (number), total_events (number).
Expected result: Three Data Types are created for raw session data, individual events, and aggregated daily metrics.
Track user sessions on login and logout
Track user sessions on login and logout
In your login workflow (after the 'Log the user in' action), add: Create a new thing UserSession (user = Current User, login_time = Current date/time, device_type = detect via user agent or leave blank). Store the Result of step's unique id in a custom state called 'current_session_id.' In your logout workflow (before 'Log the user out'), add: Make changes to UserSession where unique id = page's current_session_id → logout_time = Current date/time, duration_minutes = (Current date/time - This UserSession's login_time):format as seconds / 60 rounded to 0.
Pro tip: Also track sessions ending from page close using the 'User is logged out' page event or a 'Page is unloading' JavaScript trigger.
Expected result: Each user login creates a session record, and logout populates the end time and duration.
Log feature usage events throughout the app
Log feature usage events throughout the app
At key interaction points in your app, add event logging. For example, when a user clicks the pricing page button, add a workflow action: Create a new thing EngagementEvent (user = Current User, event_name = 'viewed_pricing', timestamp = Current date/time). Do the same for other important actions: 'completed_signup,' 'created_project,' 'invited_teammate,' 'upgraded_plan.' Keep event names consistent (lowercase with underscores) so they are easy to aggregate later.
Expected result: Key user actions are logged as EngagementEvent records with timestamps and event names.
Set up a scheduled backend workflow to aggregate daily metrics
Set up a scheduled backend workflow to aggregate daily metrics
Go to Backend workflows and create a workflow called 'aggregate_daily_metrics.' Schedule it to run daily at midnight. In the workflow: (1) Calculate DAU by searching UserSessions where login_time is today, then counting unique users. (2) Calculate new users by searching Users where Created Date is today:count. (3) Calculate average session duration from today's UserSessions. (4) Count total EngagementEvents from today. (5) Create a new DailyMetric record with all these values. Schedule the workflow to re-run itself tomorrow.
Expected result: Every day at midnight, a DailyMetric record is created with aggregated engagement numbers.
Build the analytics dashboard with charts
Build the analytics dashboard with charts
Create an 'analytics' page. Add a chart element (from the Chart.js plugin). Set the chart type to 'Line.' For the X-axis, use DailyMetric records' dates (search DailyMetrics sorted by date, last 30 days). For the Y-axis dataset, use dau_count values. Add a second dataset for new_users in a different color. Below the chart, add summary cards: a Group showing 'Today's DAU' (search DailyMetrics where date = today's dau_count), 'This Month's MAU' (search UserSessions where login_time >= first day of month, unique users count), and 'Average Session Duration.' Style cards with large numbers and labels.
Expected result: The analytics dashboard shows a 30-day trend chart and summary cards with key engagement metrics.
Add event breakdown and filtering
Add event breakdown and filtering
Below the main chart, add a Repeating Group showing event name breakdown. Data source: search EngagementEvents where timestamp >= 30 days ago, grouped by event_name, aggregation: count. Display each event name with its count and a percentage of total. Add date range filters (two Date Picker elements for start and end dates) that constrain all searches on the page. Add a Dropdown filter for specific event names so admins can drill down into specific user actions.
Expected result: Admins can see which features are used most, filter by date range, and drill into specific event types.
Complete working example
1USER ENGAGEMENT TRACKING SYSTEM2=================================34Data Types:5 UserSession: user (User), login_time, logout_time,6 duration_minutes, device_type7 EngagementEvent: user (User), event_name, event_data, timestamp8 DailyMetric: date, dau_count, new_users,9 avg_session_minutes, total_events1011Session Tracking:12 On Login:13 Create UserSession (user, login_time = now)14 Set state: current_session_id = Result's unique id15 On Logout:16 Make changes to UserSession (current_session_id)17 logout_time = now18 duration_minutes = (now - login_time) in minutes1920Event Logging (at key interaction points):21 Create EngagementEvent22 user = Current User23 event_name = 'viewed_pricing' | 'created_project' | etc.24 timestamp = Current date/time2526Daily Aggregation (Backend Workflow - midnight):27 1. DAU = Search UserSessions (today):unique users:count28 2. New Users = Search Users (created today):count29 3. Avg Session = Search UserSessions (today):each duration:average30 4. Total Events = Search EngagementEvents (today):count31 5. Create DailyMetric with above values32 6. Schedule self for tomorrow midnight3334Dashboard Page:35 Line Chart: DailyMetric date (x) vs dau_count + new_users (y)36 Summary Cards: Today DAU, Month MAU, Avg Session, Total Events37 Event Breakdown: RG grouped by event_name with counts38 Filters: Date range pickers, event name dropdownCommon mistakes when monitoring user engagement metrics tracking in Bubble.io: Step-by-Step Guide
Why it's a problem: Counting total sessions instead of unique users for DAU
How to avoid: Use ':unique elements' on the user field of your UserSession search results before counting, or use ':group by' on user.
Why it's a problem: Not handling session end for users who close the browser without logging out
How to avoid: Add a scheduled backend workflow that finds sessions older than 24 hours with no logout_time and sets the duration based on the last known activity time.
Why it's a problem: Logging too many events and overwhelming the database
How to avoid: Only track meaningful events: key conversions, feature usage, and navigation to important pages. Quality over quantity.
Best practices
- Track sessions (login/logout times) and discrete events (feature clicks) as separate Data Types
- Aggregate raw data into DailyMetric snapshots to avoid expensive real-time calculations
- Use consistent, lowercase event names with underscores for easy grouping and filtering
- Schedule daily aggregation via backend workflows rather than calculating metrics on page load
- Handle orphaned sessions (no logout time) with a cleanup backend workflow
- Add date range filters to all dashboard views so admins can analyze any time period
- Keep raw event data for at least 90 days for detailed analysis, then archive or delete
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to build a user engagement analytics dashboard in Bubble.io. How do I track daily active users, session duration, and feature usage events? Show me the Data Types needed, how to aggregate metrics with scheduled backend workflows, and how to display the data in charts.
Build an analytics tracking system. Create UserSession, EngagementEvent, and DailyMetric data types. Track sessions on login/logout, log key feature events, aggregate daily metrics with a scheduled backend workflow, and display a dashboard with line charts showing DAU trends and event breakdowns.
Frequently asked questions
Can I track engagement without building my own system?
Yes. You can embed Google Analytics, Mixpanel, or Amplitude via script tags in your page header. However, building your own gives you full control and avoids third-party data sharing.
How do I calculate Monthly Active Users (MAU)?
Search UserSessions where login_time is within the current month, then count unique users. Store this as a monthly metric or calculate it on demand on your dashboard.
Will tracking events consume a lot of Workload Units?
Each event creation costs approximately 0.5 WU. For an app with 1,000 DAU and 5 events per user per day, that is about 2,500 WU per day — manageable on Growth plans and above.
How do I export analytics data?
Go to Data tab → App data → select DailyMetric or EngagementEvent → click the export button to download a CSV file that you can analyze in spreadsheets or BI tools.
Can RapidDev help build a custom analytics dashboard?
Yes. RapidDev builds custom analytics dashboards in Bubble with advanced features like cohort analysis, funnel tracking, and real-time metric displays tailored to your specific KPIs.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation