- Requirements
- Getting Started
- Integration
- Get Organization ID and Source ID
- Events Tracking
- Get VisitorId From Framework
- Identifying Visitors
- Custom Event
- Disable TextCapture
- Disable Default Event Tracking
- Enable Default Event Tracking
- Enable Event Logging
- Disable Event Logging
- Reset Tracking Session
- End Tracking Session
- Start Tracking Session
- iOS14&Later and ATTTransportSecurity
- Privacy Location
- Troubleshooting
- iOS 12.0+
- Minimum Xcode 10.0
- At first download Intempt framework from https://github.com/intempt/ios-sdk.git). Then open the folder framework.
- Copy
Intempt.xcframework
into your project directory and then Drag & DropIntempt.xcframework
in your iOS app.
Intempt.xcframework
must set toEmbed & Sign
, Select your projectTraget -> Build Phase
expandEmbed Framework
and press+
addIntempt.xcframework
make sure in Target ->General->Framework, Libraries and Embded Contents
Embed & Sign
is selected.
If you have followed the above 3 steps then you will be able to compile without any error on device or simulator.
If Xcode 11.3 or above
Goto AppDelegate.swift file
import Intempt
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
///Your code here
//Initialize Intempt SDK
let intemptConfig = IntemptConfig(queueEnabled: true, withItemsInQueue: 7, withTimeBuffer: 15, withInitialDelay: 0.3, withInputTextCaptureDisabled: false)
IntemptTracker.tracking(withOrgId: "Your Organization Id", withSourceId: "Your Source ID", withToken: "Your Token", withConfig: intemptConfig) { (status, result, error) in
if(status) {
if let dictResult = result as? [String: Any] {
print(dictResult)
}
}
else {
if let error = error {
print(error.localizedDescription)
}
}
}
return true
}
Else you will have the ViewController.swift
file and then paste the copied source snippet into the viewDidLoad
function:
import Intempt
override func viewDidLoad() {
super.viewDidLoad()
//Initialize Intempt SDK
let intemptConfig = IntemptConfig(queueEnabled: true, withItemsInQueue: 7, withTimeBuffer: 15, withInitialDelay: 0.3, withInputTextCaptureDisabled: false)
IntemptTracker.tracking(withOrgId: "Your Organization Id", withSourceId: "Your Source ID", withToken: "Your Token", withConfig: intemptConfig) { (status, result, error) in
if(status) {
if let dictResult = result as? [String: Any] {
print(dictResult)
}
}
else {
if let error = error {
print(error.localizedDescription)
}
}
}
}
If you are using Xcode 11.3 or above go to AppDelegate.m
file and paste the copied source snippet like the following:
@import Intempt;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Your code here
//initalize intempt SDK
IntemptConfig *intemptConfig = [[IntemptConfig alloc]initWithQueueEnabled:YES withItemsInQueue:7 withTimeBuffer:15 withInitialDelay:0.3 withInputTextCaptureDisabled:NO];
[IntemptTracker trackingWithOrgId:@"Your Organization Id" withSourceId:@"Your Source ID" withToken:@"Your Token" withConfig:intemptConfig onCompletion:^(BOOL status, id result, NSError *error) {
}];
return YES;
}
Else you will have the ViewController.m
file and then paste the copied source snippet like the following:
@import Intempt
- (void)viewDidLoad {
[super viewDidLoad];
//initalize intempt SDK
IntemptConfig *intemptConfig = [[IntemptConfig alloc]initWithQueueEnabled:YES withItemsInQueue:7 withTimeBuffer:15 withInitialDelay:0.3 withInputTextCaptureDisabled:NO];
[IntemptTracker trackingWithOrgId:@"Your Organization Id" withSourceId:@"Your Source ID" withToken:@"Your Token" withConfig:intemptConfig onCompletion:^(BOOL status, id result, NSError *error) {
}];
}
To get your organization Id and source Id you need to create your account on https://app.intempt.com/ and then go to https://app.intempt.com/sources/
- 1 Create Organization
- 2 Create Source
- 3 Copy Source ID, Organization Id and Token in your Xcode app for IntemptSDK initialization.
IntemptSDK track different type events, some of these are default and some are custom, default events are automatically started tracking when SDK is initialized and for custom events developer have to write code whereever required. Below types events are in IntemptSDK
- Application Launch Tracking (Default, automatically tracked)
- Screen Tracking (Default, automatically tracked)
- Interaction Tracking (Default, automatically tracked)
- Consent (Default, automatically tracked)
- Location (Depending on application, if user of the app has allowed location permission then country, city level location is tracked)
- Identity (Manual, Developer have to implement it)
- Custom (Developer have to create schema and implement in app)
let visitorId = IntemptClient.shared()?.getVisitorId()
Provide email or phone number.
IntemptTracker.identify("[email protected]", withProperties: nil) { (status, error) in
if(status) {
//Do something
}
}
On using this a user can create a custom event based on the need of the project and can track the event details with that custom method. To add custom event below should be flow
- 1 Visit the Intempt Console https://app.intempt.com/sources/
- 2 Select Organization -> Source -> Schema
- 3 Drag 'Add collection' from the right panel(Schema Builder) to the exisiting collections list
- 5 Drag the 'Add field' to the added collection, add as many fields as required.
- 6 Set field type carefully e.g if the data from app is string and field type set in int then there will be error.
- 7 If you want to link the events with the visitor session then add 'sessionId' as foreign key of 'Session' collection into that collection
Every custom event schema must have timestamp of type long
and eventId of type string
fields, otherwise your custom event will not be saved and you will get bad request error.
Please becarefull when renaming, Collection and Field name always start with small letter
let arrayData = [{
"flightId" : "1",
"bookingDate" : "2020-05-26",
"bookingId": "2",
"bookingStatus" : "booked"
}]
IntemptTracker.track("flight-booking", withProperties: arrayData as? [Any]) { (status, result, error) in
if(status) {
if let dictResult = result as? [String: Any] {
print(dictResult)
}
}
else {
if let error = error {
print(error.localizedDescription)
}
}
}
}
Schema of above example 'flight-booking' looks like below screenshot
Call this method if you want to disable capturing input texts like UItextField, UItextView. By default its false
. Secure entries are also excluded for privacy.
IntemptTracker.disableTextInput(true)
Call this method if you want to disable default tracking. This action is persistent, once disabled then developer must need to enable again when want to track default events again.
IntemptClient.disableTracking()
Call this method if you had disabled tracking and want to enable again.
IntemptClient.enableTracking()
Call this method if you want to see the logs of all generated events, errors for debug purposes. By default logging is disabled
IntemptClient.enableLogging()
Call this method if you want not see any output in console.
IntemptClient.disableLogging()
Call this method in order to reset tracking session. It will end previous session and start new session.
IntemptClient.shared().validateTrackingSession()
Call this method in order to end tracking session.
IntemptClient.shared().endTrackingSession()
Call this method in order to start a new tracking session.
IntemptClient.shared().startTrackingSession()
Intempt itself does not get IDFA and doesn't track user by default. Data is not forwarded to any external services, and is not linked with any third-party data. Also events captured are not linked to user indentity and not used for user tracking purpose. Analytic are captured to observe the user behavior, viuslations of app usage and improving user experience based on user activities in the app. So with the default configuration there is no need for adding Apple Tracking Transparency permission in info.plist and asking user consent. Also don't include Apple Tracking Transparency framework in your app. However if your app has other external integrations or you have implemented custom events which track user or share user data with other then you have to include it.
IntemptSDK itself doesn't ask user for the location permission and doesn't fetch user location. However IntemptSDK has refence to CoreLocations framework and if the app(where IntemptSDK integrated) already have obtained user consent for Location then IntemptSDK track user location of city, region, country level. As the IntemptSDK has reference to CoreLocations framework so it is required to add Privacy - Location
in info.plist with explaining the purpose of location fetch and usage.
Go to app's Info.plist file and add the privacy keys.
Key | Value |
---|---|
Privacy - Location Always Usage Description | Location used to track where you are and showing most relevant content to you. |
Privacy - Location When In Use Usage Description | Location used to track where you are and showing most relevant content to you |
Privacy - Location Always and When In Use Usage Description | Location used to track where you are and showing most relevant content to you |
Building for iOS, but the linked and embedded framework 'Intempt.xcframework' was built for iOS + iOS Simulator.
Select your project Target -> Build Settings
and search Validate Workspace
Set Value to NO, if its already NO, then set to YES once and then set again to NO. This is workaround as sometimes xcode doesn't understand, so toggeling the value between YES/NO it worked.
Intempt.xcframework
is universal
and it supports Simulators and Devices both, when submitting to app store Apple may show error of simulator architectures. To resolve this issue please select your project Target -> Build Phase
and select +
sign and add New Run Script Phase
. It will add an empty runscript below, expand it and put the below script as shown in below screen shot.
# skip if we run in debug
if [ "$CONFIGURATION" == "Debug" ]; then
echo "Skip frameworks cleaning in debug version"
exit 0
fi
APP_PATH="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done
Intempt.xcframework
must set to Embed & Sign
Sometimes xcode behaves strange and not link properly, so first delete Intempt.xcframework
from your project, clean build
and delete Drived Data
then again follow belwo steps to add framework
Open folder containg Intempt.xcframework
and first copy Intempt.xcframework
into your project directory and then Drag & Drop Intempt.xcframework
in your iOS app.
Intempt.xcframework
must set to Embed & Sign
, Select your project Traget -> Build Phase
expand Embed Framework
and press +
add Intempt.xcframework
make sure in Target ->General->Framework, Libraries and Embded Contents
Embed & Sign
is selected.
For performance and efficiency purpose IntemptSDK send events as batch periodically, it may take few seconds to appear your events on console.
if you see your events are captured and shown in log in debug mode but sent too late on intempt server, then in such case you need to check two below things in your intemptSDK initalization.
- `TimeBuffer' its value is in seconds, if sdk send data to server periodically based on value of this parameter
ItemsInQueue
its value is number of events, if you set value to 10, IntemptSDK will wait untill 10 or more events are captured then it sends