Blue Triangle Help Center
Auto Light Dark
Auto Light Dark

Quick Start Guide for instrumenting iOS Mobile Applications

Please refer to the complete instrumentation guide for a complete reference, release notes etc.

1. Install the SDK

You can install the iOS SDK via Swift Package Manager (recommended) or CocoaPods.


Option A: Swift Package Manager

Xcode 13+

  1. Go to File > Add Packages…

  2. Enter the SDK URL:
    https://github.com/blue-triangle-tech/btt-swift-sdk.git

  3. Complete the prompt.

Xcode 11–12

  1. Go to File > Swift Packages > Add Package Dependency…

  2. Enter the same package URL.

  3. Finish installation.


Option B: CocoaPods

Add the pod:

pod 'BlueTriangleSDK-Swift'

Then install:

pod install


2. Configure Your Site ID

Add configuration to your AppDelegate:

import BlueTriangle

BlueTriangle.configure { config in
    config.siteID = "<BTT_SITE_ID>"
}


3. SwiftUI Configuration (Recommended)

Add configuration in your SwiftUI App’s initializer:

@main
struct YourApp: App {
    init() {
        BlueTriangle.configure { config in
            config.siteID = "<BTT_SITE_ID>"
        }
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

4. Track Checkout Events

Use Timer, Page, and PurchaseConfirmation:

Brand value example:

let timer = BlueTriangle.startTimer(
    page: Page(pageName: "SignUp", brandValue: 100.0)
)

BlueTriangle.endTimer(timer)

Cart + order example:

let timer = BlueTriangle.startTimer(
    page: Page(pageName: "Confirmation")
)

BlueTriangle.endTimer(
    timer,
    purchaseConfirmation: PurchaseConfirmation(
        cartValue: 99.0,
        cartCount: 2,
        cartCountCheckout: 2,
        orderNumber: "ORD-123345"
    )
)

Note: PurchaseConfirmation automatically uses the timer’s end time as the order timestamp.