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+
Go to File > Add Packages…
Enter the SDK URL:
https://github.com/blue-triangle-tech/btt-swift-sdk.gitComplete the prompt.
Xcode 11–12
Go to File > Swift Packages > Add Package Dependency…
Enter the same package URL.
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.
Comments
0 comments
Please sign in to leave a comment.