-
Notifications
You must be signed in to change notification settings - Fork 0
딥링크 푸시 관련
jinsang edited this page Oct 5, 2023
·
6 revisions
- 에이스카운터는 트래킹 링크를 생성하는 기능을 제공하지 않습니다.
- 에이스카운터는 마케팅 코드를 제공해 딥링크로 앱 실행 또는 포그라운드 됐을때 SDK 가 함께 실행되면서 마케팅 코드를 NHN DATA 에이스카운터 서버로 전송합니다.
- SDK 전송 후
분석통계 > 마케팅효과 > 앱마케팅
에서 약 40분정도 분석 간격뒤에 확인 가능합니다. -
설정 > 캠페인 > 앱마케팅
에서추가
완료된 마케팅 코드에 대해서만 분석통계 화면에서 확인 가능합니다.
- SDK 전송 후
// in AppDelegate.m
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
[ACSDK appOpenUrl:url];
return YES;
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
[ACSDK appOpenUrl:userActivity.webpageURL];
}
return YES;
}
// in SceneDelegate.m
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
NSURL *url = [[URLContexts allObjects] firstObject].URL;
[ACSDK appOpenUrl:url];
}
- (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity API_AVAILABLE(ios(13.0)) {
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
[ACSDK appOpenUrl:userActivity.webpageURL];
}
}
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
id userActivity = [[[connectionOptions userActivities] allObjects] firstObject];
if (userActivity != nil) {
[self scene:scene continueUserActivity:userActivity];
}
else {
[self scene:scene openURLContexts:[connectionOptions URLContexts]];
}
}
- APNS 적용법
- AppDelegate 에 APNS 수신시 호출되는 delegate 메서드에 코드 추가
// in swift
import UserNotifications
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
ACSDK.push(response.notification.request.content.userInfo)
completionHandler()
}
// in objc
#import <UserNotifications/UserNotifications.h>
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler {
[ACSDK push:[[[[response notification] request] content] userInfo]];
completionHandler();
}
- 딥링크로 인해 앱이 forground 된 경우 호출되는 delegate에 코드를 삽입합니다.
+ (void)appOpenUrl:(NSURL * _Nullable)url;
- url: open 또는 handleOpen 로 전달받은 딜리게이트 파라미터(필수)
// in swift
ACSDK.appOpen(url)
// in objc
[ACSDK appOpenUrl:url];
- 푸시로 인해 앱이 forground 된 경우 호출되는 delegate에 코드를 삽입합니다.
+ (void)push:(NSDictionary * _Nullable)data;
- data: didReceive 또는 didReceiveRemoteNotification 로 전달받은 딜리게이트 파라미터(필수)
// in swift
ACSDK.push(data: response.notification.request.content.userInfo)
// in objc
[ACSDK push:userInfo];