A simple ecommerce demo app that showcases every feature of the Mobore iOS SDK.
- Sign up or log in at mobore.com
- Create a new project (or select an existing one)
- Navigate to Settings > Client Tokens
- Copy your client token
Open mobore-example/mobore_exampleApp.swift and replace the placeholder token:
let agentConfig = MoboreAgentConfigBuilder()
.withClientToken("YOUR_CLIENT_TOKEN_HERE") // <-- paste your token
.withEnvironment("development")
.withSessionSampleRate(1.0)
.build()- Open
mobore-example.xcodeprojin Xcode - Wait for Swift packages to resolve (the SDK is linked as a local package from
../mobore-ios-sdk) - Select a simulator or device and press Run
Telemetry will start flowing to your Mobore dashboard immediately.
| SDK Feature | How It's Used |
|---|---|
MoboreAgentConfigBuilder |
Full agent configuration with token, environment, sample rate, and span filters |
MoboreInstrumentationConfigBuilder |
All 13 auto-instrumentations enabled with custom URL filtering |
MoboreIosSdkAgent.start() |
SDK initialization -- one call activates everything |
addGlobalAttribute() |
Sets app.demo=true on every span and log for the session |
| SDK Feature | How It's Used |
|---|---|
.reportName("ProductList") |
Names the SwiftUI screen for view tracking |
addLog() |
Logs "Product catalog loaded" with product count |
addTiming() |
Measures catalog load time in milliseconds |
addAction() |
Tracks quick_add_to_cart with product ID, name, and price |
| Auto: Tap Instrumentation | Every "Add to Cart" button tap is captured with target and action |
| SDK Feature | How It's Used |
|---|---|
startView() / endCurrentView() |
Manual view tracking with custom URL mobore-example://products/<id> |
setViewAttributes() |
Sets product.id, product.name, product.category on the view span |
setViewAttribute() |
Sets product.price on the view span |
addViewEvent() |
Records item_added event when user adds to cart |
addAction() |
Tracks add_to_cart with quantity, total, category, and source |
addTiming() |
Measures cart operation duration |
addLog() |
Logs navigation to web content |
| SDK Feature | How It's Used |
|---|---|
.reportName("Cart") |
Names the screen for view tracking |
addError() |
Reports error when user attempts checkout with empty cart |
addAction() |
Tracks remove_from_cart on swipe-to-delete |
addLog() |
Logs checkout initiation with cart total and item count |
| SDK Feature | How It's Used |
|---|---|
startView() / endCurrentView() |
Manual view tracking for the checkout flow |
setViewAttribute() |
Sets checkout.cart_total on the view span |
addLog(level: "debug") |
Debug log when checkout opens |
addLog(level: "info") |
Logs payment processing start and order completion |
addLog(level: "warn") |
Warns on payment failure |
addError() |
Reports payment error with source and stack trace (toggle "Simulate payment error") |
addAction() |
Tracks purchase_complete with order total and duration |
addTiming() |
Measures total checkout duration from open to purchase |
forceFlush() |
Immediately exports all telemetry after successful purchase |
| SDK Feature | How It's Used |
|---|---|
.reportName("Profile") |
Names the screen for view tracking |
setUser() |
Sets user identity (user.id, user.name, user.email) |
addGlobalAttribute() |
Sets app.theme attribute |
addGlobalAttributes() |
Sets locale, timezone, and screen scale in one call |
removeGlobalAttribute() |
Removes the app.theme attribute |
addAction() |
Tracks login action |
addLog() |
Logs sign-in and attribute changes |
| Auto: Network Instrumentation | "Fetch Sample Data" makes a real HTTP request to httpbin.org/json -- automatically traced |
addError() |
Reports network fetch errors |
forceFlush() |
Manual flush button for immediate export |
| SDK Feature | How It's Used |
|---|---|
startView() / endCurrentView() |
Manual view tracking for the web content sheet |
addLog() |
Logs WebView open event |
| Auto: WebView Instrumentation | WKWebView navigation to example.com is automatically traced (request, start, finish, error) |
These features require zero code and run in the background:
| Feature | What It Captures |
|---|---|
| Crash Reporting | Native crashes with symbolicated stack traces (PLCrashReporter) |
| App Hang Detection | Main thread blocks >2 seconds |
| Lifecycle Events | App state transitions: active, inactive, background, foreground, terminate |
| System Metrics | CPU usage and memory footprint gauges |
| App Metrics | MetricKit launch times, hang histograms, and exit counters |
| Low Power Mode | Power state changes |
| App Exit Handling | Flushes all telemetry on termination/background |
| Session Usage | Active screen time with 90-second inactivity threshold |
| Session Management | 30-minute session timeout with automatic rotation |
| NTP Clock Sync | Accurate timestamps via Kronos NTP |
mobore-example/
mobore_exampleApp.swift -- SDK init with full config
ContentView.swift -- Tab navigation (Shop / Cart / Profile)
Models.swift -- Product and CartItem data models
AppStore.swift -- Observable cart state
ProductListView.swift -- Product grid with quick-add
ProductDetailView.swift -- Product detail with manual view tracking
CartView.swift -- Shopping cart with error reporting
CheckoutView.swift -- Checkout flow with timing and flush
ProfileView.swift -- User identity and network demo
WebContentView.swift -- WKWebView instrumentation demo
- Xcode 15.0+
- iOS 16.0+