Adrop
Adrop SDK를 초기화하고 전역 설정을 관리하는 클래스입니다.
initialize
static initialize(
production: boolean,
targetCountries?: string[],
useInAppBrowser?: boolean
): void
Adrop SDK를 초기화합니다.
Parameters:
production (boolean): 프로덕션 모드 여부 (true: 프로덕션, false: 개발)
targetCountries (string[], optional): 타겟 국가 코드 배열 (기본값: [])
useInAppBrowser (boolean, optional): 인앱 브라우저 사용 여부 (기본값: false)
Example:
import { Adrop } from 'adrop-ads-react-native'
Adrop.initialize(true, ['KR', 'US'], false)
setUID
static setUID(uid: string): void
사용자 고유 식별자를 설정합니다.
Parameters:
Example:
setTheme
static setTheme(theme: AdropTheme): void
앱의 테마를 설정합니다.
Parameters:
theme (AdropTheme): 테마 값 (‘light’, ‘dark’, ‘auto’)
Example:
import { Adrop, AdropTheme } from 'adrop-ads-react-native'
Adrop.setTheme(AdropTheme.dark)
registerWebView
static registerWebView(viewTag: number): Promise<void>
백필 광고 지원을 위해 네이티브 WebView를 등록합니다. WebView가 마운트된 후 호출하세요.
Parameters:
viewTag (number): WebView를 감싸는 View에서 findNodeHandle()로 얻은 네이티브 뷰 태그
Example:
import { useEffect, useRef } from 'react'
import { findNodeHandle, View } from 'react-native'
import { Adrop } from 'adrop-ads-react-native'
const containerRef = useRef<View>(null)
useEffect(() => {
if (containerRef.current) {
const tag = findNodeHandle(containerRef.current)
if (tag != null) {
Adrop.registerWebView(tag)
}
}
}, [])
adrop-ads-backfill 모듈이 필요합니다. 미설치 시 이 호출은 무시됩니다.
AdropTheme
앱의 테마를 지정하는 상수 객체입니다.
const AdropTheme = {
light: 'light',
dark: 'dark',
auto: 'auto',
} as const
type AdropTheme = (typeof AdropTheme)[keyof typeof AdropTheme]
Values:
light: 라이트 테마
dark: 다크 테마
auto: 시스템 설정에 따름
BrowserTarget
광고 목적지 URL을 여는 방식을 지정하는 enum입니다.
enum BrowserTarget {
EXTERNAL = 0,
INTERNAL = 1,
}
값:
EXTERNAL: 외부 브라우저에서 URL 열기 (기본값)
INTERNAL: 인앱 브라우저에서 URL 열기
AdropErrorCode
광고 로드 및 표시 시 발생할 수 있는 에러 코드입니다.
enum AdropErrorCode {
network = 'ERROR_CODE_NETWORK',
internal = 'ERROR_CODE_INTERNAL',
initialize = 'ERROR_CODE_INITIALIZE',
invalidUnit = 'ERROR_CODE_INVALID_UNIT',
notTargetCountry = 'ERROR_CODE_NOT_TARGET_COUNTRY',
inactive = 'ERROR_CODE_AD_INACTIVE',
adNoFill = 'ERROR_CODE_AD_NO_FILL',
adDuplicated = 'ERROR_CODE_AD_LOAD_DUPLICATED',
adLoading = 'ERROR_CODE_AD_LOADING',
adEmpty = 'ERROR_CODE_AD_EMPTY',
adShown = 'ERROR_CODE_AD_SHOWN',
adHideForToday = 'ERROR_CODE_AD_HIDE_FOR_TODAY',
adLandscapeUnsupported = 'ERROR_CODE_LANDSCAPE_UNSUPPORTED',
backfillNoFill = 'ERROR_CODE_AD_BACKFILL_NO_FILL',
undefined = 'UNDEFINED',
}
Error Codes:
network: 네트워크 오류
internal: 내부 오류
initialize: SDK 초기화 오류
invalidUnit: 유효하지 않은 광고 유닛
notTargetCountry: 타겟 국가가 아님
inactive: 비활성화된 광고
adNoFill: 광고 없음
adDuplicated: 중복된 광고 로드 요청
adLoading: 광고 로딩 중
adEmpty: 광고가 비어있음
adShown: 이미 표시된 광고
adHideForToday: 오늘 하루 숨김 처리된 광고
adLandscapeUnsupported: 가로 모드 미지원
backfillNoFill: 백필 광고 없음
undefined: 정의되지 않은 오류
AdropBanner
배너 광고를 표시하는 React 컴포넌트입니다.
Props
type AdropBannerProp = {
style: { height: number; width: number | string }
unitId: string
useCustomClick?: boolean
adSize?: { width: number; height: number } | null
autoLoad?: boolean
onAdReceived?: (unitId: string, metadata?: AdropBannerMetadata) => void
onAdImpression?: (unitId: string, metadata?: AdropBannerMetadata) => void
onAdClicked?: (unitId: string, metadata?: AdropBannerMetadata) => void
onAdFailedToReceive?: (unitId: string, errorCode?: any) => void
}
Props:
style (object, required): 배너 스타일 (높이와 너비 포함)
unitId (string, required): 광고 유닛 ID
useCustomClick (boolean, optional): 커스텀 클릭 처리 여부 (기본값: false)
adSize (object, optional): 광고 크기 설정
autoLoad (boolean, optional): 자동 로드 여부 (기본값: true)
onAdReceived (function, optional): 광고 수신 시 호출
onAdImpression (function, optional): 광고 노출 시 호출
onAdClicked (function, optional): 광고 클릭 시 호출
onAdFailedToReceive (function, optional): 광고 수신 실패 시 호출
Methods
load()
광고를 로드합니다. (ref를 통해 호출)
type AdropBannerMetadata = {
creativeId: string
txId: string
campaignId: string
destinationURL: string
browserTarget: BrowserTarget
}
Example:
import { AdropBanner } from 'adrop-ads-react-native'
<AdropBanner
style={{ width: 320, height: 50 }}
unitId="PUBLIC_TEST_UNIT_ID_320_50"
onAdReceived={(unitId, metadata) => console.log('Ad received', metadata)}
onAdFailedToReceive={(unitId, errorCode) => console.log('Ad failed', errorCode)}
/>
AdropNativeAd
네이티브 광고를 관리하는 클래스입니다.
Constructor
constructor(unitId: string, useCustomClick: boolean = false)
Parameters:
unitId (string): 광고 유닛 ID
useCustomClick (boolean, optional): 커스텀 클릭 처리 여부 (기본값: false)
Properties
isLoaded (readonly)
광고 로드 여부를 반환합니다.
unitId (readonly)
광고 유닛 ID를 반환합니다.
requestId (readonly, deprecated)
get requestId(): string // deprecated - 항상 '' 반환
Deprecated. 이 속성은 항상 빈 문자열을 반환하며 향후 버전에서 제거됩니다.
creativeId (readonly)
크리에이티브 ID를 반환합니다.
txId (readonly)
트랜잭션 ID를 반환합니다.
campaignId (readonly)
캠페인 ID를 반환합니다.
useCustomClick (readonly)
get useCustomClick(): boolean
커스텀 클릭 처리 여부를 반환합니다.
isBackfilled (readonly)
get isBackfilled(): boolean
백필 광고 여부를 반환합니다.
isVideoAd (readonly)
비디오 광고 여부를 반환합니다.
browserTarget (readonly)
get browserTarget(): BrowserTarget
브라우저 타겟 설정을 반환합니다.
properties (readonly)
get properties(): AdropNativeProperties
광고 속성을 반환합니다.
listener
listener?: AdropNativeAdListener
광고 이벤트 리스너를 설정합니다.
Methods
load()
광고를 로드합니다.
destroy()
광고 인스턴스를 해제합니다.
AdropNativeProperties
type AdropNativeProperties = {
icon?: string
cover?: string
headline?: string
body?: string
creative?: string
asset?: string
destinationURL?: string
advertiserURL?: string
accountTag?: string
creativeTag?: string
advertiser?: string
callToAction?: string
profile?: AdropNativeProfile
extra?: Record<string, string>
isBackfilled?: boolean
}
AdropNativeProfile
type AdropNativeProfile = {
displayName: string
displayLogo: string
}
AdropNativeAdListener
interface AdropNativeAdListener {
onAdReceived?: (ad: AdropNativeAd) => void
onAdClicked?: (ad: AdropNativeAd) => void
onAdImpression?: (ad: AdropNativeAd) => void
onAdFailedToReceive?: (ad: AdropNativeAd, errorCode?: any) => void
}
Example:
import { AdropNativeAd } from 'adrop-ads-react-native'
const nativeAd = new AdropNativeAd('YOUR_UNIT_ID')
nativeAd.listener = {
onAdReceived: (ad) => console.log('Ad received', ad.properties),
onAdFailedToReceive: (ad, errorCode) => console.log('Ad failed', errorCode),
}
nativeAd.load()
AdropNativeAdView
네이티브 광고를 표시하는 컨테이너 컴포넌트입니다.
Props
type Props = ViewProps & {
nativeAd?: AdropNativeAd
}
Props:
nativeAd (AdropNativeAd, optional): 네이티브 광고 인스턴스
- …ViewProps: React Native View의 모든 props
Example:
import { AdropNativeAdView } from 'adrop-ads-react-native'
<AdropNativeAdView nativeAd={nativeAd}>
{/* 네이티브 광고 뷰들 */}
</AdropNativeAdView>
네이티브 광고 뷰 컴포넌트
네이티브 광고의 각 요소를 표시하는 컴포넌트들입니다. 모든 컴포넌트는 AdropNativeAdView 내부에서 사용해야 합니다.
AdropIconView
광고 아이콘을 표시합니다.
interface IconViewProps extends Omit<ImageProps, 'source'> {
source?: ImageSourcePropType | undefined
}
Example:
import { AdropIconView } from 'adrop-ads-react-native'
<AdropIconView style={{ width: 50, height: 50 }} />
AdropHeadLineView
광고 헤드라인을 표시합니다.
const AdropHeadLineView: React.FC<TextProps>
Example:
import { AdropHeadLineView } from 'adrop-ads-react-native'
<AdropHeadLineView style={{ fontSize: 18, fontWeight: 'bold' }} />
AdropBodyView
광고 본문을 표시합니다.
const AdropBodyView: React.FC<TextProps>
Example:
import { AdropBodyView } from 'adrop-ads-react-native'
<AdropBodyView style={{ fontSize: 14 }} />
광고 미디어(이미지/비디오)를 표시합니다.
const AdropMediaView: React.FC<ViewProps>
Example:
import { AdropMediaView } from 'adrop-ads-react-native'
<AdropMediaView style={{ width: '100%', height: 200 }} />
AdropCallToActionView
광고 CTA(Call To Action) 버튼을 표시합니다.
const AdropCallToActionView: React.FC<TextProps>
Example:
import { AdropCallToActionView } from 'adrop-ads-react-native'
<AdropCallToActionView
style={{
backgroundColor: '#007AFF',
color: 'white',
padding: 10
}}
/>
AdropAdvertiserView
광고주 정보를 표시합니다.
const AdropAdvertiserView: React.FC<TextProps>
Example:
import { AdropAdvertiserView } from 'adrop-ads-react-native'
<AdropAdvertiserView style={{ fontSize: 12, color: 'gray' }} />
AdropProfileLogoView
프로필 로고를 표시합니다.
interface IconViewProps extends Omit<ImageProps, 'source'> {
source?: ImageSourcePropType | undefined
}
Example:
import { AdropProfileLogoView } from 'adrop-ads-react-native'
<AdropProfileLogoView style={{ width: 30, height: 30, borderRadius: 15 }} />
AdropProfileNameView
프로필 이름을 표시합니다.
const AdropProfileNameView: React.FC<TextProps>
Example:
import { AdropProfileNameView } from 'adrop-ads-react-native'
<AdropProfileNameView style={{ fontSize: 14, fontWeight: '600' }} />
AdropInterstitialAd
전면 광고를 관리하는 클래스입니다.
Constructor
constructor(unitId: string)
Parameters:
unitId (string): 광고 유닛 ID
Properties
isLoaded (readonly)
광고 로드 여부를 반환합니다.
unitId (readonly)
광고 유닛 ID를 반환합니다.
creativeId (readonly)
크리에이티브 ID를 반환합니다.
txId (readonly)
트랜잭션 ID를 반환합니다.
campaignId (readonly)
캠페인 ID를 반환합니다.
destinationURL (readonly)
get destinationURL(): string
광고 랜딩 URL을 반환합니다.
browserTarget (readonly)
get browserTarget(): BrowserTarget
브라우저 타겟 설정을 반환합니다.
listener
광고 이벤트 리스너를 설정합니다.
Methods
load()
광고를 로드합니다.
show()
광고를 표시합니다.
close()
광고를 프로그래밍 방식으로 닫습니다.
destroy()
광고 인스턴스를 해제합니다.
Example:
import { AdropInterstitialAd } from 'adrop-ads-react-native'
const interstitialAd = new AdropInterstitialAd('YOUR_UNIT_ID')
interstitialAd.listener = {
onAdReceived: (ad) => {
console.log('Ad loaded')
ad.show()
},
onAdFailedToReceive: (ad, errorCode) => {
console.log('Ad failed to load', errorCode)
},
}
interstitialAd.load()
AdropRewardedAd
보상형 광고를 관리하는 클래스입니다.
Constructor
constructor(unitId: string)
Parameters:
unitId (string): 광고 유닛 ID
Properties
AdropInterstitialAd와 동일한 속성을 가집니다.
Methods
AdropInterstitialAd와 동일한 메서드(load(), show(), close(), destroy())를 가지며, 추가로 다음 메서드를 포함합니다.
setServerSideVerificationOptions()
setServerSideVerificationOptions(options: ServerSideVerificationOptions): void
서버 측 보상 검증을 위한 옵션을 설정합니다. load() 전에 호출하세요.
options.userId (string, optional): 서버 콜백에 전송되는 사용자 식별자
options.customData (string, optional): 서버 콜백에 전송되는 커스텀 데이터
SSV 예시:
import { AdropRewardedAd } from 'adrop-ads-react-native'
const rewardedAd = new AdropRewardedAd('YOUR_UNIT_ID')
// 서버 측 검증 옵션 설정
rewardedAd.setServerSideVerificationOptions({
userId: 'user_12345',
customData: 'extra_info',
})
rewardedAd.listener = {
onAdReceived: (ad) => {
console.log('광고 로드 완료')
ad.show()
},
onAdEarnRewardHandler: (ad, type, amount) => {
console.log(`보상 획득: type=${type}, amount=${amount}`)
},
onAdFailedToReceive: (ad, errorCode) => {
console.log('광고 로드 실패', errorCode)
},
}
rewardedAd.load()
팝업 광고를 관리하는 클래스입니다.
Constructor
constructor(
unitId: string,
colors?: AdropPopupAdColors,
useCustomClick?: boolean
)
Parameters:
unitId (string): 광고 유닛 ID
colors (AdropPopupAdColors, optional): 팝업 색상 커스터마이징
useCustomClick (boolean, optional): 커스텀 클릭 처리 여부 (기본값: false)
Properties
isLoaded (readonly)
광고 로드 여부를 반환합니다.
unitId (readonly)
광고 유닛 ID를 반환합니다.
creativeId (readonly)
크리에이티브 ID를 반환합니다.
txId (readonly)
트랜잭션 ID를 반환합니다.
campaignId (readonly)
캠페인 ID를 반환합니다.
destinationURL (readonly)
get destinationURL(): string
목적지 URL을 반환합니다.
browserTarget (readonly)
get browserTarget(): BrowserTarget
브라우저 타겟 설정을 반환합니다.
listener
광고 이벤트 리스너를 설정합니다.
Methods
load()
광고를 로드합니다.
show()
광고를 표시합니다.
close()
팝업 광고를 닫습니다.
destroy()
광고 인스턴스를 해제합니다.
type AdropPopupAdColors = {
closeTextColor?: string
hideForTodayTextColor?: string
backgroundColor?: string
}
Properties:
closeTextColor (string, optional): 닫기 버튼 텍스트 색상
hideForTodayTextColor (string, optional): ‘오늘 하루 숨기기’ 텍스트 색상
backgroundColor (string, optional): 배경 색상
Example:
import { AdropPopupAd } from 'adrop-ads-react-native'
const popupAd = new AdropPopupAd(
'YOUR_UNIT_ID',
{
closeTextColor: '#000000',
hideForTodayTextColor: '#666666',
backgroundColor: '#FFFFFF',
}
)
popupAd.listener = {
onAdReceived: (ad) => {
console.log('Popup ad loaded')
ad.show()
},
onAdFailedToReceive: (ad, errorCode) => {
console.log('Popup ad failed to load', errorCode)
},
}
popupAd.load()
AdropListener
광고 이벤트를 수신하는 리스너 인터페이스입니다.
type AdropListener = {
onAdReceived?: (ad: AdropAd) => void
onAdClicked?: (ad: AdropAd) => void
onAdImpression?: (ad: AdropAd) => void
onAdFailedToReceive?: (ad: AdropAd, errorCode?: any) => void
onAdDidPresentFullScreen?: (ad: AdropAd) => void
onAdWillPresentFullScreen?: (ad: AdropAd) => void
onAdDidDismissFullScreen?: (ad: AdropAd) => void
onAdWillDismissFullScreen?: (ad: AdropAd) => void
onAdFailedToShowFullScreen?: (ad: AdropAd, errorCode?: any) => void
onAdEarnRewardHandler?: (ad: AdropAd, type: number, amount: number) => void
onAdBackButtonPressed?: (ad: AdropAd) => void
}
Events:
onAdReceived: 광고 수신 완료
onAdClicked: 광고 클릭
onAdImpression: 광고 노출
onAdFailedToReceive: 광고 수신 실패
onAdDidPresentFullScreen: 전면 광고 표시 완료
onAdWillPresentFullScreen: 전면 광고 표시 시작
onAdDidDismissFullScreen: 전면 광고 닫힘 완료
onAdWillDismissFullScreen: 전면 광고 닫힘 시작
onAdFailedToShowFullScreen: 전면 광고 표시 실패
onAdEarnRewardHandler: 보상 획득 (보상형 광고 전용)
onAdBackButtonPressed: 뒤로 가기 버튼 눌림 (Android 전용)
useAdropInterstitialAd
전면 광고를 React Hook으로 관리합니다.
Signature
function useAdropInterstitialAd(unitId: string | null): AdHookReturns & AdStates
Parameters:
unitId (string | null): 광고 유닛 ID
Returns:
load: 광고 로드 함수
show: 광고 표시 함수
reset: 상태 초기화 함수
isBackPressed: 뒤로 가기 버튼 눌림 여부 (Android 전용)
isClicked: 클릭 여부
isClosed: 닫힘 여부
isEarnRewarded: 보상 획득 여부
isLoaded: 로드 여부
isOpened: 열림 여부
isReady: 준비 여부
errorCode: 에러 코드
reward: 보상 정보 ({ type: number, amount: number } 또는 undefined)
browserTarget: 브라우저 타겟 설정 (BrowserTarget 또는 undefined)
Example:
import { useAdropInterstitialAd } from 'adrop-ads-react-native'
function MyComponent() {
const { load, show, isLoaded, errorCode } = useAdropInterstitialAd('YOUR_UNIT_ID')
useEffect(() => {
load()
}, [])
useEffect(() => {
if (isLoaded) {
show()
}
}, [isLoaded])
return <View />
}
useAdropRewardedAd
보상형 광고를 React Hook으로 관리합니다.
Signature
function useAdropRewardedAd(unitId: string | null): AdHookReturns & AdStates
Parameters:
unitId (string | null): 광고 유닛 ID
Returns:
useAdropInterstitialAd와 동일한 반환값을 가지며, 보상형 광고의 핵심 반환값으로 isEarnRewarded(보상 획득 여부)와 reward(보상 정보: { type: number, amount: number })를 포함합니다.
Example:
import { useAdropRewardedAd } from 'adrop-ads-react-native'
function MyComponent() {
const { load, show, isLoaded, isEarnRewarded, reward } = useAdropRewardedAd('YOUR_UNIT_ID')
useEffect(() => {
load()
}, [])
useEffect(() => {
if (isLoaded) {
show()
}
}, [isLoaded])
useEffect(() => {
if (isEarnRewarded && reward) {
console.log(`Reward: type=${reward.type}, amount=${reward.amount}`)
}
}, [isEarnRewarded, reward])
return <View />
}
useAdropWebView
Adrop SDK에 WebView를 등록하는 훅입니다. 뷰 태그 해석과 등록을 자동으로 처리합니다.
Signature
function useAdropWebView(): {
containerRef: React.RefObject<View>
isReady: boolean
onLayout: () => void
}
Returns:
containerRef: WebView를 감싸는 View에 연결할 ref
isReady: WebView 등록 완료 여부
onLayout: 레이아웃 시 등록을 트리거하는 콜백
Example:
import { View } from 'react-native'
import { WebView } from 'react-native-webview'
import { useAdropWebView } from 'adrop-ads-react-native'
function WebViewScreen() {
const { containerRef, isReady, onLayout } = useAdropWebView()
return (
<View ref={containerRef} style={{ flex: 1 }} onLayout={onLayout}>
<WebView
source={isReady ? { uri: 'https://your-website.com' } : { html: '' }}
javaScriptEnabled={true}
thirdPartyCookiesEnabled={true}
mediaPlaybackRequiresUserAction={false}
allowsInlineMediaPlayback={true}
/>
</View>
)
}
AdropMetrics
사용자 속성 및 이벤트를 관리하는 클래스입니다.
setProperty
static setProperty(key: string, value: any): void
사용자 속성을 설정합니다.
Parameters:
key (string): 속성 키
value (any): 속성 값
Example:
import { AdropMetrics, AdropProperties, AdropGender } from 'adrop-ads-react-native'
AdropMetrics.setProperty(AdropProperties.AGE, 25)
AdropMetrics.setProperty(AdropProperties.GENDER, AdropGender.MALE)
AdropMetrics.setProperty(AdropProperties.BIRTH, '1998-01-01')
sendEvent
static sendEvent(name: string, params?: Record<string, any>): void
사용자 행동 이벤트를 전송합니다. 다중 아이템 이벤트를 위한 중첩 items 배열을 지원합니다.
Parameters:
name (string): 이벤트 이름 (1~64자)
params (Record<string, any>, optional): 이벤트 파라미터
Example:
import { AdropMetrics } from 'adrop-ads-react-native'
// 단순 이벤트
AdropMetrics.sendEvent('app_open')
// 파라미터가 있는 이벤트
AdropMetrics.sendEvent('view_item', {
item_id: 'SKU-123',
item_name: 'Widget',
price: 29900,
})
// 다중 아이템 이벤트
AdropMetrics.sendEvent('purchase', {
tx_id: 'TXN-001',
currency: 'KRW',
items: [
{ item_id: 'SKU-001', item_name: '상품A', price: 29900, quantity: 1 },
{ item_id: 'SKU-002', item_name: '상품B', price: 15000, quantity: 2 },
],
})
logEvent (deprecated)
/** @deprecated sendEvent를 사용하세요 */
static logEvent(name: string, params?: Record<string, any>): void
커스텀 이벤트를 로깅합니다. 내부적으로 sendEvent를 호출합니다.
Parameters:
name (string): 이벤트 이름
params (object, optional): 이벤트 파라미터
properties
static properties(): Promise<Record<string, any>>
설정된 모든 속성을 가져옵니다.
Returns:
- Promise<Record<string, any>>: 속성 객체
Example:
import { AdropMetrics } from 'adrop-ads-react-native'
const props = await AdropMetrics.properties()
console.log(props)
AdropProperties
사용자 속성 키를 정의하는 enum입니다.
enum AdropProperties {
AGE = 'AGE',
BIRTH = 'BIRTH',
GENDER = 'GDR',
}
Values:
AGE: 나이
BIRTH: 생년월일
GENDER: 성별
AdropGender
성별을 정의하는 enum입니다.
enum AdropGender {
MALE = 'M',
FEMALE = 'F',
OTHER = 'O',
UNKNOWN = 'U',
}
Values:
MALE: 남성
FEMALE: 여성
OTHER: 기타
UNKNOWN: 알 수 없음
AdropConsent
사용자 동의(GDPR, CCPA 등)를 관리하는 클래스입니다.
requestConsentInfoUpdate
static requestConsentInfoUpdate(): Promise<AdropConsentResult>
동의 정보를 업데이트하고 필요 시 동의 팝업을 표시합니다.
Returns:
Promise<AdropConsentResult>: 동의 결과
Example:
import { AdropConsent } from 'adrop-ads-react-native'
const result = await AdropConsent.requestConsentInfoUpdate()
console.log('Status:', result.status)
console.log('Can request ads:', result.canRequestAds)
console.log('Can show personalized ads:', result.canShowPersonalizedAds)
getConsentStatus
static getConsentStatus(): Promise<AdropConsentStatus>
현재 동의 상태를 가져옵니다.
Returns:
Promise<AdropConsentStatus>: 현재 동의 상태
Example:
const status = await AdropConsent.getConsentStatus()
canRequestAds
static canRequestAds(): Promise<boolean>
현재 동의 상태에 따라 광고를 요청할 수 있는지 확인합니다.
Returns:
Promise<boolean>: 광고 요청 가능 여부
Example:
const canRequest = await AdropConsent.canRequestAds()
if (canRequest) {
// 광고 로드
}
reset
동의 설정을 초기화합니다. 테스트 및 디버깅 목적으로 사용합니다.
Example:
setDebugSettings
static setDebugSettings(geography: AdropConsentDebugGeography): void
동의 플로우 테스트를 위한 디버그 지역을 설정합니다. DEBUG 빌드에서만 동작합니다.
Parameters:
geography (AdropConsentDebugGeography): 시뮬레이션할 지역
Example:
import { AdropConsent, AdropConsentDebugGeography } from 'adrop-ads-react-native'
AdropConsent.setDebugSettings(AdropConsentDebugGeography.EEA)
AdropConsentStatus
사용자 동의 상태를 나타내는 enum입니다.
enum AdropConsentStatus {
UNKNOWN = 0,
REQUIRED = 1,
NOT_REQUIRED = 2,
OBTAINED = 3,
}
Values:
UNKNOWN: 아직 결정되지 않음
REQUIRED: 동의 필요 (팝업 표시 필요)
NOT_REQUIRED: 동의 불필요 (해당하지 않는 지역)
OBTAINED: 동의 획득 완료
AdropConsentResult
동의 정보 업데이트 결과를 나타내는 인터페이스입니다.
interface AdropConsentResult {
status: AdropConsentStatus
canRequestAds: boolean
canShowPersonalizedAds: boolean
error?: string
}
Properties:
status (AdropConsentStatus): 동의 상태
canRequestAds (boolean): 광고 요청 가능 여부
canShowPersonalizedAds (boolean): 개인화 광고 표시 가능 여부
error (string, optional): 에러 메시지 (있는 경우)
AdropConsentDebugGeography
동의 테스트에서 디버그 지역을 지정하는 enum입니다.
enum AdropConsentDebugGeography {
DISABLED = 0,
EEA = 1,
NOT_EEA = 2, // deprecated - OTHER를 사용하세요
REGULATED_US_STATE = 3,
OTHER = 4,
}
Values:
DISABLED: 디버그 설정 없음 (실제 위치 사용)
EEA: 유럽 경제 지역 (GDPR 적용)
NOT_EEA: (deprecated - OTHER를 사용하세요)
REGULATED_US_STATE: 규제 대상 미국 주 (캘리포니아 등, CCPA 적용)
OTHER: 규제 대상이 아닌 지역
Deprecated APIs
다음 API는 deprecated이며 향후 버전에서 제거됩니다. 권장 대안으로 마이그레이션하세요.
AdropAd.destinationUrl
destinationUrl은 deprecated입니다. destinationURL을 사용하세요.
// 변경 전 (deprecated)
const url = ad.destinationUrl
// 변경 후
const url = ad.destinationURL
createIds()는 deprecated입니다. creativeId를 사용하세요.
// 변경 전 (deprecated)
const ids = popupAd.createIds()
// 변경 후
const id = popupAd.creativeId
AdropNativeAd.requestId
AdropNativeAd.requestId는 deprecated이며 항상 빈 문자열을 반환합니다. 이 속성은 향후 버전에서 제거됩니다.
// 변경 전 (deprecated)
const reqId = nativeAd.requestId // 항상 '' 반환
// 변경 후 - requestId 사용을 제거
AdropMetrics.logEvent()
logEvent()는 deprecated입니다. sendEvent()를 사용하세요.
// 변경 전 (deprecated)
AdropMetrics.logEvent('purchase', { item_id: 'SKU-001' })
// 변경 후
AdropMetrics.sendEvent('purchase', { item_id: 'SKU-001' })