User Profiling
You can ask your users about their privacy preferences. Once the user has signed up, you will have the user id.
Track sign-up
- Call the below method to track a user when they first sign-up for your app.
Copied+ (void) trackSignUp:(NSString* _Nullable)userID;
Track sign-in
- Call the below method to track a user when they login to your app.
Copied+ (void) trackLogIn:(NSString* _Nullable)userID;
Existing users
- Call the below method to track any existing users of your app.
Copied+ (void) setCurrentUser:(NSString * _Nullable)userID;
On sign-out
- Call the below method during user sign-out to let the framework know.
Copied(void) trackLogOut:(NSString* _Nullable)userID;
Privacy consent
AppTracking Permission on iOS 14
With iOS 14.5, iPadOS 14.5, tvOS 14.5 and later, you need to ask the user’s permission (explicitly) via the AppTrackingTransparency framework to track that user.
Most applications choose to present a gentle explainer screen before asking for permission to track users. The explainer screen give the users more context on the usage tracking and how the user id is associated with the usage data.
When the user continues to the explainer screen, you should call the ATTrackingManager.requestTrackingAuthorization to show the alert.
Important:
- Add "Privacy - Tracking Usage Description" key in the Info.plist file.
- Add "AppTrackingTransparency.framework" into your app's Target.
- Import AppTrackingTransparency.
Implementation
Copied[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
// Check for status after request
switch (status) {
case ATTrackingManagerAuthorizationStatusAuthorized:
// The user authorizes access to app-related data that can be used for tracking the user or the device.
// Set personal info tracking status true when the user accepts.
[Apptics setPersonalInfoTrackingStatus:true];
break;
case default:
// Set personal info tracking status false when the user rejected.
[Apptics setPersonalInfoTrackingStatus:false];
break;
}
}];
Copiedif NSClassFromString("ATTrackingManager") == nil {
ATTrackingManager.requestTrackingAuthorization { status in
// Check for status after request
switch status {
case .authorized:
// The user authorizes access to app-related data that can be used for tracking the user or the device.
// Set personal info tracking status true when the user accepts.
Apptics.setPersonalInfoTrackingStatus(true)
case _:
// Set personal info tracking status false when the user rejected.
Apptics.setPersonalInfoTrackingStatus(false)
}
}
}
Apptics Privacy Consent for iOS 13 and below
- Call this method if you want to present the user consent.
Copied+ (void) showPrivacyConsent;
In-built privacy settings
- Call the below method to open the Analytics settings view controller. The navigation controller parameter is optional.
Copied+ (void) openAnalyticSettingsController;
- You can customize the UI by implementing methods of our theme manager class i.e., APTheme, APSettingsTheme, and APUserConsentTheme, and setting it back to Apptics.
- You can provide the user Settings on your own by adding three buttons to your Settings screen. Check for APPrivacyStatus by calling getPrivacyStatus if it is equal to APPrivacyStatusUnKnown then ask/show user consent and set back the status to Apptics using setTrackingStatus:, setCrashReportStatus:, and setPersonalInfoTrackingStatus:.
GET and SET methods are available in Apptics class.
- If the user turns ON/OFF "Send diagnostics and usage statistics", set YES/NO in setTrackingStatus method.
- If the user turns ON/OFF "Crash reports", set YES/NO in setCrashReportStatus method.
- If the user turns ON/OFF "Include userID", set "YES/NO" in setPersonalInfoTrackingStatus method.
When the crash report is turned OFF in the Settings and if the app crashes, the user is shown an alert.