Skip to content

Commit aede20d

Browse files
committed
[Feat] #301 - 푸시알림 추적 이벤트 심기
1 parent 3ba4044 commit aede20d

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

Terning-iOS/Terning-iOS/Application/AppDelegate.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
6767
/// 푸시 클릭시
6868
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
6969

70+
track(eventName: .pushNotificationOpened)
71+
7072
let userInfo = response.notification.request.content.userInfo
7173
if let type = userInfo["type"] as? String {
7274
PushNavigator.handlePush(type: type)
@@ -76,6 +78,8 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
7678
/// Foreground(앱 켜진 상태)에서도 알림 오는 설정
7779
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
7880

81+
track(eventName: .pushNotificationReceived)
82+
7983
completionHandler([.sound, .banner, .list])
8084
}
8185

@@ -130,3 +134,9 @@ extension AppDelegate: MessagingDelegate {
130134
// Note: This callback is fired at each app startup and whenever a new token is generated.
131135
}
132136
}
137+
138+
extension AppDelegate {
139+
public func track(eventName: AmplitudeEventType, eventProperties: [String: Any]? = nil) {
140+
AmplitudeManager.shared.track(eventType: eventName, eventProperties: eventProperties)
141+
}
142+
}

Terning-iOS/Terning-iOS/Resource/Amplitude/AmplitudeEventType.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,8 @@ public enum AmplitudeEventType: String {
6363
case clickNavigationSearch = "click_navigation_search" // 네비게이션바_탐색
6464
case clickNavigationMyPage = "click_navigation_mypage" // 네비게이션바_마이페이지
6565
case clickNavigationHome = "click_navigation_home" // 네비게이션바_홈
66+
67+
// 푸시알림
68+
case pushNotificationReceived = "push_notification_received" // 푸시 알림 수신 시
69+
case pushNotificationOpened = "push_notification_opened" // 푸시 알림 클릭 시
6670
}

0 commit comments

Comments
 (0)