Skip to content
Skills Library
Programming · Building & coding

analytics-setup

/analytics-setup

Generates protocol-based analytics infrastructure with swappable providers (TelemetryDeck, Firebase, Mixpanel). Use when user wants to add analytics, track events, or set up telemetry.

Licence
MIT
Last repository change
24.07.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
8
Scripts
6
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 24.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 6 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: templates/AnalyticsEvent.swift, templates/AnalyticsService.swift, templates/AnalyticsServiceKey.swift, templates/Providers/FirebaseAnalytics.swift, templates/Providers/NoOpAnalytics.swift, templates/Providers/TelemetryDeckAnalytics.swift

What it does and when to use it

Generates protocol-based analytics infrastructure with swappable providers (TelemetryDeck, Firebase, Mixpanel). Use when user wants to add analytics, track events, or set up telemetry.

Original author description

Generates protocol-based analytics infrastructure with swappable providers (TelemetryDeck, Firebase, Mixpanel). Use when user wants to add analytics, track events, or set up telemetry.

How it works

  1. When This Skill Activates
  2. Key Feature: Swappable Providers
  3. Pre-Generation Checks
  4. Configuration Questions
  5. Generation Process
  6. Output Format
  7. References
Original SKILL.md headings · 183 lines, 535 words
SKILL.md preview
---
name: analytics-setup
description: Generates protocol-based analytics infrastructure with swappable providers (TelemetryDeck, Firebase, Mixpanel). Use when user wants to add analytics, track events, or set up telemetry.
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion]
last_verified: 2026-07-16
review_by: 2027-06-22
---

# Analytics Setup Generator

Generate a protocol-based analytics infrastructure that makes it easy to swap providers without changing app code.

## When This Skill Activates

Use this skill when the user:
- Asks to "add analytics" or "set up analytics"
- Mentions "TelemetryDeck", "Firebase Analytics", "Mixpanel"
- Wants to "track events" or "add telemetry"
- Asks about "privacy-friendly analytics"
- Wants to swap analytics providers

## Key Feature: Swappable Providers

The generated code uses a protocol-based architecture:

```swift
// Your app uses the protocol
analytics.track(.buttonTapped("subscribe"))

// Swap providers by changing ONE line:
let analytics: AnalyticsService = TelemetryDeckAnalytics() // or FirebaseAnalytics()
```

## Pre-Generation Checks

### 1. Project Context Detection
- [ ] Check for existing analytics implementations
- [ ] Look for TelemetryDeck/Firebase/Mixpanel in Package.swift or Podfile
- [ ] Identify source file locations

### 2. Conflict Detection
Search for existing analytics:
```
Glob: **/*Analytics*.swift, **/*Telemetry*.swift
Grep: "protocol.*Analytics" or "TelemetryDeck" or "Firebase"
```

If found, ask user:
- Extend existing analytics?
- Replace with new implementation?
- Add new provider to existing setup?

## Configuration Questions

Ask user via AskUserQuestion:

1. **Which provider(s)?**
   - TelemetryDeck (privacy-friendly, recommended)
   - Firebase Analytics
   - Mixpanel
   - None (NoOp for now, add later)

2. **What events to track?**
   - App lifecycle (launch, background, foreground)
   - Screen views
   - User actions (buttons, features used)
   - Errors
   - Custom events

3. **User properties?**
   - App version
   - Subscription status
   - Custom properties

## Generation Process

### Step 1: Create Core Files

Always generate these files:
1. `AnalyticsService.swift` - Protocol (never changes)
2. `AnalyticsEvent.swift` - Event definitions (app-specific)
3. `NoOpAnalytics.swift` - For testing/privacy mode

### Step 2: Create Selected Provider(s)

Based on user selection:
- `TelemetryDeckAnalytics.swift`
- `FirebaseAnalytics.swift`
- `MixpanelAnalytics.swift`

### Step 3: Create Environment Integration

For SwiftUI apps:
- `AnalyticsServiceKey.swift` - Environment key for dependency injection

### Step 4: Determine File Location

Check project structure:
- If `Sources/` exists → `Sources/Analytics/`
- If `App/` exists → `App/Analytics/`
- Otherwise → `Analytics/`

## Output Format

After generation, provide:

### Files Created
```
Sources/Analytics/
├── AnalyticsService.swift          # Protocol (stable interface)
├── AnalyticsEvent.swift            # Your app's events
├── Providers/
│   ├── NoOpAnalytics.swift         # Testing/privacy
│   └── [Provider]Analytics.swift   # Selected provider(s)
└── AnalyticsServiceKey.swift       # SwiftUI Environment (optional)
```

### Integration Steps

**App Entry Point:**
```swift
@main
struct MyApp: App {
    // Choose your provider
    private let analytics: AnalyticsService = TelemetryDeckAnalytics(appID: "YOUR-APP-ID")

    init() {
        analytics.configure()
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
                .environment(\.analytics, analytics)
        }
    }
}
```

**Tracking Events:**
```swift
struct ContentView: View {
    @Environment(\.analytics) private var analytics

    var body: some View {
        Button("Subscribe") {
            analytics.track(.buttonTapped("subscribe"))
        }
    }
}
```

### Required Dependencies

**TelemetryDeck:**
```swift
// Package.swift
.package(url: "https://github.com/TelemetryDeck/SwiftClient", from: "1.0.0")
```

**Firebase:**
```swift
// Package.swift
.package(url: "https://github.com/firebase/firebase-ios-sdk", from: "10.0.0")
// Also requires GoogleService-Info.plist
```

### Swapping Providers Later

To switch providers:
1. Add new provider file (or generate with this skill)
2. Change ONE line in App.swift:
```swift
// Before
private let analytics: AnalyticsService = TelemetryDeckAnalytics(...)

// After
private let analytics: AnalyticsService = FirebaseAnalytics()
```

### Testing
- Use `NoOpAnalytics()` in tests and previews
- All tracking calls become no-ops
- No external dependencies in tests

## References

- **analytics-patterns.md** - Protocol architecture and best practices
- **templates/** - All template files
Files in this package (8)
  • SKILL.md 5 KB
  • analytics-patterns.md 7 KB
  • templates/AnalyticsEvent.swift 3 KB
  • templates/AnalyticsService.swift 2 KB
  • templates/AnalyticsServiceKey.swift 1 KB
  • templates/Providers/FirebaseAnalytics.swift 3 KB
  • templates/Providers/NoOpAnalytics.swift 1 KB
  • templates/Providers/TelemetryDeckAnalytics.swift 2 KB

Versions

The database has no other skills named analytics-setup.

Database snapshot: 13.11.2026 · package version 9f6ff61aa157 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90apple-three-piece-analytics
    Choose analytics and metrics sources for a solo / small-team Apple app and decide whether a third-party tracking SDK is justified. Use when picking an analytics SDK; when asked "should I add Firebase / Mixpanel / Amplitude / TelemetryDeck"; when asked what App Store Connect…
  • 90mobile-analytics
    Use this skill when the user says 'analytics', 'event tracking', 'Firebase Analytics', 'Mixpanel', 'Amplitude', 'app analytics', 'event logging', 'user properties', 'screen tracking', 'funnel analytics', 'user behavior', 'telemetry'. Track events, screen views, and user…
  • 90firebase-analytics
    Comprehensive guide for Google Analytics for Firebase (GA4F), including base setup, SDK initialization, screen tracking, and event logging on Android and iOS. Use this skill when setting up Google Analytics, adding the SDK, or logging analytics events. Don't use for standalone…
  • 95tracking
    Server-side analytics tracking with pluggable providers. Use when adding analytics events, registering custom tracking providers, or configuring built-in providers (PostHog, Mixpanel, Amplitude, Webhook).
  • 100gx-mixpanel-expert
    Implement Mixpanel tracking plans, funnels, retention, and Boards. Use when the user asks for mixpanel product analytics expert work, or mentions gx, mixpanel, expert.
  • 100tracking-implementation
    Guides a coding agent through helping a Mixpanel customer implement analytics correctly. Covers Quick Start (first events in one session), Full Implementation (complete production-ready setup), Add Tracking (extend existing implementation), and Implementation Audit. Use when a…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.