앱 삭제 트래킹
Apple Push Notification Service (APNs)를 Singular SDK와 연동하여 앱 삭제를 트래킹하고 사용자 리텐션을 측정하며 리인게이지먼트 캠페인을 최적화하세요.
중요: 앱 삭제 트래킹을 사용하려면 앱에 APNs 구성이 필요합니다. 전체 구현 세부 정보는 Apple의 UserNotifications Framework 문서 를 참조하세요.
사전 준비 사항
Singular 플랫폼 구성
앱에 앱 삭제 트래킹을 구현하기 전에 다음 가이드에 따라 Singular 플랫폼에서 앱을 구성하세요. iOS 앱 삭제 트래킹 설정하기 .
시스템 요구사항
앱 삭제 트래킹에는 Apple Push Notification Service와 특정 기기 구성이 필요합니다.
APNs 요구사항 ( 출처 ):
- iOS 버전: UserNotifications 프레임워크를 위해 기기가 iOS 10.0 이상에서 실행되어야 합니다
- APNs 인증서: Apple Developer 포털에서 APNs 인증서 또는 토큰을 구성하세요
- 푸시 권한: Xcode 프로젝트 설정에서 Push Notifications 권한을 활성화하세요
- 사용자 권한: 푸시 알림에 대한 사용자 인증을 요청하고 획득하세요
참고: 푸시 알림 권한을 거부하거나 APNs를 지원하지 않는 기기를 사용하는 사용자는 앱 삭제로 트래킹되지 않습니다.
구현 단계
1단계: 푸시 알림 활성화
아직 활성화되지 않은 경우 푸시 알림을 지원하도록 Xcode 프로젝트를 구성하세요.
- Xcode에서 프로젝트를 엽니다
- 앱 타겟을 선택하고 Signing & Capabilities 로 이동합니다
- + Capability 를 클릭하고 Push Notifications 를 추가합니다
- Background Modes에서 Remote notifications 이 체크되어 있는지 확인하세요
2단계: 사용자 인증 요청
UserNotifications 프레임워크를 사용하여 사용자에게 푸시 알림 수신 권한을 요청하세요.
import UIKit
import UserNotifications
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Set notification delegate
UNUserNotificationCenter.current().delegate = self
// Request authorization for notifications
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { granted, error in
if let error = error {
print("Notification authorization error: \(error.localizedDescription)")
}
if granted {
// Register for remote notifications on main thread
DispatchQueue.main.async {
application.registerForRemoteNotifications()
}
}
}
return true
}
}
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Set notification delegate
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
// Request authorization for notifications
UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert |
UNAuthorizationOptionBadge |
UNAuthorizationOptionSound;
[[UNUserNotificationCenter currentNotificationCenter]
requestAuthorizationWithOptions:authOptions
completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (error) {
NSLog(@"Notification authorization error: %@", error.localizedDescription);
}
if (granted) {
// Register for remote notifications on main thread
dispatch_async(dispatch_get_main_queue(), ^{
[application registerForRemoteNotifications];
});
}
}];
return YES;
}
@end
3단계: APNs 디바이스 토큰 등록
APNs 디바이스 토큰을 가져와 앱 삭제 트래킹을 위해 Singular에 전송하세요.
토큰 가져오기 및 설정
didRegisterForRemoteNotificationsWithDeviceToken
콜백을 구현하여 APNs 토큰을 캡처하고 Singular에 등록하세요.
import Singular
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// Register the device token with Singular for uninstall tracking
Singular.registerDeviceToken(forUninstall: deviceToken)
print("APNs device token registered with Singular")
// Also send to your server if needed for your own push notifications
sendTokenToServer(deviceToken)
}
func application(_ application: UIApplication,
didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("Failed to register for remote notifications: \(error.localizedDescription)")
}
private func sendTokenToServer(_ deviceToken: Data) {
// Implement your server communication logic here
}
#import <Singular/Singular.h>
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Register the device token with Singular for uninstall tracking
[Singular registerDeviceTokenForUninstall:deviceToken];
NSLog(@"APNs device token registered with Singular");
// Also send to your server if needed for your own push notifications
[self sendTokenToServer:deviceToken];
}
- (void)application:(UIApplication *)application
didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
NSLog(@"Failed to register for remote notifications: %@", error.localizedDescription);
}
- (void)sendTokenToServer:(NSData *)deviceToken {
// Implement your server communication logic here
}
모범 사례:
토큰을 수신하는 즉시
registerDeviceTokenForUninstall
을 호출하여 첫 번째 앱 세션부터 앱 삭제 트래킹이 활성화되도록 하세요.
토큰 데이터 형식
APNs 디바이스 토큰을 Apple로부터 수신한 그대로 네이티브 바이너리 형식으로 Singular에 전달하세요.
중요: APNs 토큰은 바이너리 데이터(NSData/Data)입니다. 변환 없이 Singular에 직접 전달하세요. 앱이 다른 용도로 토큰을 16진수 문자열로 변환해야 하는 경우, Singular용으로는 원본 NSData 객체를 유지하세요.
16진수 형식 예시:
b0adf7c9730763f88e1a048e28c68a9f806ed032fb522debff5bfba010a9b052
검증 및 문제 해결
구현 검증
앱 삭제 트래킹이 올바르게 작동하는지 확인하세요.
- 로그 확인: 로그에 APNs 토큰 등록이 표시되는지 확인하세요
- 토큰 생성 테스트: 앱 최초 실행 시 토큰이 생성되는지 확인하세요
- 대시보드 모니터링: 24~48시간 후 Singular 대시보드에서 앱 삭제 트래킹 데이터를 확인하세요
- 권한 테스트: 알림 인증 프롬프트가 나타나고 올바르게 작동하는지 확인하세요
일반적인 문제
- 토큰이 생성되지 않음: Xcode에서 Push Notifications 권한이 활성화되어 있고 Apple Developer 포털에서 APNs 인증서가 구성되어 있는지 확인하세요
- 사용자가 권한을 거부함: 거부된 알림 권한을 적절히 처리할 수 있는 로직을 구현하세요
- 데이터 누락: 기기가 iOS 10.0 이상에서 실행되고 사용자가 알림 권한을 부여했는지 확인하세요
- 구성 오류: Singular 플랫폼 설정에서 앱 삭제 트래킹이 활성화되어 있는지 확인하세요
- 시뮬레이터 제한: APNs 토큰은 iOS 시뮬레이터에서 사용할 수 없으며, 실제 기기에서 테스트해야 합니다
추가 자료: 자세한 문제 해결은 앱 삭제 트래킹 설정 가이드 및 Apple의 UserNotifications 문서 를 참조하세요.