UXRate Logo
v0.1.0GitHub

Integration Guide

UXRate runs AI-powered interviews inside your app — not in a browser, not in an email, not after the moment has passed. The SDK watches for trigger rules you configure in the dashboard (screen visits, events, time, user attributes) and automatically surfaces an interview overlay at the right moment. Without it, there's no way to reach users at the moment that matters.

Framework:
Affects all code blocks below

Prerequisites

Requirements

iOS 17.0+Xcode 16+Swift 6.0+

Step 1

Install the SDK

Choose your preferred package manager.

In Xcode: File → Add Package Dependencies → paste:

url
https://github.com/SVUG-Tech/UXRateSDK.git

Select version 0.1.0 or later. Or add to your Package.swift:

swift
dependencies: [
    .package(
        url: "https://github.com/SVUG-Tech/UXRateSDK.git",
        from: "0.1.0"
    )
]

Step 2

Initialize the SDK

Add one line to your app entry point.

swift
import SwiftUI
import UXRateSDK

@main
struct MyApp: App {
    init() {
        UXRate.configure(apiKey: "YOUR_API_KEY")
    }

    var body: some Scene {
        WindowGroup { ContentView() }
    }
}
⚠️Important: Replace YOUR_API_KEY with the key from your UXRate dashboard.
💡Testing tip: Pass useMockService: true to see the full interview overlay without a live API key or trigger rules: UXRate.configure(apiKey: "demo", useMockService: true)

Step 3

Identify users

Tell the SDK who the current user is. Call this after sign-in so the SDK can associate interviews with a participant.

swift
UXRate.identify(
    userId: "user-123",
    properties: [
        "plan": "pro",
        "signup_date": "2025-01-15"
    ]
)
ℹ️Note: The userId is stored as the participant identifier on every interview this user completes — you'll see it in the dashboard responses. The properties dictionary is recorded alongside the session and will be used to power targeting rules once that feature launches.

Step 4

Coming soon

Set up trigger rules

Interviews fire automatically when the SDK detects a matching rule you've configured in the dashboard.

page_visitShow when a user visits a screen matching a name pattern (powered by Step 6 tracking)
eventShow after a specific event fires N times (powered by Step 5 tracking)
time_basedShow after N days since app install
user_segmentShow to users with a specific identify() property value
⚠️Coming soon: Trigger rule evaluation is not yet active. Instrument your app with Steps 5 and 6 now — interviews will fire automatically once this ships. To test today, start an interview manually from the dashboard Studies page.

Step 5

Track events

Call track() at key moments. Events feed into event-type trigger rules.

swift
UXRate.track(event: "purchase_complete")
UXRate.track(event: "onboarding_skipped")
UXRate.track(event: "cart_abandoned")
ℹ️Note: track() is implemented and can be called today. Trigger rules that respond to these events will activate once trigger rule evaluation ships (Step 4).

Step 6

Track screens

Tag screens so the SDK can match page_visit trigger rules.

swift
struct CheckoutView: View {
    var body: some View {
        VStack { /* your checkout UI */ }
            .surveyScreen("Checkout")
    }
}
ℹ️Note: SwiftUI cannot auto-detect screen names. Add .surveyScreen("Name") to the content view inside each NavigationStack.

Step 7

Verify your integration

Use mock mode (Step 2 tip) or start a test interview from the dashboard Studies page.

🎉

You're ready to go

Your SDK is connected. Create a study in the dashboard, then configure trigger rules to start reaching users automatically — or start a test interview manually from the Studies page.


Reference

API Overview

Method names shown in Swift (iOS). Flutter and React Native use the same names — see the steps above for platform-specific syntax.

MethodDescription
configure(apiKey:)Initialize the SDK. Pass useMockService: true during development to test the overlay without a live API key
identify(userId:properties:)Set the current user's ID and attributes. userId is stored on every interview response; properties power user_segment trigger rules
track(event:)Track a behavioral event. Feeds event-type trigger rules — implemented today, fires automatically once trigger rule evaluation ships
setScreen(_:) / .surveyScreen()Set the current screen name. Feeds page_visit trigger rules — implemented today, fires automatically once trigger rule evaluation ships