At a glance: Setup uninstall measurement in iOS apps by integrating Apple Push Notification Service (APN) into the app.
iOS uninstall measurement
iOS uninstall measurement is available by adopting APN in the app.
Considerations:
- APN reports in real-time when a user removes an app only if at least eight days have passed since the install. This means that iOS uninstall data is available only after day 8.
- Measurement is not possible for users who reject Push Notification permissions.
iOS app requirements:
- iOS 13+
- ZendeskConnect SDK 4.10.4+
- p12 certificate. p8 certificates aren't supported.
Integration procedures
Complete the following sections to set up, integrate, and test iOS uninstall measurement.
Get ID in Apple and set uninstall measurement in ZendeskConnect
-
To find your app id:
- In the Apple Developer Members Center, click Identifiers under iOS Apps and locate your app.
- If you have not registered an App ID yet, click + and complete the form.
- Select Push Notifications.
- When you expand the application, there are two settings for push notifications with yellow or green status icons:
- Click Settings.
Note The Settings button may be titled Edit if push notifications have been previously configured. If the Settings/Edit button is not available, you may not be the team agent or an admin. The person who originally created the developer account is your team agent and they carry out the remainder of the steps in this section.
- In the Apple Developer Members Center, click Identifiers under iOS Apps and locate your app.
-
To generate your certificate:
-
Select Apple Push Notification service SSL (Sandbox & Production) in Production certificate option. If you are using VoIP for push notifications, select VoIP Services Certificate.
-
Click Create Certificate from the Production SSL Certificate option.
-
After clicking Create Certificate, note the Add iOS Certificate Assistant. Follow the instructions in the assistant and then click Continue.
-
Using the Certificate Signing request that was just created, generate the APNS Push SSL certificate.
-
Once the Download button appears, you are ready to download. You may need to reload the page for this to update. Download the newly created certificate:
-
Open the certificate. Opening the certificate will open Keychain Access. In the Keychain Access, your certificate is shown under My Certificates. If not, check Certificates to see if it’s located there.
NoteOnly account admins can upload or change the p12 certificate.
-
-
To renew your certificate
If you are renewing either your Development or Production Push SSL Certificate, follow the steps listed previously. There is no need to revoke the previous certificate to make this change. Two production certificates can be in use at the same time, allowing you to continue using the old certificate while uploading the new one. Note! don't use development certificates in a production environment. -
To export the P12 File:
The final step before heading back over to the ZendeskConnect dashboard is to save your signing certificate as a .p12 file.-
Select the certificate that was just added to Keychain Access
-
Go to File > Export Items.
-
Select My Certificates under the Category menu on the lower left-hand side.
If My Certificates is not highlighted, you cannot export the certificate as a .p12 file.
When saving the file, use the Personal Information Exchange (.p12) format.
Make sure it states Apple Push Services and appears as follows:
-
-
To configure uninstall measurement in ZendeskConnect
-
In ZendeskConnect, go to Configuration > App Settings.
-
Scroll down to the Uninstall section.
-
Turn on uninstall measurement.
-
Click on the upload icon, select the P12 file to upload.
-
(optional) If the P12 certificate is password protected, fill in the password in the P12 certificate Password.
-
Click Validate to send the certificate to ZendeskConnect to check if it is valid.
-
Click Save Settings.
-
Integrate with the SDK
Push notifications must be registered at the app's code level to enable uninstall data collection.
//add UserNotifications.framework
import UserNotifications
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//...
// iOS 10 support
if #available(iOS 10, *) {
UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]){ (granted, error) in }
application.registerForRemoteNotifications()
}
// iOS 9 and iOS 8 support
else if #available(iOS 8, *), #available(iOS 9, *) {
UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil))
UIApplication.shared.registerForRemoteNotifications()
}
// iOS 7 support
else {
application.registerForRemoteNotifications(matching: [.badge, .sound, .alert])
}
return true
}
// Called when the application sucessfuly registers for push notifications
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
ZendeskConnectLib.shared().registerUninstall(deviceToken)
}
Add the following code to your AppDelegate.m:
- #import <UserNotifications/UserNotifications.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// The userNotificationTypes below is just an example and may be changed depending on the app
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) {
}];
[[UIApplication sharedApplication] registerForRemoteNotifications];
// if you do not use push notificaiton in your app, uncomment the following line
//application.applicationIconBadgeNumber = 0;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[[ZendeskConnectLib shared] registerUninstall:deviceToken];
}
}
In AppDelegate.h, insert the following code to add UNUserNotificationCenterDelegate to the interface declaration:
#import <ZendeskConnectLib/ZendeskConnectLib.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, ZendeskConnectLibDelegate>
The code snippets above request permissions from the user to send push notifications. However, if you are only using push notifications in background mode to measure uninstalls, there is no need to ask for user approval. This is because these push notifications are silent push notifications that do not require you to ask permission from users.
User permission for push notifications in background mode
If you are only using silent push notifications, make sure to enable Remote Notifications in Background Modes in your app's Capabilities:
- In XCode, select your project
- Select your target
- Switch to Capabilities tab
- Toggle Background Modes on
- Check Remote notifications
Push notifications
Make sure you add Push Notification in your XCode capabilities tab. Without it, the deviceToken is not collected.
Testing iOS uninstalls
- Install the app.
- Uninstall the app. Note! You can uninstall the app immediately after installing it.
When testing uninstalls from XCode or TestFlight it is important to let our SDK know that the token is generated from a Sandbox environment. Use the following APIs:
ZendeskConnectLib.shared().setUseUninstallSandbox = true
[ZendeskConnectLib shared].setUseUninstallSandbox = true;
Note! Uninstalls do not immediately appear in the ZendeskConnect dashboard:
- It takes 9 days on average for uninstalls to appear in reports
- It can take more than a month for uninstalls originating from sandbox environments to appear in reports
In addition, the date of the uninstall is the date on which the uninstall is reported. See the next section to learn more.
Viewing uninstall data in the ZendeskConnect dashboard
Uninstall measurement is displayed on the main dashboard in the Aggregated Performance table.
Due to a recent change in Apple Push Notification service, the time it takes uninstalls to appear on the dashboard is a minimum of 9 days. ZendeskConnect updates and aggregates metrics for uninstalls every 24 hours
Example
- Day 1: a user installs your app
- Day 4: a user uninstalls your app
- Day 12: Apple Push Notification Service reports app removal 8 days after the uninstall
- Day 13: Uninstall data appear on ZendeskConnect dashboard and raw data
For more details, refer to the iOS Measure App Uninstalls section of the SDK Integration Guide.









Comments
0 comments
Article is closed for comments.