Skip to main content

iOS

Setup

Jitsu supports Segment Analytics-Swift library to receive events from iOS, tvOS, iPadOS, WatchOS, macOS and Linux applications.

Please follow the Installation instruction to install the library.

tip

In all examples below, replace your-jitsu-domain.com with your Jitsu installation domain.

Jitsu Cloud users may find domain in the top-right corner of Site's Setup Instruction page or attach custom domain for a specific Site and use it instead.

Setting up the client

Jitsu requires additional settings to direct events to a correct Jitsu instance.

 var analytics: Analytics? = nil

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let configuration = Configuration(
writeKey: "BROWSER_WRITE_KEY",
apiHost: "your-jitsu-domain.com",
cdnHost: "your-jitsu-domain.com")
.trackApplicationLifecycleEvents(true)
.flushInterval(10)

analytics = Analytics(configuration: configuration)
}

where:

Description
apiHostJitsu server URL. E.g.: your-jitsu-domain.com
cdnHostCDN host for settings retrieval. Jitsu server URL. E.g.: your-jitsu-domain.com
writeKeyBrowser Write Key configured on Jitsu Site entity. If no Browser Write Key is added for Site entity, Site ID value can be used a Write Key. On Jitsu.Cloud can be omitted if Site has explicitly mapped domain name.

Event tracking

Please refer to the Analytics-Swift for iOS & Apple documentation for more details on how to track events with Jitsu.