# How to track user activity in Bubble

- Tool: Bubble
- Difficulty: Beginner
- Time required: 20-25 min
- Compatibility: All Bubble plans
- Last updated: March 2026

## TL;DR

Track user activities in Bubble by creating an ActivityLog data type that records every significant action — page visits, button clicks, form submissions, and data changes. This tutorial covers building the logging infrastructure, displaying activity feeds, and creating an admin view for monitoring user behavior.

## Overview: Tracking User Activities in Bubble

An activity log records what users do inside your app — logins, profile updates, purchases, content creation. This tutorial builds a comprehensive activity tracking system for user feeds and admin monitoring.

## Before you start

- A Bubble account with user authentication
- Basic understanding of Workflows and Data Types
- Existing features to attach tracking to

## Step-by-step guide

### 1. Create the ActivityLog data type

Create 'ActivityLog' with fields: user (User), action (text — e.g., 'logged_in', 'created_post', 'updated_profile'), details (text — additional context), page (text — where it happened), ip_address (text, optional). The Created Date auto-field serves as the timestamp.

**Expected result:** ActivityLog data type is ready for recording user actions.

### 2. Add logging to key workflows

In every important workflow (login, signup, purchase, content creation, settings update), add an action: Create ActivityLog → user = Current User, action = descriptive text, details = relevant context, page = Current page name. Place this as the first or last action in each workflow.

> Pro tip: Create a reusable backend workflow called 'log-activity' with user, action, and details parameters. Call it from any frontend workflow for consistent logging.

**Expected result:** Key user actions create ActivityLog records automatically.

### 3. Display the user activity feed

On the user profile or dashboard page, add a Repeating Group: Search for ActivityLog where user = Current User, sorted by Created Date descending. Display the action, details, and formatted timestamp in each row. Use icons or color coding for different action types.

**Expected result:** Users see their recent activity history on their profile.

### 4. Build the admin activity dashboard

Create an admin page with a Repeating Group showing all ActivityLog records. Add filters: by user (search input), by action type (dropdown), by date range (date pickers). Show columns: timestamp, user name, action, details, page. Add pagination for performance.

**Expected result:** Admins can search and filter all user activities across the platform.

### 5. Manage log retention

Schedule a daily backend workflow that deletes ActivityLog records older than 90 days (or your preferred retention period). This prevents the database from growing indefinitely. For compliance, archive important logs before deletion by exporting to CSV.

**Expected result:** Old activity logs are automatically cleaned up to maintain database performance.

## Complete code example

File: `Workflow summary`

```text
ACTIVITY TRACKING — ARCHITECTURE
==================================

DATA TYPE: ActivityLog
  user (User), action (text), details (text),
  page (text), Created Date (auto)

LOGGING POINTS:
  Login → action: 'logged_in'
  Signup → action: 'signed_up'
  Profile update → action: 'updated_profile', details: changed fields
  Post created → action: 'created_post', details: post title
  Purchase → action: 'made_purchase', details: amount + product
  Settings change → action: 'changed_settings', details: setting name

DISPLAY:
  User feed: RG filtered by current user, sorted by date desc
  Admin dashboard: RG with user/action/date filters

RETENTION:
  Daily backend workflow: delete logs older than 90 days
  Archive before deletion if compliance requires
```

## Common mistakes

- **Logging every single mouse click and page view** — Excessive logging fills the database quickly and wastes workload units Fix: Log only significant actions: logins, data changes, purchases, and security-relevant events
- **Not adding privacy rules to ActivityLog** — Users could potentially see other users' activities through the API Fix: Add a privacy rule: ActivityLog visible only when user = Current User (or Current User is admin)
- **Never cleaning up old logs** — The ActivityLog table grows indefinitely, slowing searches and increasing storage costs Fix: Schedule automatic deletion of logs older than your retention period

## Best practices

- Log only meaningful actions, not every page view or click
- Use a reusable backend workflow for consistent log creation
- Add privacy rules to restrict log visibility
- Schedule automatic cleanup of old records
- Include enough detail to be useful but not so much that it creates privacy concerns
- Paginate all activity displays to 20-30 items per page

## Frequently asked questions

### How many activities should I log?

Focus on business-critical actions: logins, data modifications, purchases, and security events. Avoid logging passive actions like scrolling or hovering.

### Will activity logging affect performance?

Each log is one database write (~0.5 WU). For 1,000 daily active users with 10 logged actions each, that is about 5,000 WUs/day — manageable on paid plans.

### Can I export activity logs?

Yes. Go to Data tab → App data → ActivityLog → Export to download all records as CSV.

### How long should I keep activity logs?

90 days is standard for most apps. Financial and healthcare apps may require longer retention per regulations.

### Can I create alerts based on activities?

Yes. In the logging workflow, add conditions: if action = 'failed_login' and count of recent failures > 5 → send admin notification.

### Can RapidDev build a monitoring system?

Yes. RapidDev builds comprehensive activity monitoring with real-time alerts, compliance reporting, and behavioral analytics.

---

Source: https://www.rapidevelopers.com/bubble-tutorial/keep-track-of-user-activities-in-bubble
© RapidDev — https://www.rapidevelopers.com/bubble-tutorial/keep-track-of-user-activities-in-bubble
