Respectlytics Respect lytics
Menu

Official SDKs

Privacy-first analytics SDKs for Swift, Flutter, React Native, and Kotlin. Simple integration, automatic session management, offline support, and zero device identifier collection.

v2.0.0 πŸ“¦ Swift Package Manager iOS 15+ / macOS 12+

Installation

Add the Respectlytics SDK to your project using Swift Package Manager:

Option 1: Xcode

In Xcode, go to File β†’ Add Package Dependencies and enter:

URL
https://github.com/respectlytics/respectlytics-swift.git

Option 2: Package.swift

Add to your Package.swift dependencies:

Swift
dependencies: [
    .package(url: "https://github.com/respectlytics/respectlytics-swift.git", from: "2.0.0")
]

Quick Start

Get started with just 2 lines of code:

Swift
import RespectlyticsSwift

// 1. Configure (call once at app launch)
Respectlytics.configure(apiKey: "your-api-key")

// 2. Track events
Respectlytics.track("purchase", screen: "CheckoutScreen")

API Reference

Method Description
configure(apiKey:) Initialize the SDK. Call once in application(_:didFinishLaunchingWithOptions:)
track(_:screen:) Track an event with optional screen name
flush() Force send queued events. SDK auto-flushes, rarely needed

Full Example

Swift
import SwiftUI
import RespectlyticsSwift

@main
struct MyApp: App {
    init() {
        // Configure SDK at launch
        Respectlytics.configure(apiKey: "your-api-key")
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

struct ContentView: View {
    var body: some View {
        VStack {
            Button("Sign Up") {
                Respectlytics.track("signup_started", screen: "Onboarding")
            }

            Button("Purchase") {
                Respectlytics.track("purchase_completed", screen: "Checkout")
            }
        }
    }
}

πŸ”’ Privacy by Design

Respectlytics is designed to minimize data collection by default. We use anonymized identifiers that are stored only in device memory (RAM) and rotate automatically every two hours or upon app restart. IP addresses are processed transiently for approximate region lookup and immediately discardedβ€”no personal data is ever persisted server-side. This privacy-by-design architecture avoids persistent device storage and cross-session tracking, significantly reducing compliance complexity compared to traditional analytics. While this approach may reduce or eliminate consent requirements in some jurisdictions, regulations and their interpretation vary. We recommend consulting with your legal team to determine your specific compliance requirements.

βœ… What We Collect (11 Fields Only)

  • Event name (e.g., "purchase")
  • Screen name (optional)
  • Session ID (RAM-only, 2-hour rotation)
  • Timestamp
  • Platform & OS version
  • App version & Device type
  • Locale
  • Approximate location (country/region only)

❌ What We NEVER Collect or Store

  • IDFA / GAID / Advertising IDs
  • Device fingerprints or hardware IDs
  • IP addresses (processed transiently, never stored)
  • Custom properties or user-defined data
  • User IDs or persistent identifiers
  • Email, name, phone, or any PII
πŸ€–

AI-Assisted Integration

For Vibe Coders

Building with AI coding assistants like Copilot, Cursor, or Claude? Copy this prompt and paste it into your AI assistant. It will analyze your codebase and add event tracking at appropriate locations throughout your project.

⚠️ Review the results: Always review what your AI assistant generates. The prompt provides guidance, but you know your app best. Remove any events you don't need and add any that are missing.

AI Integration Prompt
I want you to integrate Respectlytics analytics into my project. Respectlytics is a privacy-first analytics SDK that tracks events with minimal data collection.

## SDK Installation

First, install the SDK for my platform:

**Swift (iOS/macOS):**
```swift
// In Xcode: File β†’ Add Package Dependencies
// URL: https://github.com/respectlytics/respectlytics-swift.git
import RespectlyticsSwift
```

**Flutter:**
```yaml
# pubspec.yaml
dependencies:
  respectlytics_flutter: ^2.0.1
```

**React Native:**
```bash
npm install @respectlytics/react-native
# or
yarn add @respectlytics/react-native
```

**Kotlin (Android):**
```kotlin
// build.gradle.kts
implementation("io.github.respectlytics:respectlytics-kotlin:2.0.1")
```

## Configuration

Add this at app launch (ONCE only):

**Swift:**
```swift
// In AppDelegate or @main App init
Respectlytics.configure(apiKey: "YOUR_API_KEY")
```

**Flutter:**
```dart
// In main() before runApp()
await Respectlytics.configure(apiKey: 'YOUR_API_KEY');
```

**React Native:**
```typescript
// In App.tsx or index.js
import Respectlytics from '@respectlytics/react-native';
Respectlytics.configure({ apiKey: 'YOUR_API_KEY' });
```

**Kotlin:**
```kotlin
// In Application.onCreate() or MainActivity
Respectlytics.configure(apiKey = "YOUR_API_KEY")
```

## Event Tracking

Use this pattern to track events:

**Swift:**
```swift
Respectlytics.track("event_name", screen: "ScreenName")  // screen is optional
```

**Flutter:**
```dart
Respectlytics.track('event_name', screen: 'ScreenName');
```

**React Native:**
```typescript
Respectlytics.track('event_name', { screen: 'ScreenName' });
```

**Kotlin:**
```kotlin
Respectlytics.track("event_name", screen = "ScreenName")
```

## Event Naming Conventions

- Use snake_case: `purchase_completed`, `signup_started`
- Be semantic and descriptive: the event name should tell the whole story
- NO custom properties allowed - encode meaning in the event name itself
  - βœ… `premium_plan_selected` instead of ❌ `plan_selected` with `{ tier: "premium" }`
  - βœ… `dark_mode_enabled` instead of ❌ `setting_changed` with `{ setting: "theme", value: "dark" }`

## Your Task

Please analyze my codebase and add Respectlytics event tracking at these locations:

### 1. NAVIGATION EVENTS
Track when users navigate to key screens:
- `screen_viewed` with screen parameter for major screens
- `onboarding_started`, `onboarding_completed`
- `tab_switched` for bottom navigation changes

### 2. USER ACTION EVENTS
Track significant user interactions:
- `button_clicked` for important CTAs (be specific: `signup_button_clicked`, `purchase_button_clicked`)
- `form_submitted`, `form_abandoned`
- `search_performed`, `filter_applied`
- `item_selected`, `item_favorited`, `item_shared`

### 3. CONVERSION EVENTS
Track events that indicate business value:
- `signup_started`, `signup_completed`
- `login_completed`
- `purchase_started`, `purchase_completed`
- `subscription_started`, `trial_started`
- `checkout_started`, `checkout_completed`
- `payment_method_added`

### 4. ENGAGEMENT EVENTS
Track how users engage with content:
- `content_viewed`, `video_played`, `article_read`
- `feature_used` (be specific: `camera_opened`, `share_initiated`)
- `notification_opened`, `notification_dismissed`
- `tutorial_started`, `tutorial_completed`, `tutorial_skipped`

### 5. ERROR/FRICTION EVENTS
Track where users might get stuck:
- `error_displayed` (for user-facing errors)
- `retry_attempted`
- `help_requested`, `support_contacted`

## Important Rules

1. **No custom properties**: The SDK only accepts `eventName` and optional `screen`. Do not try to pass additional data.

2. **Semantic event names**: Since you can't add properties, make event names descriptive:
   - βœ… `dark_mode_enabled`
   - ❌ `setting_changed` (too vague)

3. **One configure() call**: Only call configure() once at app startup.

4. **Don't track sensitive screens**: Skip tracking for screens with personal data entry (password fields, payment details input, etc.)

5. **Screen parameter**: Use PascalCase for screen names: "HomeScreen", "CheckoutScreen", "ProfileSettings"

Now please scan my project and add appropriate Respectlytics.track() calls. Show me the files you would modify and the events you would add.
1️⃣

Copy the prompt

Click the button above to copy the full integration prompt

2️⃣

Paste in your AI assistant

Works with Copilot, Cursor, Claude, ChatGPT, and others

3️⃣

Review & customize

Check the generated events and adjust to your needs

Automatic Behaviors

The SDKs handle these automatically so you don't have to:

Feature Behavior
Session Management Auto-generates session ID, rotates after 30 minutes of inactivity
Event Queue Batches events and sends every 30 seconds or when queue reaches 10 events
Offline Support Queues events when offline, sends when connectivity returns
Background Flush Automatically sends queued events when app enters background
Retry Logic 3 retries with exponential backoff on network failures
Metadata Collection Auto-collects platform, OS version, app version, locale, device type

Need Help?

Questions about integration? We're here to help.