SDKs
SDKs overview
Which Kerdly SDK to use, which key goes where, and the events every SDK reports.
The Kerdly SDKs measure installs, visits, users, events and purchases, and send them to your project. Kerdly uses them to match each install or sign-up to the ad click that brought it, then to the revenue the stores report. They are open source under the MIT license: github.com/Kerdly/kerdly-sdk.
| Platform | Package | Install | Guide |
|---|---|---|---|
| Web | @kerdly/web, kerdly.js | npm install @kerdly/web or one <script> tag | Web SDK |
| Expo / React Native | @kerdly/expo | npx expo install @kerdly/expo | Expo SDK |
| iOS | KerdlySDK | Swift Package Manager: https://github.com/Kerdly/kerdly-sdk, from 0.1.0 | iOS SDK |
| Android | com.kerdly:kerdly-sdk | implementation("com.kerdly:kerdly-sdk:0.1.0") | Android SDK |
Keys
Every request carries a key. Three kinds exist, and only one of them is secret.
| Key | Prefix | Belongs to | Goes into | Where to get it |
|---|---|---|---|---|
| App key | pk_live_…, pk_test_… | One app (one platform) | Your app binary. Public. | Made with the app: its Settings → SDK, with the code to paste |
| Web key | wk_live_… | The project | Your web pages. Public. | Made with the website: its Settings → SDK, in the snippet to paste |
| Server key | sk_live_… | One app | Your servers only. Secret, shown once. | The app's Settings → SDK → Server keys and key rotation |
- An Expo app that ships to both stores is two Kerdly apps with two app keys, one for iOS and one for Android. The SDK sends the bundle id or package name with each request, and Kerdly refuses a key used by the wrong app.
- Use a
pk_test_…key for test builds, so they are kept apart from production data. - Never put an
sk_key in an app or a page. The SDKs refuse one. - Rotating a key: create the new one, ship it, then revoke the old one with a delay. Revoking an app key defaults to 30 days, so builds already in users' hands keep working.
Endpoint
Every SDK sends to https://app.kerdly.com/api unless you set another endpoint. Paths such as
/v1/sdk/batch and /v1/web/touch are appended to it.
Events
The app SDKs record installs, opens and deep links on their own. On top of that your app sends:
| Event | When | Typed fields |
|---|---|---|
registration | The user signs up | method (anonymous, apple, google, email, …) |
start_trial | A trial starts | productId, value (0 for a free trial), currency, transactionId |
subscribe | A paid subscription starts | productId, value, currency, transactionId |
purchase | A one-time purchase | productId, value, currency, quantity, transactionId |
| Custom | Anything else | Up to 25 flat props |
Custom event names and prop keys match ^[a-z][a-z0-9_]{0,39}$. Prop values are strings (cut to
256 characters), finite numbers or booleans. value is what the user paid in currency, a
three-letter ISO 4217 code; a value without a valid currency is dropped, because it means nothing
to an ad network.
Renewals and refunds don't come from the SDK: Kerdly reads them from the stores. On the web, the SDK records visits and clicks, and your server reports trials, purchases, renewals and refunds with the server events API.
For which step comes from where (the SDK, your server or the stores), see Track the whole funnel. For how to set it up for the way you sell, see the guides, starting with Client events, server events and deduplication.
Errors never crash your app
No SDK function throws and no promise rejects. Invalid input is dropped with a development warning
that starts with [Kerdly].