Skip to main content

Client SDKs

The Arsel client SDKs run inside your website, Android app, or iOS app, and handle:

  • Events and identity. Record what a person does (product.viewed, cart.updated) and who they are. The SDK handles queueing, retries, and sessions.
  • Push notifications. Register the device so Arsel can deliver notifications to it, and report back what happened to each one.

The two are independent. Events and identity work on a device with no notification permission or push token, so a visitor who declines notifications still has a contact and an event history.

Available SDKs​

PlatformPackageRequirements
Web@arsel.sa/web-sdk — ESM + UMD, no dependenciesChrome/Edge 79+, Firefox 72+, Safari 16.4+
Androidsa.arsel:core + sa.arsel:push-fcmminSdk 23, Firebase Messaging (push only)
iOSSwift Package, zero dependenciesiOS 15+, Swift 5.10
Stable since 1.0

All three SDKs follow Semantic Versioning. The public API and wire contract are frozen within a major version: additive changes ship as minor releases, and breaking changes wait for the next major.

Events the SDKs record for you​

Every SDK also records its own events. They use the arsel. prefix, which track() rejects, so your event names cannot collide with them. You can segment on them and use them as automation triggers like any other event.

EventWhenProperties
arsel.app_installedthe first time the SDK ever runs — after an app install, or on a browser's first visitapp_version (mobile), sdk_version, platform
arsel.session_startthe app is opened or the page becomes visible, when the last session is more than 30 minutes old—
arsel.session_endthe session that just closed, backdated to when the app or tab actually went awayduration_seconds
arsel.identifyyou called identify() with at least one identifier—
arsel.screen_viewyou called screen()screen_name, plus anything you passed

You do not define these. They appear in your event list the first time a device sends one.

Screen views​

Screen views are not recorded automatically. Call screen() when a screen or route becomes visible:

PlatformCall
WebArsel.screen('checkout', { step: 2 })
AndroidArsel.screen("checkout", mapOf("step" to 2))
iOSArsel.screen("checkout", properties: ["step": 2])

It records one arsel.screen_view event with the name in screen_name. That event is what screen-triggered in-app messages and screen-based segments use. Don't send track('checkout') for the same view: Arsel treats a screen view and a custom event as different trigger types. On the web, a single-page app should call screen() on each route change.

Sessions end late, or not at all

A session ends after 30 minutes away, but arsel.session_end is emitted on the next open, backdated to when the app or tab left. If someone never comes back, the session stays open with no end event. Build reporting on session_start, and treat session_end as a best-effort duration.

Install counts are not comparable across platforms

On mobile, arsel.app_installed means a real app install, and it fires again after an uninstall and reinstall. On the web there is no install to observe, so it means "the first time we saw this browser", and clearing site data or opening a private window produces another one. Web install counts run high.

Devices and browsers that were already running an older SDK do not produce an install event when they update. Upgrading an SDK does not report your existing audience as new installs, so install-based segments start empty and fill from the upgrade forward.

Source code​

Every SDK is open source under the MIT licence. Each repository is the reference for its platform, versioned with the code you install.

PlatformRepository
WebArsel-SA/arsel-web-sdk
AndroidArsel-SA/arsel-android-sdk
iOSArsel-SA/arsel-ios-sdk

Raise issues and questions on the SDK's repository.

Authenticating an SDK​

Client SDKs authenticate with a client key, not an API key:

pub_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

A client key is publishable: you can compile it into your app bundle or serve it in your page's JavaScript. It can record events and register devices for your organization, and nothing else. It cannot read contacts, send campaigns, or manage your account.

Never ship your be_ API key in client code. See Authentication.

On the web, a client key is also limited by an origin allowlist: requests from domains you have not registered are rejected. Native apps send no Origin header and are not subject to it.

Find your client key in the Arsel Dashboard under Push > Setup, and see Setting Up Push for the rest of the configuration.

Binding a device to a known contact​

Binding a registered device to a contact tells Arsel whose device it is, so campaigns can target it.

The SDKs do this for you. Every registration carries the SDK's anonymous ID, so a device that registers before sign-in resolves to the same contact as its events. When your app calls identify(), that contact merges forward.

To assert the binding from your server instead, read the installation ID from the SDK and call Register Device with your be_ API key. A server-asserted binding overrides the anonymous one.

Server-side alternatives​

Everything the SDKs do has a server-side endpoint. Use these when you are migrating existing device tokens or your app cannot embed an SDK:

TaskServer endpoint
Record an eventSend Event
Register a deviceRegister Device
Revoke a deviceUnregister Device
Inspect a contact's devicesList Contact Devices
Send to one contactSend Push
Delivery and engagement metrics need the SDK

Delivered, opened, and clicked counts are reported by the SDK on the device. A device registered server-side without an embedded SDK still receives notifications, but its delivery and engagement metrics read zero.