Guides
Remote config and experiments
Remote config holds values your app reads at runtime, set on the Remote config tab, with rules by app version, country, subscription state or a share of people. Experiments split people into variants and compare what each variant earned.
#Read a value
let config = Horse.shared.remoteConfig // the cached values, from any thread
config.string("onboarding_style", default: "classic")
config.bool("show_rating_prompt", default: false)
config.int("free_exports", default: 3)
let limits = config.decode("limits", as: Limits.self) // a JSON value, decoded
await Horse.shared.fetchRemoteConfig() // refetch now (the SDK does every 5 minutes)Always pass a default. On a first launch with no network there's nothing cached yet, and the app should still work.
To react when new values arrive, observe Horse.remoteConfigDidChangeNotification or the @Published remoteConfigValues property.
#Rules
A key has a default value and any number of rules, checked from the top: the first rule that matches a person decides their value. A rule can match on:
- App version or build number range, to switch something on only in builds that have it.
- Countries, from the App Store storefront.
- Platforms: iOS, macOS, tvOS and so on.
- Entitlements: people who have
pro, or who don't. - Subscription state: subscribers only (any active entitlement), or non-subscribers only.
- Percentage of users. Each person stays on the same side for as long as the rule exists.
- Only these app user ids, for your own test devices.
Preview — what would this user get? on the tab shows the values a given customer receives. Saved changes reach apps within a few minutes.

#Keys worth having
We suggest adding keys like these before your first release, so you can change these things later without a release. The names are up to you:
| Key | Type | What it switches |
|---|---|---|
onboarding_enabled | bool | Whether new installs see onboarding |
onboarding_paywall_enabled | bool | Whether onboarding ends on the paywall |
free_limit | int | How much a free user can do before the paywall |
paywall_close_delay | int | Seconds before the paywall's close button appears |
#Experiments
An experiment splits people into variants (a, b…) and compares their trials, conversions and revenue on the Experiments tab. A variant can change remote config values, the offering a placement sells, or both. So a price test needs no code: read the placement's offering and it follows.
if config.isIn("paywall_test", variant: "b") { … }
config.variant("paywall_test") // "a", "b", or nil when this person isn't in itEach person keeps the variant they first got. The results say which side won, on the number that matters for that kind of test, and how sure that is. Stopping an experiment with a winner rolls the winner out to everyone.

#Putting yourself in a variant
To check a variant on your own device, join it from a debug menu or a deep link:
await Horse.shared.joinExperiment("paywall_test", variant: "b")A person who joined on purpose is left out of the results, since they chose their side.