Repository convertmax-ios
Package Convertmax
Version 0.2.0
Platform iOS 15+
Install Add the repository in Xcode or as a Swift Package dependency, then import Convertmax

Initialize

The client is an actor. Grant consent before tracking:

let sdk = Convertmax(configuration: .init(
    writeKey: "YOUR_WRITE_KEY",
    appID: "com.example.app"
))
await sdk.setConsent(.granted)
await sdk.identify("account-123")
_ = await sdk.track("signup", properties: ["plan": "pro"])
_ = await sdk.screen("Pricing")

ConvertmaxConfiguration also accepts:

Option Default
environment production
endpoint https://event.convertmax.io/v1/batch
sessionTimeout 30 minutes
flushInterval 30 seconds

Events

Method What it records
identify(_:) Sets the user ID and queues an identify event
track(_:properties:) Custom event. Property values are strings
screen(_:properties:) Screen view
revenue(transactionReference:amount:currency:) purchase_observed with the transaction reference
handleDeepLink(_:) Reads utm_source, utm_medium, utm_campaign, utm_term, utm_content, and referrer
reset() Clears the user ID and rotates the anonymous ID and session ID

identify, track, and screen return nil until consent is .granted.

Delivery

Events stay in SQLite until they are sent as a gzip mobile-v1 batch. flush() delivers the queue. The SDK also flushes when the app backgrounds. clearQueue() discards pending events and does not change identity or consent.

diagnostics() reports how many events are queued and how many were dropped.