Developer DocsSDK
iOS SDK
Track user interactions within your iOS app and manage configuration via the Intempt console.
iOS SDK
The Intempt iOS SDK tracks user interactions within your iOS app and lets you manage configuration through the Intempt console. The framework automatically collects rich event data on initialization with no additional code required.
Auto-Tracked Events
| Event | Description |
|---|---|
| Touch | User taps on interactive UI controls |
| View Screen | Screen navigation and engagement |
| Leave Screen | User exits from screens |
| Action | Form submissions and link clicks |
| App Install/Upgrade | Installations with version and build details |
| Start Session | Beginning of a new user session |
| End Session | Recorded after 5 minutes of inactivity |
Requirements
- iOS 13.0+
- Xcode 11.0 or later
Installation
Swift Package Manager
- Open your
.xcodeprojin Xcode - Go to File → Add Packages
- Enter the repository URL:
https://github.com/intempt/intempt-intemptios - Select the
masterbranch
Manual Framework
- Download the SDK repository as a ZIP
- Locate
Intempt.xcframework - Drag it into your Xcode project
- In Build Phases, add it under Embed Frameworks
- In General → Frameworks, set it to Embed & Sign
Setup
Before initializing, obtain the following from the Intempt console (Integrations → Sources):
- Organization name
- Project name
- Source ID
- API Key
Initialization
Swift — SceneDelegate
import Intempt
func scene(_ scene: UIScene, willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions) {
guard let _ = (scene as? UIWindowScene) else { return }
let intemptConfig = IntemptConfig(
queueEnabled: true,
withItemsInQueue: 7,
withTimeBuffer: 15,
withInitialDelay: 0.3,
withInputTextCaptureDisabled: false
)
Intempt.initialize(<orgName>, projectName: <projectName>,
sourceId: <sourceId>, apiKey: <apiKey>,
intemptConfig: intemptConfig) { (status, result, error) in
if status, let dictResult = result as? [String: Any] {
print(dictResult)
} else if let error = error {
print(error.localizedDescription)
}
}
}Swift — ViewController
override func viewDidLoad() {
super.viewDidLoad()
let intemptConfig = IntemptConfig(
queueEnabled: true,
withItemsInQueue: 7,
withTimeBuffer: 15,
withInitialDelay: 0.3,
withInputTextCaptureDisabled: false
)
Intempt.initialize(<orgName>, projectName: <projectName>,
sourceId: <sourceId>, apiKey: <apiKey>,
intemptConfig: intemptConfig) { (status, result, error) in
if status, let dictResult = result as? [String: Any] {
print(dictResult)
}
}
}Objective-C — AppDelegate
@import Intempt;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
IntemptConfig *intemptConfig = [[IntemptConfig alloc]
initWithQueueEnabled:YES
withItemsInQueue:7
withTimeBuffer:15
withInitialDelay:0.3
withInputTextCaptureDisabled:NO
];
[Intempt initialize:<orgName>
projectName:<projectName>
sourceId:<sourceId>
apiKey:<apiKey>
intemptConfig:intemptConfig
onCompletion:^(BOOL status, id result, NSError *error) {}];
return YES;
}IntemptConfig Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
queueEnabled | BOOL | YES | Enable event batching |
itemsInQueue | Int | 5 | Events per batch before sending |
timeBuffer | TimeInterval | 5s | Interval for periodic sends |
isInputTextCaptureDisabled | BOOL | NO | Disable text input capture |
initialDelay | TimeInterval | 0.2s | Delay before first send |
Event Tracking
track()
Records a custom event with associated data.
let objData: [String: Any] = [
"flightId": 1,
"bookingDate": "2024-01-29",
"bookingId": 2,
"bookingStatus": "booked"
]
Intempt.track("flight-booking", data: objData) { (status, result, error) in
if status, let dictResult = result as? [String: Any] {
print(dictResult)
}
}record()
Tracks events with full user and account context.
let objData: [String: Any] = ["flightId": 1, "bookingDate": "2024-01-29"]
let accountAttributes: [String: Any] = ["mtuCount": "1000+"]
let userAttributes: [String: Any] = ["city": "New York", "country": "USA"]
Intempt.record("flight-booking",
userId: "xyz@intempt.com",
accountId: "intempt.com",
data: objData,
accountAttributes: accountAttributes,
userAttributes: userAttributes) { (status, result, error) in }User Identification
identify()
Associates events with a specific user.
// Basic
Intempt.identify("xyz@intempt.com") { (status, result, error) in }
// With attributes
let userAttributes: [String: Any] = ["city": "New York", "country": "USA"]
Intempt.identify("xyz@intempt.com",
eventTitle: "CustomIdentify",
userAttributes: userAttributes) { (status, result, error) in }group()
Assigns a user to an account group.
// Basic
Intempt.group("intempt.com") { (status, result, error) in }
// With attributes
let accountAttributes: [String: Any] = ["name": "John", "country": "USA"]
Intempt.group("CustomGroupIdentify",
accountId: "intempt.com",
userAttributes: accountAttributes) { (status, result, error) in }alias()
Links two user identities together.
Intempt.alias("xyz@intempt.com", anotherUserId: "abc@intempt.com")
{ (status, result, error) in }Consent Management
Accept consent
Intempt.consents(
IntemptConsentAction.Accept.rawValue,
consentsExpirationTime: "Unlimited",
email: "xyz@intempt.com",
message: "Yes, email me offers.") { (status, result, error) in }Reject consent
Intempt.consents(IntemptConsentAction.Reject.rawValue) { (status, result, error) in }Category-specific consent
Intempt.consent(
IntemptConsentAction.Accept.rawValue,
consentsExpirationTime: "Unlimited",
category: "News",
email: "xyz@intempt.com",
message: "Yes, email me offers.") { (status, result, error) in }Product Tracking
productView()
Intempt.productView(productId: "123") { (status, result, error) in }productAdd()
Intempt.productAdd(productId: "123", quantity: 1) { (status, result, error) in }productOrdered()
var productsOrdered = [[String: Any]]()
for item in CartController.shared.items {
productsOrdered.append(["productId": item.productId, "quantity": item.quantity])
}
Intempt.productOrdered(params: productsOrdered) { (status, result, error) in }Recommendations
Intempt.recommendation(
"9",
fields: ["id", "price", "title"],
quantity: 4,
productId: productId) { (status, result, error) in }Experiments & Personalization
// By name
Intempt.chooseExperiments(
byNames: ["Special_Discount"],
productId: "2369423736890") { (status, result, error) in }
// By group
Intempt.chooseExperiments(
byGroups: ["Banners"],
productId: "2369423736890") { (status, result, error) in }
// Personalization by name
Intempt.choosePersonalizations(
byNames: ["home_page_pop-up"],
productId: "2369423736890") { (status, result, error) in }
// Personalization by group
Intempt.choosePersonalizations(
byGroups: ["banner"],
productId: "2369423736890") { (status, result, error) in }Utility Methods
| Method | Returns | Description |
|---|---|---|
isUserOptIn() | Boolean | Check opt-in status |
optIn() | Void | Grant tracking consent |
optOut() | Void | Revoke tracking consent |
logout() | Void | Clear user session |
getProfileId() | String | Get current profile ID |
getSesssionId() | String | Get current session ID |
enableLogging() | Void | Activate debug logging |
disableLogging() | Void | Deactivate debug logging |
disableTextInput(true) | Void | Toggle text capture |
startTrackingSession() | Void | Start a new session |
endTrackingSession() | Void | End the current session |
validateTrackingSession() | Void | Confirm session validity |
Troubleshooting
| Issue | Solution |
|---|---|
| Framework architecture errors | Set Target → Build Settings → Validate Workspace to NO |
| App Store lipo errors | Add a Run Script phase with a lipo-cleaning script |
dyld library not loaded | Verify Intempt.xcframework is set to Embed & Sign |
| Module not found | Remove framework, clean DerivedData, re-add Intempt.xcframework |
| No data in console | Events batch periodically — allow a few seconds after triggering |
| Slow transmission | Reduce timeBuffer and itemsInQueue in IntemptConfig |
| Field type errors | Match schema types exactly; new fields are fine, but existing field types cannot change |
