Unagi/Docs

Documentation /

Mobile apps

Track what shoppers do in your iOS or Android app, chat to them, and follow up, joined to the same customer as on your website.

SDKStatus
iOS (Swift package)Built and unit tested; also run end to end against a real server
Android (Kotlin library)Written, not yet compiled or run. Build and test it in Android Studio first
React Native, Flutter, UnityNot built yet. They wrap the native SDKs

How it works

It follows the same model as Firebase Analytics, Segment and Mixpanel:

  1. Configure once with your site key and Unagi address.
  2. Nothing is collected until consent. Call setConsent(true) only after the person agrees. Withdrawing consent deletes the install's ID and anything not yet sent. There is no advertising identifier and no fingerprinting, so no tracking prompt from Apple is needed for Unagi itself.
  3. Each install gets a random ID stored in the app, removed when the app is deleted, and a session that ends after 30 minutes idle.
  4. Log screens and events. Pass the product's web address so app activity joins the same product catalogue as your website, and the same patterns, chat and customer map apply.
  5. Batched and offline-safe. Events are kept on the device, sent in batches, and retried until the server accepts them.
  6. Once per session it records the platform, app version, device type, OS, language, time zone and screen size.

iOS

Add the package (Xcode → File → Add Package Dependencies, or copy sdk/ios), then:

import UnagiSDK

// once, at launch
Unagi.shared.configure(siteKey: "YOUR_SITE_KEY", host: URL(string: "https://youok.uk")!)

// when the person agrees to analytics
Unagi.shared.setConsent(true)

// screens and events
Unagi.shared.logScreen("Product", product: UnagiProduct(path: "/products/blue-mug", name: "Blue mug", price: 12, currency: "GBP"))
Unagi.shared.addToCart(UnagiProduct(path: "/products/blue-mug"))
Unagi.shared.beginCheckout()
Unagi.shared.purchase(value: 12, currency: "GBP")

Android

Unagi.configure(application, siteKey = "YOUR_SITE_KEY", host = "https://youok.uk")
Unagi.setConsent(true)
Unagi.logScreen("Product", Product(path = "/products/blue-mug", name = "Blue mug", price = 12.0, currency = "GBP"))
Unagi.purchase(12.0, "GBP")

Chat in your app

Ask whether to open the chat, for example when the shopper has compared two products, and show it:

if let nudge = try await Unagi.shared.requestNudge(trigger: "comparison", path: "/products/blue-mug") {
    // present UnagiChatView(conversationId: nudge.conversationId, opening: nudge.text)
}

The server decides, using the journey it has stored, so the same rules apply as on the web: only for people who consented, never at checkout, off-topic requests turned away, the AI budget you set, and a person can take over from your dashboard. The iOS package includes a SwiftUI chat screen; on Android you draw the screen and call sendChat.

Joining an app user to their email

Show the wording from fetchConfig().consentText next to an unticked box. Only if they tick it, call identify(email:consentGiven: true). Everything that install has done is then joined to that email, and so is the same email on your website or another device.

Push notifications

Use Firebase Cloud Messaging (it delivers to iPhones through Apple's service). After the person allows notifications, pass the FCM token with registerPushToken. On the server set UNAGI_PUSH_PROVIDER=fcm and UNAGI_FCM_SERVICE_ACCOUNT to your Firebase service account. In the dashboard (Leads & email), you can switch on a basket reminder for app users and send a notification to everyone who allowed them. Reminders go once per abandoned basket, never to someone who has bought, and at most one push a day per install.

What is not covered yet