AppsFlyer 딥링크 추가 설정

- onConversionDataSuccess에 레거시 딥링크 처리 추가
This commit is contained in:
Yu Sung 2025-03-18 23:26:32 +09:00
parent dfe17c7797
commit 23e99c443c
1 changed files with 46 additions and 3 deletions

View File

@ -92,6 +92,41 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
extension AppDelegate: AppsFlyerLibDelegate {
func onConversionDataSuccess(_ conversionInfo: [AnyHashable : Any]) {
DEBUG_LOG("AppsFlyer Conversion Data: \(conversionInfo)")
if let status = conversionInfo["af_status"] as? String, status == "Non-organic" {
let pid = conversionInfo["deep_link_sub1"] as? String ?? ""
if !pid.isEmpty {
UserDefaults.set(pid, forKey: .marketingPid)
}
if let utmSource = conversionInfo["deep_link_sub2"] as? String {
AppState.shared.marketingUtmSource = utmSource
}
if let utmMedium = conversionInfo["deep_link_sub3"] as? String {
AppState.shared.marketingUtmMedium = utmMedium
}
if let utmCampaign = conversionInfo["deep_link_sub4"] as? String {
AppState.shared.marketingUtmCampaign = utmCampaign
}
let deepLinkValue = conversionInfo["deep_link_value"] as? String ?? ""
let deepLinkValueId = Int(conversionInfo["deep_link_sub5"] as? String ?? "") ?? 0
if deepLinkValueId > 0 {
if deepLinkValue == "series" {
AppState.shared.pushSeriesId = deepLinkValueId
} else if deepLinkValue == "content" {
AppState.shared.pushAudioContentId = deepLinkValueId
} else if deepLinkValue == "live" {
AppState.shared.pushRoomId = deepLinkValueId
} else if deepLinkValue == "channel" {
AppState.shared.pushChannelId = deepLinkValueId
}
}
logUtmInFirebase()
}
}
func onConversionDataFail(_ error: any Error) {
@ -122,9 +157,17 @@ extension AppDelegate: DeepLinkDelegate {
UserDefaults.set(pid, forKey: .marketingPid)
}
AppState.shared.marketingUtmSource = deepLinkObj.clickEvent["deep_link_sub2"] as? String ?? ""
AppState.shared.marketingUtmMedium = deepLinkObj.clickEvent["deep_link_sub3"] as? String ?? ""
AppState.shared.marketingUtmCampaign = deepLinkObj.clickEvent["deep_link_sub4"] as? String ?? ""
if let utmSource = deepLinkObj.clickEvent["deep_link_sub2"] as? String {
AppState.shared.marketingUtmSource = utmSource
}
if let utmMedium = deepLinkObj.clickEvent["deep_link_sub3"] as? String {
AppState.shared.marketingUtmMedium = utmMedium
}
if let utmCampaign = deepLinkObj.clickEvent["deep_link_sub4"] as? String {
AppState.shared.marketingUtmCampaign = utmCampaign
}
let deepLinkValue = deepLinkObj.clickEvent["deep_link_value"] as? String ?? ""
let deepLinkValueId = Int(deepLinkObj.clickEvent["deep_link_sub5"] as? String ?? "") ?? 0