Guides
Analytics and funnels
The SDK records sessions, screens and the paywall and purchase funnel by itself. Your app adds its own events. Everything shows on the Analytics tab, next to the revenue it led to.
#Your own events
Horse.shared.track("export_started", ["format": "pdf", "pages": 4])
SettingsView().horseScreen("Settings") // name a SwiftUI screen
Horse.shared.screen("Editor") // or name one by hand#The rules for names
- Event names are
snake_case, up to 48 characters, and can't start with$(those names belong to the SDK). - Up to 20 properties per event: strings, numbers and booleans. Strings are cut at 200 characters.
- An app has room for 200 event names. Never put an id or a number in a name, like
export_4_stemsoruser_8f3a1c. Put it in a property instead. The server stops accepting new names past 200, and the dashboard tells you. - No personal data in properties: no emails, names or free text someone typed.
#What's recorded without any code
| Recorded | When |
|---|---|
| First open, app update, app open | At launch |
| Sessions, with their length | A session survives half an hour in the background |
| Screens | SwiftUI with .horseScreen. UIKit by itself with screenTracking: .automatic |
| Paywall shown, plan selected, closed | By designed paywalls by themselves, or by your paywall's conversion calls |
| Purchase started, succeeded, cancelled, failed; restore | Every purchase |
| Entitlement gained and lost | When access changes |
| Code redeemed | Access codes |
Every event carries the app version and build, SDK version, platform and OS version, device model, locale, country, the screen it happened on, and whether the person was entitled at the time. Any of those can split a chart.
#Delivery
Events are batched every 10 seconds and when the app goes to the background. The queue is a file of up to 1,000 events, so it survives a week offline, being backgrounded or being killed. await Horse.shared.flushEvents() sends what's waiting at once, for tests.
#Turning it off
Horse.configure(with: .init(apiKey: "pk_…", baseURL: horseURL, analytics: .off)) // nothing is recordedWith analytics off, purchases and access work exactly the same. Only the Analytics tab stays empty.
#In the dashboard
The Analytics tab shows each paywall's views, viewers, plan picks, purchase taps, closes and time on screen, plus your screens and events with how many installs sent each. The funnel there follows people from first open to purchase.
