본문으로 건너뛰기

앱스플라이어 (appsflyer)

🚀 추가된 버전 : SDKSDKv1.7.0 AndroidAndroidv1.7.0 iOSiOSv1.7.0
🔔 최신화 일자: 2025-09-26

개요

appsflyer 네임스페이스는 AppsFlyer 마케팅 어트리뷰션 및 사용자 트래킹 기능을 제공하며, 사용자는 AppsFlyer를 통해 마케팅 성과를 추적할 수 있습니다.

이 네임스페이스를 사용하여 커스텀 유저 ID 관리, 어트리뷰션 데이터 조회, 커스텀 이벤트 로깅과 같은 기능을 수행할 수 있습니다.


타입 정의

AppsflyerResult

AppsFlyer 요청의 결과 상태를 나타내는 타입입니다.

export declare type AppsflyerSuccessResult = {
status: 'success';
statusCode: 200;
message: string;
};
export declare type AppsflyerErrorResult = {
status: 'error';
statusCode: number;
errorCode: string;
message: string;
};
export declare type AppsflyerResult =
| AppsflyerSuccessResult
| AppsflyerErrorResult;
필드타입설명
status'error' | 'success'요청 성공 또는 실패 상태
statusCodenumber상태 코드 (성공 시 200)
messagestring응답 메시지
errorCodestring (optional)오류 코드 (실패 시 반환)

GetCustomUserIdResult

커스텀 유저 ID 조회 결과를 나타내는 타입입니다.

interface GetCustomUserIdSuccessResult extends AppsflyerSuccessResult {
userId: string;
}

export declare type GetCustomUserIdResult =
| GetCustomUserIdSuccessResult
| AppsflyerErrorResult;
필드타입설명
status'error' | 'success'요청 성공 또는 실패 상태
statusCodenumber상태 코드 (성공 시 200)
messagestring응답 메시지
errorCodestring (optional)오류 코드 (실패 시 반환)
userIdstring등록된 커스텀 유저 ID (성공 시만)

ConversionData

AppsFlyer 전환 데이터를 나타내는 타입입니다.

export declare interface ConversionData {
timestamp: number;
data_type: 'conversion_data';
install_time: string;
af_message: string;
af_status: 'Organic' | 'Non-organic';
is_first_launch: boolean;
}
필드타입설명
timestampnumber전환 데이터 수신 시간 (Unix 에포크 밀리초)
data_type'conversion_data'데이터 타입 (전환 데이터)
install_timestring앱 설치 시간
af_messagestringAppsFlyer 메시지
af_status'Organic' | 'Non-organic'설치 어트리뷰션 타입 (유기적/비유기적 설치)
is_first_launchboolean첫 번째 실행 여부

AppsFlyer 딥링크 데이터를 나타내는 타입입니다.

export declare interface BaseDeepLinkData {
timestamp: number;
data_type: 'deeplink_data';
link_type: 'app_link' | 'universal_link' | 'uri_scheme';
scheme: string;
host: string;
path: string;
link: string;
is_deferred: false;
}

export declare type DeepLinkData = BaseDeepLinkData &
Omit<Record<string, string>, keyof BaseDeepLinkData>;
필드타입설명
timestampnumber딥링크 데이터 수신 시간 (Unix 에포크 밀리초)
data_type'deeplink_data'데이터 타입 (딥링크 데이터)
link_type'app_link' | 'universal_link' | 'uri_scheme'링크 타입
schemestring앱 스킴
hoststring호스트 이름
pathstringURL 경로
linkstring전체 링크 URL
is_deferredfalse디퍼드 딥링크 여부 (일반 딥링크는 false)
기타 커스텀 파라미터string추가 커스텀 쿼리 파라미터들

AppsFlyer 디퍼드 딥링크 데이터를 나타내는 타입입니다.

export declare interface BaseDeferredDeepLinkData {
timestamp: number;
data_type: 'deeplink_data';
link_type: 'deferred_link';
is_deferred: true;
match_type:
| 'referrer' // Google Play referrer string
| 'id_matching'
| 'probabilistic'
| 'srn'; // self-reporting network
media_source: string;
campaign: string;
campaign_id: string;
click_http_referrer: string;
deep_link_value: string;
af_sub1: string;
af_sub2: string;
af_sub3: string;
af_sub4: string;
af_sub5: string;
}

export declare type DeferredDeepLinkData = BaseDeferredDeepLinkData &
Omit<Record<string, string>, keyof BaseDeepLinkData>;
필드타입설명
timestampnumber딥링크 데이터 수신 시간 (Unix 에포크 밀리초)
data_type'deeplink_data'데이터 타입 (딥링크 데이터)
link_type'deferred_link'링크 타입
is_deferredtrue디퍼드 딥링크 여부 (디퍼드 딥링크는 true)
match_type'referrer' | 'id_matching' | 'probabilistic' | 'srn'어트리뷰션 매칭 방식
media_sourcestring미디어 소스 (광고 플랫폼)
campaignstring (optional)캠페인 이름
campaign_idstring (optional)캠페인 ID
기타 커스텀 파라미터string추가 커스텀 쿼리 파라미터들

AttributionData

AppsFlyer 어트리뷰션 데이터를 나타내는 유니온 타입입니다.

export declare type AttributionData =
| ConversionData
| DeepLinkData
| DeferredDeepLinkData;

어트리뷰션 데이터는 다음 중 하나의 타입을 가집니다.

  • ConversionData: 전환 데이터 (설치, 실행 어트리뷰션 정보)
  • DeepLinkData: 딥링크 데이터 (링크 클릭을 통한 앱 실행 정보)
  • DeferredDeepLinkData: 디퍼드 딥링크 데이터 (설치 후 첫 실행 시 어트리뷰션 정보)

GetAttributionDataResult

어트리뷰션 데이터 조회 결과를 나타내는 타입입니다.

interface GetAttributionDataSuccessResult extends AppsflyerSuccessResult {
data: AttributionData;
}

export declare type GetAttributionDataResult =
| GetAttributionDataSuccessResult
| AppsflyerErrorResult;

GetAttributionListResult

어트리뷰션 데이터 목록 조회 결과를 나타내는 타입입니다.

interface GetAttributionListSuccessResult extends AppsflyerSuccessResult {
data: AttributionData[];
}

export declare type GetAttributionListResult =
| GetAttributionListSuccessResult
| AppsflyerErrorResult;

메서드 목록

메서드설명추가된 버전
setCustomUserId(userId)커스텀 유저 ID 설정SDKSDKv1.7.0
getCustomUserId()커스텀 유저 ID 조회SDKSDKv1.7.0
deleteCustomUserId()커스텀 유저 ID 삭제SDKSDKv1.7.0
getAttributionData()어트리뷰션 데이터 조회SDKSDKv1.7.0
clearAttributionData()어트리뷰션 데이터 삭제SDKSDKv1.7.0
getAttributionList()어트리뷰션 데이터 목록 조회SDKSDKv1.7.0
clearAttributionList()어트리뷰션 데이터 목록 삭제SDKSDKv1.7.0
logEvent(eventName, values)커스텀 이벤트 로깅SDKSDKv1.7.0

메서드 상세

setCustomUserId(userId: string): Promise<AppsflyerResult>

주의

필수 선행 작업이 완료되어야 사용할 수 있습니다.

설명

AppsFlyer에 커스텀 유저 ID를 설정합니다. 이 ID는 사용자를 고유하게 식별하는 데 사용됩니다.

매개변수

이름타입필수 여부설명
userIdstring설정할 유저 식별자

반환 값

Promise<AppsflyerResult> - 설정 결과를 포함하는 Promise

사용 예제

// 커스텀 유저 ID 설정
const result = await Nachocode.appsflyer.setCustomUserId('user123');
if (result.status === 'success') {
console.log('커스텀 유저 ID 설정 성공:', result.message);
} else {
console.error('커스텀 유저 ID 설정 실패:', result.errorCode, result.message);
}

getCustomUserId(): Promise<GetCustomUserIdResult>

주의

필수 선행 작업이 완료되어야 사용할 수 있습니다.

설명

AppsFlyer에서 등록된 커스텀 유저 ID를 조회합니다.

반환 값

Promise<GetCustomUserIdResult> - 커스텀 유저 ID와 결과를 포함하는 Promise

사용 예제

// 커스텀 유저 ID 조회
const result = await Nachocode.appsflyer.getCustomUserId();
if (result.status === 'success') {
console.log('커스텀 유저 ID:', result.userId);
} else {
console.error('커스텀 유저 ID 조회 실패:', result.errorCode, result.message);
}

deleteCustomUserId(): Promise<AppsflyerResult>

주의

필수 선행 작업이 완료되어야 사용할 수 있습니다.

설명

AppsFlyer에서 등록된 커스텀 유저 ID를 삭제합니다.

반환 값

Promise<AppsflyerResult> - 삭제 결과를 포함하는 Promise

사용 예제

// 커스텀 유저 ID 삭제
const result = await Nachocode.appsflyer.deleteCustomUserId();
if (result.status === 'success') {
console.log('커스텀 유저 ID 삭제 성공:', result.message);
} else {
console.error('커스텀 유저 ID 삭제 실패:', result.errorCode, result.message);
}

getAttributionData(): Promise<GetAttributionDataResult>

주의

필수 선행 작업이 완료되어야 사용할 수 있습니다.

설명

AppsFlyer 어트리뷰션 데이터를 조회합니다. 사용자의 설치 경로 및 마케팅 캠페인 정보를 확인할 수 있습니다.

반환 값

Promise<GetAttributionDataResult> - 어트리뷰션 데이터를 포함하는 Promise

사용 예제

// 어트리뷰션 데이터 조회
const result = await Nachocode.appsflyer.getAttributionData();
if (result.status === 'success') {
console.log('어트리뷰션 데이터:', result.data);

// 데이터 타입에 따라 처리
if (result.data.data_type === 'conversion_data') {
// 전환 데이터인 경우
console.log('설치 타입:', result.data.af_status);
console.log('첫 실행 여부:', result.data.is_first_launch);
console.log('설치 시간:', result.data.install_time);
} else if (result.data.data_type === 'deeplink_data') {
// 딥링크 데이터인 경우
console.log('링크 타입:', result.data.link_type);
console.log('스킴:', result.data.scheme);
console.log('전체 링크:', result.data.link);

// 디퍼드 딥링크인지 확인
if (result.data.is_deferred) {
// 디퍼드 딥링크 추가 정보
console.log('매칭 방식:', result.data.match_type);
console.log('미디어 소스:', result.data.media_source);
console.log('클릭 시간:', result.data.click_time);
console.log('설치 시간:', result.data.install_time);
if (result.data.campaign) {
console.log('캠페인:', result.data.campaign);
}
} else {
console.log('일반 딥링크');
}
}
} else {
console.error(
'어트리뷰션 데이터 조회 실패:',
result.errorCode,
result.message
);
}

clearAttributionData(): Promise<AppsflyerResult>

주의

필수 선행 작업이 완료되어야 사용할 수 있습니다.

설명

저장된 어트리뷰션 데이터를 삭제합니다.

반환 값

Promise<AppsflyerResult> - 삭제 결과를 포함하는 Promise

사용 예제

// 어트리뷰션 데이터 삭제
const result = await Nachocode.appsflyer.clearAttributionData();
if (result.status === 'success') {
console.log('어트리뷰션 데이터 삭제 성공:', result.message);
} else {
console.error(
'어트리뷰션 데이터 삭제 실패:',
result.errorCode,
result.message
);
}

getAttributionList(): Promise<GetAttributionListResult>

주의

필수 선행 작업이 완료되어야 사용할 수 있습니다.

설명

저장된 어트리뷰션 데이터 목록을 조회합니다.

반환 값

Promise<GetAttributionListResult> - 어트리뷰션 데이터 목록을 포함하는 Promise

사용 예제

// 어트리뷰션 데이터 목록 조회
const result = await Nachocode.appsflyer.getAttributionList();
if (result.status === 'success') {
console.log('어트리뷰션 데이터 목록:', result.data);
result.data.forEach((attribution, index) => {
console.log(`${index + 1}. 데이터 타입: ${attribution.data_type}`);

if (attribution.data_type === 'conversion_data') {
console.log(` 설치 타입: ${attribution.af_status}`);
console.log(` 첫 실행 여부: ${attribution.is_first_launch}`);
} else if (attribution.data_type === 'deeplink_data') {
console.log(` 링크 타입: ${attribution.link_type}`);
console.log(` 링크: ${attribution.link}`);

// 디퍼드 딥링크인지 확인
if (attribution.is_deferred) {
console.log(` 디퍼드 딥링크 - 매칭 방식: ${attribution.match_type}`);
console.log(` 미디어 소스: ${attribution.media_source}`);
if (attribution.campaign) {
console.log(` 캠페인: ${attribution.campaign}`);
}
} else {
console.log(` 일반 딥링크`);
}
}
});
} else {
console.error('어트리뷰션 목록 조회 실패:', result.errorCode, result.message);
}

clearAttributionList(): Promise<AppsflyerResult>

주의

필수 선행 작업이 완료되어야 사용할 수 있습니다.

설명

저장된 어트리뷰션 데이터 목록을 삭제합니다.

반환 값

Promise<AppsflyerResult> - 삭제 결과를 포함하는 Promise

사용 예제

// 어트리뷰션 데이터 목록 삭제
const result = await Nachocode.appsflyer.clearAttributionList();
if (result.status === 'success') {
console.log('어트리뷰션 목록 삭제 성공:', result.message);
} else {
console.error('어트리뷰션 목록 삭제 실패:', result.errorCode, result.message);
}

logEvent(eventName: string, values: Record<string, any>): Promise<AppsflyerResult>

주의

필수 선행 작업이 완료되어야 사용할 수 있습니다.

설명

AppsFlyer에 커스텀 이벤트를 로깅합니다. 사용자의 행동이나 앱 내 활동을 추적하는 데 사용됩니다.

매개변수

이름타입필수 여부설명
eventNamestring이벤트 이름
valuesRecord<string, any>이벤트와 함께 전송할 값

반환 값

Promise<AppsflyerResult> - 이벤트 로깅 결과를 포함하는 Promise

사용 예제

// 커스텀 이벤트 로깅
const result = await Nachocode.appsflyer.logEvent('purchase', {
product_id: 'item_001',
price: 9.99,
currency: 'USD',
category: 'electronics',
});

if (result.status === 'success') {
console.log('이벤트 로깅 성공:', result.message);
} else {
console.error('이벤트 로깅 실패:', result.errorCode, result.message);
}

추가 정보
  • AppsFlyer 네임스페이스는 마케팅 어트리뷰션 추적에 특화된 기능을 제공합니다.
  • 모든 메서드는 Promise 기반으로 동작하며, async/await 패턴을 사용할 수 있습니다.
  • 커스텀 이벤트 로깅은 마케팅 캠페인 성과 측정에 중요한 데이터를 제공합니다.
  • 어트리뷰션 데이터는 사용자의 설치 경로 및 마케팅 채널 분석에 활용할 수 있습니다.