iOS SDK - 푸시 알림 지원

문서

푸시 알림을 사용한 리인게이지먼트 추적 지원

Singular는 푸시 알림 추적을 통해 iOS 앱의 리인게이지먼트를 측정할 수 있습니다. Apple 푸시 알림 서비스(APN)와 Singular SDK를 연동하면 푸시 알림과 사용자의 상호작용을 추적하고 정확하게 어트리뷰션할 수 있습니다.

아래 구현 가이드를 따라 iOS 애플리케이션에서 푸시 알림을 올바르게 추적할 수 있도록 하세요.

푸시 알림 추적이 중요한 이유는 무엇인가요?

푸시 알림은 사용자 리인게이지먼트에 필수적이지만, 적절한 추적 없이는 그 영향이 불분명합니다. Singular를 사용하면 알림 상호 작용이 적절하게 어트리뷰션되어 마케팅 캠페인을 최적화하고 사용자 리텐션을 측정할 수 있습니다.

구현 가이드

1단계: 푸시 알림 등록

UNUserNotificationCenter 을 사용하여 앱이 푸시 알림에 올바르게 등록되었는지 확인합니다.

예시:

SwiftObjective-C
import UserNotifications

// Set the current instance as the delegate for the UNUserNotificationCenter to handle notifications

UNUserNotificationCenter.current().delegate = self

// Define the notification authorization options (alert, badge, sound)

let pushAuthOptions: UNAuthorizationOptions = [.alert, .badge, .sound]

// Request notification authorization from the user

UNUserNotificationCenter.current().requestAuthorization(options: pushAuthOptions) { granted, error in
    // If an error occurs during authorization, print the error description

    if let error = error {
        print("registerForPushNotifications : failure - \(error.localizedDescription)")
    }
    
    // If the user granted permission for notifications, register for remote notifications

    if granted {
        // Ensure that the registration for remote notifications is done on the main thread

        DispatchQueue.main.async {
            UIApplication.shared.registerForRemoteNotifications()
        }
    }
}

이 단계에서는 앱이 푸시 알림을 수신하고 처리하도록 설정되어 있는지 확인합니다.

2단계: 푸시 알림 처리 및 Singular에게 데이터 전달하기

푸시 알림이 수신되면 이를 처리하여 추적을 위해 Singular로 전송해야 합니다.

예시:

SwiftObjective-C
func userNotificationCenter(_ center: UNUserNotificationCenter, 
                            didReceive response: UNNotificationResponse, 
                            withCompletionHandler completionHandler: @escaping () -> Void) {
    // Pass the notification data to Singular for tracking.

    Singular.handlePushNotification(response.notification.request.content.userInfo)
    
    // Call the completion handler to indicate processing is complete.

    completionHandler()
}

3단계: 푸시 알림 페이로드를 Singular SDK와 연동하기

푸시 알림을 처리하도록 Singular SDK가 올바르게 구성되었는지 확인합니다.

예시:

SwiftObjective-C
// Assuming config is an optional object, make sure it's not nil before using it

config?.pushNotificationLinkPath = [
    ["path", "to", "link"],["sng_link"]
]

// Start the Singular SDK with the given configuration (ensure config is valid)

Singular.start(config)

이 단계를 통해 Singular는 푸시 알림 상호 작용을 올바르게 추적하고 그에 따라 어트리뷰션할 수 있습니다.

유효성 검사 가이드

4단계: 세션 시작 호출에서 푸시 알림 수신 유효성 검사/확인하기

Singular SDK API 호출은 푸시 알림 페이로드 링크가 시작 세션 호출의 singular_link 예약 매개변수 아래에 올바르게 전달되었는지 확인합니다.

예시:

https://skan.singular.net:443/api/v1/start?dnt=-1&update_time=0&c=wwan&singular_link_resolve_required=false&rt=plist&lag=0.00&is=false&event_index=10&d=iPhone14,7&skan_has_framework=true&sdk=Singular/12.7.1&skan_conversion_value_mode=managed&mo=iPhone14,7&skan_update_counter=1&i=com.singular.SwiftScene&config_version=0&k=IDFV&cr=1&skan_total_admon_revenue_by_currency={}&install_time=1740577866&n=SwiftScene&av=1.0&skan_skadnetwork_enabled=true&p=iOS&idfv=D159BFDC-D061-479B-AB24-0CE00C1FA2AA&att_authorization_status=0&device_type=phone&s=F90C41BF-99EC-48FC-ABF8-2781FF5A2799&skan_first_call_to_skadnetwork_timestamp=1740577882&u=D159BFDC-D061-479B-AB24-0CE00C1FA2AA&skan_last_call_to_skadnetwork_timestamp=1740577882&singular_install_id=554DBBE4-9842-46A8-9F9D-24B8A9BF83E3&v=18.2.1&singular_link=https://sl.sng.link/Cclbu/2a7n_dl=com.singular.flutterApplication1&_smtype=3&singular_link_resolve_timeout=0&pu=1&a=sdk<>key&skan_total_revenue_by_currency={}&h=8aee646bc4b796a5f8908ef8af677ba0fde70aa9</>

또는 아래 예시처럼 Singular SDK 콘솔을 사용하여 딥링크 URL 아래의 푸시 알림 추적 링크를 확인할 수 있습니다.

이를 확인하면 푸시 알림 인게이지먼트가 Singular SDK 내에서 올바르게 추적되는지 확인할 수 있습니다.

참고:

  • singularLinksHandler 코드와 달리 Singular SDK는 이 기능에 대한 푸시 페이로드 콜백을 제공하지 않는다는 점에 유의하세요. 푸시 알림 데이터를 읽고 딥링킹 로직을 구현하여 사용자를 앱 내의 특정 제품 페이지로 리디렉션하는 것은 앱 개발자의 책임입니다. 이 솔루션에서 Singular는 사용자가 알림을 탭할 때 푸시 알림 페이로드를 검색하고 Singular.start() 에 의해 트리거되는 SDK 시작 세션 이벤트에 이 페이로드를 포함합니다. 그런 다음 이 데이터는 Singular 백엔드에서 처리되어 푸시 알림 터치포인트/클릭에 어트리뷰션을 부여하고 리인게이지먼트 추적을 위해 등록됩니다.
  • 푸시 알림 페이로드에 전달된 사용자 지정 키 값 쌍의 Singular 링크 도메인만 허용하는 안전 메커니즘이 마련되어 있습니다. 구체적으로, Singular 링크 관리 페이지에서 미리 정의된 sng.link 도메인만 허용됩니다.

    예를 들어
    https://prod_test.sng.link/B0s2a/51oi?_dl=singular%3A%2F%2Fmain

    다른 도메인(예: 이메일 서비스 제공업체의 ESP 도메인 ) 내에서 Singular 링크를 래핑하려는 경우 설정에서 다음 옵션을 추가하여 도메인을 명시적으로 구성해야 합니다: 이렇게 하면 외부 도메인이 Singular 프레임워크 내에서 인식되고 허용됩니다. 아래 구성 예시를 참조하세요. config.espDomains = @[@"sl.esp.link"];

  • Singular 푸시 알림에서 사용자 행동에 따라 다른 딥링크를 트리거해야 하는 경우 Singular Singular 추적 링크를 사용하고 리디렉션을 동적으로 수정할 수 있습니다.

    예시:

    뉴스 속보 푸시 알림에 여러 개의 딥링크 옵션을 제공할 수 있습니다:

    여러 개의 추적 링크를 만드는 대신 하나의 Singular 추적 링크를 구성하고 사용자 선택에 따라 리디렉션을 동적으로 조정하세요.

    최신 뉴스 읽기
    newsapp://article?id=12345
    인기 토픽
    newsapp://trending
    스포츠
    newsapp://sports

    Singular 추적 링크에서 리디렉션 재정의에 대해 자세히 알아보세요.

성공!

이 단계를 수행하면 이제 iOS 앱이 Singular를 사용하여 푸시 알림을 추적하도록 구성되었습니다. 이렇게 하면 참여 추적이 개선되고, 리인게이지먼트 캠페인을 최적화하며, 어트리뷰션 정확도가 향상됩니다.