Getting Started
Initially, Inapptics tracks all events in the app automatically. Call this function in your AppDelegate in order to initialize the library.
+ (void)letsGoWithAppToken:(NSString *_Nonnull)appToken
Sets up Inapptics SDK for automatically tracking all user interaction events in the app with the given app token.
appToken
Your app's token. If you don’t have one add an app here or get the App Token of an existing app from your app's settings.
Initially, Inapptics is set up to track all crashes automatically. Use this function in your AppDelegate instead of the previous method in order to control crash reporting.
+ (void)letsGoWithAppToken:(NSString *_Nonnull)appToken crashReportingEnabled:(BOOL)crashReportingEnabled
Sets up Inapptics SDK with the possibility to control crash reporting in the app with the given app token.
appToken
Your app's token. If you don’t have one add an app here or get the App Token of an existing app from your app's settings.
crashReportingEnabled
A boolean indicating if the crash reporter should be initialized or not.
Manual screen tracking
Initially, Inapptics tracks all screen views automatically. But there might be some special cases when it is unable to capture the screen change. In that case, there is a special API function that tells the SDK to capture new screen view. E.g. you might want to track a dynamically changed view as a new screen. Such cases include custom alert overlays.
In order to tell Inapptics to capture a specific screen in the current session, use the following method.
+ (void)addScreen:(NSString * _Nonnull)screenName;
Captures the specified screen and adds it to the ongoing session.
screenName
The custom screen name to be added to the screen object.
Inapptics.addScreen("MyCustomAlert")
When a custom screen view is manually added to the ongoing user session, it might be useful to let the SDK know when it is closed, in order to have a more specific session capturing. The method below tells Inapptics to close the latest manually added screen view and go back to the previous screen.
+ (void)closeScreen;
Closes latest manual screen and goes back to the previous screen in the ongoing session.
Inapptics.addScreen("MyCustomAlert")
...
Inapptics.closeScreen()
User identification
Initially, all app users are identified by their device IDs. You can identify a user by setting custom key-value pairs that are saved in Inapptics.
+ (IAXUserIdentity * _Nonnull)user;
Returns a IAXUserIdentity
instance with currently saved user properties.
NSString *id
A custom identifier of your user. It might be the user's ID in your own database.
NSString *email
The user's email address.
NSString *name
The user's full name.
NSDictionary *properties
Other custom properties for the user.
NSLog(@"%@", Inapptics.user.id);
NSLog(@"%@", Inapptics.user.email);
NSLog(@"%@", Inapptics.user.name);
NSLog(@"%@", Inapptics.user.properties[@"YOU_CUSTOM_KEY"]);
Initially, all app users are identified by their device IDs. The method below allows you to set keys that will help you identify your users. It updates the Inapptics.user
object with provided parameters. Call this function in your code wherever you are ready to identify your user.
+ (void)identifyUserWithId:(NSString *)id email:(NSString *)email name:(NSString *)name;
Tells Inapptics to associate the given identification keys to the user device.
id
A custom identifier of your user. It might be the user's ID in your own database.
email
The user's email address.
name
The user's full name.
The methods below allow you to update separate user identity fields without providing all the others. You can use this functions to update the user's id, email, and name separately.
+ (void)setUserId:(NSString *_Nonnull)id
This method updates the Inapptics.user.id
property with the given value.
id
The new user id.
+ (void)setUserEmail:(NSString *_Nonnull)email
This method updates the Inapptics.user.email
property with the given value.
email
The new user email.
+ (void)setUserName:(NSString *_Nonnull)name
This method updates the Inapptics.user.name
property with the given value.
name
The new user name.
Inapptics.setUserId("custom-id-1");
Inapptics.setUserName("John");
Inapptics.setUserEmail("joh.doe@example.com");
The method below allows you to set custom user properties that will help you identify your users. It is an Inapptics.user
object method and should be called on it.
- (void)set:(NSDictionary *)properties;
Tells Inapptics to associate the given key-values to the user device. This method updates the Inapptics.user.properties
object with the given properties.
properties
A dictionary with custom key-value pairs.
Inapptics.user.set(["firstName": "John", "lastName": "Doe"]);
The method below allows you to unset custom user properties that were previously added to the user identity. It is an Inapptics.user
object method and should be called on it.
- (void)unset:(NSArray *)keys;
Tells Inapptics to remove associated key-values from the user device. This method updates the Inapptics.user.properties
object.
keys
An array with a custom key that should be removed.
Inapptics.user.unset(["firstName", "lastName"]);