identify, track, page and screen events from your app, keeps them on disk until they are delivered, and, with its optional push module, registers the iPhone for mobile push.
It needs iOS 15 or later.
Installation
The package has three products. Add the ones you need to your app:The iOS SDK is not in a public package registry yet. Contact us at support@tranthor.com for access to the Swift package.
Usage
Methods
anonymousId, userId and isOptedOut read the current state.
Every event method also takes optional userId, anonymousId, messageId, timestamp and context arguments. Numbers are sent as doubles, so send identifiers larger than 2^53 as strings.
Identity
Beforeidentify, events carry an anonymous id that the SDK creates and stores on the phone. After identify, events carry the user id.
- The
identifycall sends both the user id and the anonymous id, which lets Tranthor attach the customer’s earlier anonymous activity to them. - If a different customer identifies on the same phone, the SDK first replaces the anonymous id with a new one. The second customer never inherits the first customer’s anonymous activity.
- An empty
userIdis treated as no user id. reset()clears the user id and starts a new anonymous id.
Consent
optOut() discards everything queued and ignores later calls until optIn(). While opted out, flush() returns without sending anything. If the phone is registered for push, opting out also tells Tranthor to stop sending push to it.
Configuration
Configuration takes these options:
Delivery
- Events are sent in batches. Network errors and HTTP 408, 425, 429 and 5xx responses are retried, and a
Retry-Afterheader is honoured up to 30 seconds. Other statuses, such as an invalid write key (401), are dropped after one attempt and reported throughonError. - Queued events are stored on the phone and sent after a restart. The files are kept out of backups.
- The SDK sends what is queued when the app goes to the background and resumes when it returns.
- With the default settings a batch is dropped after about 15 seconds of failed attempts. An app that stays offline longer than that can lose events.
Push
To send push to the app, addTranthorPush and follow Set up iOS. The push module uses the same instance, write key and queue, so identify, reset, optOut and optIn keep the phone’s registration in step with no extra calls. A phone is registered only while a customer is signed in: identify registers it and reset() removes it (Who a phone belongs to).

