Track Better stores all your data locally in your browser using localStorage. This guide explains how data storage works and how to manage it effectively.
How localStorage Works
Track Better uses the browser’s localStorage API to store data persistently on your device.
What Gets Stored
The app stores three main pieces of data in localStorage:
1. Completed Exercises (completedExercises)
Stores all your workout logs organized by date:
{
"2026-03-07": {
"exercise-1": [
{ "reps": 12, "loggedAt": "2026-03-07T14:30:00.000Z" },
{ "reps": 10, "loggedAt": "2026-03-07T14:35:00.000Z" }
],
"exercise-2": [
{ "reps": 15, "loggedAt": "2026-03-07T14:40:00.000Z" }
]
},
"2026-03-06": {
// Previous day's logs
}
}
2. User Name (userName)
Stores your name for personalized greetings:
3. App State (activeTab, theme)
Stores UI preferences:
"today" // active tab
"dark" // theme preference
Storage Implementation
The useLocalStorage hook in src/hooks/useLocalStorage.js:1-32 handles all localStorage operations:
On component mount:
- Reads value from localStorage
- Parses JSON string to JavaScript object
- Returns initial value if key doesn’t exist
- Returns default value if parsing fails
On state change:
- Serializes new value to JSON string
- Saves to localStorage with
setItem()
- Handles quota exceeded errors gracefully
Error handling:
- Invalid JSON is logged and ignored
- Storage errors are caught and logged
- App continues working with in-memory state
Data Retention
How Long Data Persists
localStorage data persists indefinitely until:
- You manually clear browser data
- You use the Hard Reset feature
- Browser storage is cleared by the system (rare)
- You uninstall the browser (not just the PWA)
Data does NOT expire:
- No automatic cleanup
- No time-based deletion
- Unlimited retention period
Browser-Specific Behavior
Chrome/Edge:
- localStorage persists across browser restarts
- Survives browser updates
- Only cleared manually or via hard reset
Firefox:
- Similar to Chrome
- May prompt to clear data when disk space is low
Safari:
- 7-day cap in Private Browsing mode
- Normal mode persists indefinitely
- May clear data on iOS if storage is critically low
Cross-Browser Isolation
Data in Chrome is separate from Firefox on the same device:
- Each browser has its own localStorage
- Installing on different browsers = separate data
- Use export/import to sync across browsers
Managing Storage Space
Checking Storage Usage
To see how much space Track Better is using:
- Open DevTools (F12)
- Go to Application tab
- Click Storage in sidebar
- View usage under “Storage”
Or check localStorage directly:
- Application > Local Storage > your domain
- Click each key to see size
completedExercises is usually the largest
Storage Limits
Browsers typically allow 5-10 MB per domain:
- Chrome/Edge: ~10 MB
- Firefox: ~10 MB
- Safari: ~5 MB (may vary)
Track Better typically uses:
- 30 days: 10-20 KB
- 1 year: 50-100 KB
- 5 years: 250-500 KB
You’re unlikely to hit storage limits under normal use.
Quota Exceeded Errors
If you see “QuotaExceededError” (extremely rare):
Failed to execute 'setItem' on 'Storage': Setting the value exceeded the quota.
Solutions:
- Export your data to create a backup
- Clear old data (see below)
- Import recent data to continue tracking
Clearing Old Data
Option 1: Manual Date Removal
Remove specific dates from your history:
- Export data as backup (Settings > Export Data)
- Open DevTools (F12) > Application > Local Storage
- Click
completedExercises to view JSON
- Click to edit the value
- Remove old date entries (format:
YYYY-MM-DD)
- Save changes
Example - Before:
{
"2025-01-15": { /* old data */ },
"2025-01-16": { /* old data */ },
"2026-03-05": { /* recent data */ },
"2026-03-06": { /* recent data */ }
}
After (removing old data):
{
"2026-03-05": { /* recent data */ },
"2026-03-06": { /* recent data */ }
}
Option 2: Export and Filter
Create a filtered backup with only recent data:
- Export your full data (Settings > Export Data)
- Open the JSON file in a text editor
- Edit
completedExercises to keep only recent dates
- Save the modified JSON file
- Hard reset the app (Settings > Hard Reset)
- Import the filtered JSON file
This gives you a fresh start with selected data.
Option 3: Hard Reset
Completely clear all data:
- Export data first (cannot be undone without backup!)
- Go to Settings tab
- Scroll to “Danger Zone”
- Click Hard Reset All Data
- Confirm the action
What gets deleted:
- All workout logs (
completedExercises)
- User name (
userName)
- Active tab preference (
activeTab)
- Theme resets to default
The app will show the first-time greeting modal.
Export & Backup Strategies
When to Export
Create exports regularly to prevent data loss:
Recommended schedule:
- Weekly exports for active users
- Monthly exports for casual users
- Before major browser updates
- Before clearing browser data
- Before hard reset operations
- Before switching devices
Export Process
From SettingsTab.jsx:66-84:
- Click Export Data in Settings
- File downloads as
workout-journey-YYYY-MM-DD.json
- Contains full workout history and settings
Export includes:
{
"userName": "Your Name",
"exportDate": "2026-03-07T10:00:00.000Z",
"completedExercises": {
// All your workout logs
},
"summary": {
"totalDaysTracked": 45,
"totalSetsCompleted": 320,
"currentStreak": 7
}
}
Storing Backups Safely
Cloud storage:
- Google Drive / Dropbox / OneDrive
- Email to yourself
- Cloud notes (Notion, Evernote)
Local storage:
- USB drive or external hard drive
- Multiple devices for redundancy
- Named with dates for version control
Best practices:
- Keep at least 3 recent exports
- Name files clearly:
track-better-2026-03-07.json
- Store in multiple locations
- Test imports periodically to verify backups work
Import & Restore Data
Import Process
From SettingsTab.jsx:133-168:
- Go to Settings tab
- Click Import Data
- Select exported JSON file
- Data is validated and imported
- Success message appears
Import validation:
- Checks for
completedExercises field
- Validates JSON structure
- Imports
userName if present
- Shows error for invalid files
What Happens on Import
The import function in App.jsx:183-198:
- Overwrites
completedExercises with imported data
- Merges old and new data (new data wins)
- Updates
userName if present in import
- Recalculates streak and analytics
- Updates UI immediately
Important: Importing doesn’t delete data not in the import file—it merges.
Merging Data from Multiple Devices
To combine data from two devices:
- Export data from Device A
- Export data from Device B
- Manually merge JSON files in a text editor:
- Combine
completedExercises date keys
- Keep most recent
userName
- Merge exercise logs for duplicate dates
- Import merged file to either device
Note: Track Better doesn’t auto-merge. Manual merge required.
Hard Reset Explained
What Hard Reset Does
From App.jsx:148-170, hard reset:
- Shows confirmation dialog
- Clears all React state:
setCompletedExercises({})
setUserName("")
setActiveTab("today")
- Removes localStorage keys:
completedExercises
userName
activeTab
- Shows greeting modal for new user setup
When to Use Hard Reset
Good reasons:
- Starting fresh tracking program
- Clearing test data
- Resolving storage quota issues
- Fixing corrupted data
Bad reasons:
- Accidentally clicked (cannot undo!)
- Trying to clear one workout (use Reset Today instead)
- Before exporting data
Recovery After Hard Reset
If you accidentally hard reset:
- Do NOT close the browser (data might still be in memory)
- Check if you have an export file
- Import the most recent export
- If no export exists, data is lost
Prevention:
- Export before hard reset
- Read confirmation dialog carefully
- Keep regular backups
Recovering Lost Data
Scenarios and Solutions
1. Cleared browser data accidentally
- Import most recent export file
- If no export: data is lost
2. Hard reset without export
- Check Downloads folder for old exports
- Check email/cloud for backups
- If none exist: data is lost
3. Browser crashed/corrupted
- localStorage may still be intact
- Open app and check if data loads
- Export immediately if data is present
- Import to fresh browser profile if needed
4. Switched browsers
- Data is browser-specific
- Go back to old browser
- Export from old browser
- Import to new browser
5. Lost device
- Data only on that device
- Recover from exports if you made them
- No server-side backup available
Data Cannot Be Recovered If:
- No export file exists
- localStorage was cleared
- Device was factory reset
- Browser was uninstalled
- Hard reset without backup
Prevention is the only solution. Export regularly!
Best Practices
Daily Use
- Log workouts as you complete them
- Check streak to stay motivated
- Review history in calendar view
Weekly Maintenance
- Export data every Sunday
- Store export in cloud storage
- Verify export file is valid
Monthly Review
- Check storage usage in DevTools
- Review old data for cleanup
- Test import process with old export
- Delete very old exports (keep 3 most recent)
Before Major Changes
- Export before browser updates
- Export before clearing browser data
- Export before hard reset
- Export before switching devices
- Export before PWA uninstall
Advanced Tips
Manual localStorage Access
For developers or advanced users:
// Read data
const data = JSON.parse(localStorage.getItem('completedExercises'));
// Modify data
data['2026-03-07'] = {}; // Clear a specific date
// Save data
localStorage.setItem('completedExercises', JSON.stringify(data));
Automated Backups
Create a browser bookmark with this JavaScript:
javascript:(function(){
const data = {
userName: localStorage.getItem('userName'),
completedExercises: localStorage.getItem('completedExercises')
};
const blob = new Blob([JSON.stringify(data)], {type: 'application/json'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `backup-${new Date().toISOString()}.json`;
a.click();
})();
Click the bookmark to instantly export data.
Cross-Browser Sync Script
Advanced users can write a script to:
- Export from multiple browsers
- Merge JSON files
- Import to all browsers
- Keep data in sync
This requires manual scripting and is not built into the app.
Getting Help
If you encounter data issues:
- Check Troubleshooting guide
- Review FAQ for common questions
- Open an issue on GitHub
- Include:
- Browser and version
- Error messages
- Steps to reproduce
- Export file (if relevant)
Critical Reminder: Track Better has no server-side storage. Your browser’s localStorage is the only copy of your data. Export regularly to prevent permanent data loss.