> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/FALAK097/typesteps/llms.txt
> Use this file to discover all available pages before exploring further.

# Daily Goals

> Set typing goals, track progress, and receive milestone notifications

TypeSteps helps you stay motivated by setting daily typing goals and celebrating when you achieve them. This guide covers goal setting, progress tracking, and milestone notifications.

## Setting Your Daily Goal

### From the Dashboard

1. Open the TypeSteps dashboard
2. Navigate to **Settings** or the **Goals** section
3. Enter your target number of daily keystrokes
4. Your goal is automatically saved

<Note>
  Goals are stored in UserDefaults with the key `daily_goal`. The app checks this value to track your progress throughout the day.
</Note>

### Recommended Goals

Choose a goal based on your typing activity:

* **Light users** (casual typing): 5,000 - 10,000 keystrokes/day
* **Regular users** (daily work): 15,000 - 25,000 keystrokes/day
* **Heavy users** (developers, writers): 30,000 - 50,000 keystrokes/day
* **Power users** (intensive coding/writing): 50,000+ keystrokes/day

<Accordion title="How much is 10,000 keystrokes?">
  - Approximately 2,000-2,500 words
  - About 2-3 hours of active typing
  - Equivalent to writing 3-4 pages of code or documentation
  - Around 30-40 emails or messages
</Accordion>

## How Goals Work

TypeSteps tracks your progress in real-time. Here's how the system works:

### Progress Tracking

Every keystroke is counted and checked against your daily goal (StorageManager.swift:75-77):

```swift theme={null}
if minuteStats.count > 120 {
    let keys = minuteStats.keys.sorted().prefix(minuteStats.count - 120)
    for key in keys { minuteStats.removeValue(forKey: key) }
}

checkMilestones(count: dailyStats[dayString] ?? 0, day: dayString)
saveStats()
```

The app:

1. Increments your count with each keystroke
2. Updates daily, hourly, and per-minute statistics
3. Checks if you've reached any milestones
4. Saves progress automatically

### Milestone Detection

TypeSteps checks for goal completion (StorageManager.swift:79-93):

```swift theme={null}
private func checkMilestones(count: Int, day: String) {
    let goal = UserDefaults.standard.integer(forKey: "daily_goal")
    guard goal > 0 else { return }
    
    let milestones = [1.0]  // 100% of goal
    var notified = UserDefaults.standard.dictionary(forKey: notifiedKey) as? [String: [Double]] ?? [:]
    var dayNotified = notified[day] ?? []
    
    for m in milestones {
        if Double(count) >= Double(goal) * m && !dayNotified.contains(m) {
            sendNotification()
            dayNotified.append(m)
        }
    }
    
    notified[day] = dayNotified
    UserDefaults.standard.set(notified, forKey: notifiedKey)
}
```

Key features:

* Currently tracks 100% goal completion (`milestones = [1.0]`)
* Can be extended to support 50%, 75%, 150% milestones
* Prevents duplicate notifications for the same day
* Tracks which milestones you've achieved per day

## Notifications

### Goal Completion Notification

When you reach your daily goal, TypeSteps sends a notification (StorageManager.swift:95-102):

```swift theme={null}
private func sendNotification() {
    let content = UNMutableNotificationContent()
    content.title = "Goal Reached! 🎯"
    content.body = "Congratulations! You've reached your daily typing goal."
    content.sound = .default
    
    let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
    UNUserNotificationCenter.current().add(request)
}
```

### Notification Setup

TypeSteps requests notification permissions on launch (TypeStepsApp.swift:6-9):

```swift theme={null}
func applicationDidFinishLaunching(_ notification: Notification) {
    NSApp.setActivationPolicy(.regular)
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { _, _ in }
    // ...
}
```

<Warning>
  Make sure notifications are enabled in System Settings > Notifications > TypeSteps for goal alerts to work.
</Warning>

## Viewing Your Progress

### Menu Bar Stats

Quick progress view from the menu bar:

* **Today**: Current keystroke count
* **This Week**: Weekly total
* **This Month**: Monthly total

### Dashboard Insights

The dashboard provides detailed progress information:

* **Current count** vs. **goal** percentage
* **Streak tracking**: Days in a row you've met your goal
* **Best day**: Your highest keystroke count ever
* **Productivity badges**: Earned based on consistency

## Productivity Badges

TypeSteps awards badges based on your performance (StorageManager.swift:194-201):

```swift theme={null}
func getProductivityBadge() -> (label: String, color: Color) {
    let streak = getCurrentStreak()
    let todayCount = getCount()
    
    if streak >= 30 { return ("UNSTOPPABLE", .red) }
    if streak >= 7 { return ("CONSISTENT", .orange) }
    if todayCount >= UserDefaults.standard.integer(forKey: "daily_goal") { 
        return ("GOAL GETTER", .green) 
    }
    return ("ON THE RISE", .blue)
}
```

Badges you can earn:

* **ON THE RISE** (Blue): Default badge, you're building momentum
* **GOAL GETTER** (Green): Met today's typing goal
* **CONSISTENT** (Orange): 7+ day streak of meeting goals
* **UNSTOPPABLE** (Red): 30+ day streak - elite status!

## Streak Tracking

Your streak counts consecutive days where you've typed at least 1 keystroke (StorageManager.swift:305-322):

```swift theme={null}
func getCurrentStreak() -> Int {
    let calendar = Calendar.current
    var currentStreak = 0
    var checkDate = Date()
    
    while true {
        let key = dateFormatter.string(from: checkDate)
        if let count = dailyStats[key], count > 0 {
            currentStreak += 1
            guard let nextDate = calendar.date(byAdding: .day, value: -1, to: checkDate) else { break }
            checkDate = nextDate
        } else {
            if calendar.isDateInToday(checkDate) {
                guard let nextDate = calendar.date(byAdding: .day, value: -1, to: checkDate) else { break }
                checkDate = nextDate
                continue
            }
            break
        }
    }
    return currentStreak
}
```

Streak features:

* Counts backward from today to find consecutive active days
* Allows today to be "in progress" (doesn't break streak if today has 0 yet)
* Powers productivity badge calculations
* Displayed prominently in dashboard

## Goal Strategies

### Progressive Goals

<Steps>
  <Step title="Start Conservative">
    Set a goal you can easily achieve for the first week (e.g., 5,000 keystrokes)
  </Step>

  <Step title="Analyze Your Baseline">
    Review your actual daily averages after a week
  </Step>

  <Step title="Increase Gradually">
    Raise your goal by 10-20% each week until you find your sustainable target
  </Step>

  <Step title="Maintain Consistency">
    Once you find a good goal, focus on maintaining streaks rather than constantly increasing
  </Step>
</Steps>

### Work-Life Balance

<Note>
  Consider setting different goals for weekdays vs. weekends. You can manually adjust your goal in settings to match your expected activity level.
</Note>

## Advanced Goal Ideas

While TypeSteps currently supports daily goals, you could extend the system:

<Accordion title="Weekly Goals">
  Track total keystrokes across a week rather than daily. Good for people with variable schedules.
</Accordion>

<Accordion title="Project-Specific Goals">
  Set goals per project (TypeSteps already tracks projects via window titles).
</Accordion>

<Accordion title="Category Goals">
  Set goals for specific app categories (Code, Writing, Communication) - data is already tracked.
</Accordion>

<Accordion title="Multiple Daily Milestones">
  Add 50%, 75%, 125%, 150% milestones by modifying the `milestones` array in `checkMilestones()`:

  ```swift theme={null}
  let milestones = [0.5, 0.75, 1.0, 1.25, 1.5]
  ```
</Accordion>

## Next Steps

<CardGroup cols={2}>
  <Card title="Data Management" icon="database" href="/guides/data-management">
    Backup your goal data and statistics
  </Card>

  <Card title="WakaTime Integration" icon="clock" href="/integrations/wakatime">
    Compare typing goals with coding time
  </Card>
</CardGroup>
