Kerdly

SDKs

SDKs overview

Which Kerdly SDK to use, which key goes where, and the events every SDK reports.

View as Markdown

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.

PlatformPackageInstallGuide
Web@kerdly/web, kerdly.jsnpm install @kerdly/web or one <script> tagWeb SDK
Expo / React Native@kerdly/exponpx expo install @kerdly/expoExpo SDK
iOSKerdlySDKSwift Package Manager: https://github.com/Kerdly/kerdly-sdk, from 0.1.0iOS SDK
Androidcom.kerdly:kerdly-sdkimplementation("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.

KeyPrefixBelongs toGoes intoWhere to get it
App keypk_live_…, pk_test_…One app (one platform)Your app binary. Public.Made with the app: its Settings → SDK, with the code to paste
Web keywk_live_…The projectYour web pages. Public.Made with the website: its Settings → SDK, in the snippet to paste
Server keysk_live_…One appYour 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:

EventWhenTyped fields
registrationThe user signs upmethod (anonymous, apple, google, email, …)
start_trialA trial startsproductId, value (0 for a free trial), currency, transactionId
subscribeA paid subscription startsproductId, value, currency, transactionId
purchaseA one-time purchaseproductId, value, currency, quantity, transactionId
CustomAnything elseUp 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].