メインコンテンツへスキップ

Adrop

Adrop SDKを初期化し、グローバル設定を管理するクラス。

initialize

static initialize(
  production: boolean,
  targetCountries?: string[],
  useInAppBrowser?: boolean
): void
Adrop SDKを初期化します。 パラメータ:
  • production (boolean):本番モード(true:本番、false:開発)
  • targetCountries (string[], optional):ターゲット国コード配列(デフォルト:[])
  • useInAppBrowser (boolean, optional):アプリ内ブラウザを使用するかどうか(デフォルト:false)
例:
import { Adrop } from 'adrop-ads-react-native'

Adrop.initialize(true, ['KR', 'US'], false)

setUID

static setUID(uid: string): void
一意のユーザー識別子を設定します。 パラメータ:
  • uid (string):一意のユーザー識別子
例:
Adrop.setUID('user123')

setTheme

static setTheme(theme: AdropTheme): void
アプリのテーマを設定します。 パラメータ:
  • theme (AdropTheme):テーマ値(‘light’, ‘dark’, ‘auto’)
例:
import { Adrop, AdropTheme } from 'adrop-ads-react-native'

Adrop.setTheme(AdropTheme.dark)

registerWebView

static registerWebView(viewTag: number): Promise<void>
バックフィル広告サポートのためにネイティブWebViewを登録します。WebViewがマウントされた後に呼び出してください。 パラメータ:
  • viewTag (number): WebViewをラップするViewからfindNodeHandle()で取得したネイティブビュータグ
例:
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]
値:
  • 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',
}
エラーコード:
  • 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):広告受信失敗時に呼び出し

メソッド

load()
load(): void
広告をロードします。(refを介して呼び出し)

AdropBannerMetadata

type AdropBannerMetadata = {
  creativeId: string
  txId: string
  campaignId: string
  destinationURL: string
  browserTarget: BrowserTarget
}
例:
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('広告を受信', metadata)}
  onAdFailedToReceive={(unitId, errorCode) => console.log('広告失敗', errorCode)}
/>

AdropNativeAd

ネイティブ広告を管理するクラス。

コンストラクタ

constructor(unitId: string, useCustomClick: boolean = false)
パラメータ:
  • unitId (string):広告ユニットID
  • useCustomClick (boolean, optional):カスタムクリック処理(デフォルト:false)

プロパティ

isLoaded (readonly)
get isLoaded(): boolean
広告がロードされているかどうかを返します。 unitId (readonly)
get unitId(): string
広告ユニットIDを返します。 requestId (readonly, deprecated)
get requestId(): string // deprecated - 常に '' を返す
非推奨。 このプロパティは常に空文字列を返し、将来のバージョンで削除されます。 creativeId (readonly)
get creativeId(): string
クリエイティブIDを返します。 txId (readonly)
get txId(): string
トランザクションIDを返します。 campaignId (readonly)
get campaignId(): string
キャンペーンIDを返します。 useCustomClick (readonly)
get useCustomClick(): boolean
カスタムクリック処理が有効かどうかを返します。 isBackfilled (readonly)
get isBackfilled(): boolean
バックフィル広告かどうかを返します。 isVideoAd (readonly)
get isVideoAd(): boolean
動画広告かどうかを返します。 browserTarget (readonly)
get browserTarget(): BrowserTarget
ブラウザターゲット設定を返します。 properties (readonly)
get properties(): AdropNativeProperties
広告プロパティを返します。 listener
listener?: AdropNativeAdListener
広告イベントリスナーを設定します。

メソッド

load()
load(): void
広告をロードします。 destroy()
destroy(): void
広告インスタンスを解放します。

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
}

AdropNativeAdView

ネイティブ広告を表示するコンテナコンポーネント。

Props

type Props = ViewProps & {
  nativeAd?: AdropNativeAd
}
Props:
  • nativeAd (AdropNativeAd, optional):ネイティブ広告インスタンス
  • …ViewProps:React Native Viewのすべてのprops
例:
import { AdropNativeAdView } from 'adrop-ads-react-native'

<AdropNativeAdView nativeAd={nativeAd}>
  {/* ネイティブ広告ビュー */}
</AdropNativeAdView>

ネイティブ広告ビューコンポーネント

ネイティブ広告の各要素を表示するコンポーネント。すべてのコンポーネントはAdropNativeAdView内で使用する必要があります。

AdropIconView

広告アイコンを表示します。
interface IconViewProps extends Omit<ImageProps, 'source'> {
  source?: ImageSourcePropType | undefined
}
例:
import { AdropIconView } from 'adrop-ads-react-native'

<AdropIconView style={{ width: 50, height: 50 }} />

AdropHeadLineView

広告ヘッドラインを表示します。
const AdropHeadLineView: React.FC<TextProps>
例:
import { AdropHeadLineView } from 'adrop-ads-react-native'

<AdropHeadLineView style={{ fontSize: 18, fontWeight: 'bold' }} />

AdropBodyView

広告本文を表示します。
const AdropBodyView: React.FC<TextProps>
例:
import { AdropBodyView } from 'adrop-ads-react-native'

<AdropBodyView style={{ fontSize: 14 }} />

AdropMediaView

広告メディア(画像/動画)を表示します。
const AdropMediaView: React.FC<ViewProps>
例:
import { AdropMediaView } from 'adrop-ads-react-native'

<AdropMediaView style={{ width: '100%', height: 200 }} />

AdropCallToActionView

広告CTA(Call To Action)ボタンを表示します。
const AdropCallToActionView: React.FC<TextProps>
例:
import { AdropCallToActionView } from 'adrop-ads-react-native'

<AdropCallToActionView
  style={{
    backgroundColor: '#007AFF',
    color: 'white',
    padding: 10
  }}
/>

AdropAdvertiserView

広告主情報を表示します。
const AdropAdvertiserView: React.FC<TextProps>
例:
import { AdropAdvertiserView } from 'adrop-ads-react-native'

<AdropAdvertiserView style={{ fontSize: 12, color: 'gray' }} />

AdropProfileLogoView

プロフィールロゴを表示します。
interface IconViewProps extends Omit<ImageProps, 'source'> {
  source?: ImageSourcePropType | undefined
}
例:
import { AdropProfileLogoView } from 'adrop-ads-react-native'

<AdropProfileLogoView style={{ width: 30, height: 30, borderRadius: 15 }} />

AdropProfileNameView

プロフィール名を表示します。
const AdropProfileNameView: React.FC<TextProps>
例:
import { AdropProfileNameView } from 'adrop-ads-react-native'

<AdropProfileNameView style={{ fontSize: 14, fontWeight: '600' }} />

AdropInterstitialAd

インタースティシャル広告を管理するクラス。

コンストラクタ

constructor(unitId: string)
パラメータ:
  • unitId (string):広告ユニットID

プロパティ

isLoaded (readonly)
get isLoaded(): boolean
広告がロードされているかどうかを返します。 unitId (readonly)
get unitId(): string
広告ユニットIDを返します。 creativeId (readonly)
get creativeId(): string
クリエイティブIDを返します。 txId (readonly)
get txId(): string
トランザクションIDを返します。 campaignId (readonly)
get campaignId(): string
キャンペーンIDを返します。 destinationURL (readonly)
get destinationURL(): string
リンク先URLを返します。 browserTarget (readonly)
get browserTarget(): BrowserTarget
ブラウザターゲット設定を返します。 listener
listener?: AdropListener
広告イベントリスナーを設定します。

メソッド

load()
load(): void
広告をロードします。 show()
show(): void
広告を表示します。 close()
close(): void
広告をプログラムで閉じます。 destroy()
destroy(): void
広告インスタンスを解放します。 例:
import { AdropInterstitialAd } from 'adrop-ads-react-native'

const interstitialAd = new AdropInterstitialAd('YOUR_UNIT_ID')

interstitialAd.listener = {
  onAdReceived: (ad) => {
    console.log('広告がロードされました')
    ad.show()
  },
  onAdFailedToReceive: (ad, errorCode) => {
    console.log('広告のロードに失敗しました', errorCode)
  },
}

interstitialAd.load()

AdropRewardedAd

リワード広告を管理するクラス。

コンストラクタ

constructor(unitId: string)
パラメータ:
  • unitId (string):広告ユニットID

プロパティ

AdropInterstitialAdと同じプロパティ。

メソッド

load()
load(): void
広告をロードします。 show()
show(): void
広告を表示します。 close()
close(): void
広告をプログラムで閉じます。 destroy()
destroy(): void
広告インスタンスを解放します。 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()

AdropPopupAd

ポップアップ広告を管理するクラス。

コンストラクタ

constructor(
  unitId: string,
  colors?: AdropPopupAdColors,
  useCustomClick?: boolean
)
パラメータ:
  • unitId (string):広告ユニットID
  • colors (AdropPopupAdColors, optional):ポップアップ色カスタマイズ
  • useCustomClick (boolean, optional):カスタムクリック処理(デフォルト:false)

プロパティ

isLoaded (readonly)
get isLoaded(): boolean
広告がロードされているかどうかを返します。 unitId (readonly)
get unitId(): string
広告ユニットIDを返します。 creativeId (readonly)
get creativeId(): string
クリエイティブIDを返します。 txId (readonly)
get txId(): string
トランザクションIDを返します。 campaignId (readonly)
get campaignId(): string
キャンペーンIDを返します。 destinationURL (readonly)
get destinationURL(): string
リンク先URLを返します。 browserTarget (readonly)
get browserTarget(): BrowserTarget
ブラウザターゲット設定を返します。 listener
listener?: AdropListener
広告イベントリスナーを設定します。

メソッド

load()
load(): void
広告をロードします。 show()
show(): void
広告を表示します。 close()
close(): void
ポップアップ広告を閉じます。 destroy()
destroy(): void
広告インスタンスを解放します。

AdropPopupAdColors

type AdropPopupAdColors = {
  closeTextColor?: string
  hideForTodayTextColor?: string
  backgroundColor?: string
}
プロパティ:
  • closeTextColor (string, optional):閉じるボタンのテキスト色
  • hideForTodayTextColor (string, optional):「今日は表示しない」のテキスト色
  • backgroundColor (string, optional):背景色

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
}
イベント:
  • onAdReceived:広告受信完了
  • onAdClicked:広告クリック
  • onAdImpression:広告インプレッション
  • onAdFailedToReceive:広告受信失敗
  • onAdDidPresentFullScreen:フルスクリーン広告が表示された
  • onAdWillPresentFullScreen:フルスクリーン広告が表示される
  • onAdDidDismissFullScreen:フルスクリーン広告が閉じられた
  • onAdWillDismissFullScreen:フルスクリーン広告が閉じられる
  • onAdFailedToShowFullScreen:フルスクリーン広告の表示に失敗
  • onAdEarnRewardHandler:リワード獲得(リワード広告のみ)
  • onAdBackButtonPressed:戻るボタン押下(Androidのみ)

useAdropInterstitialAd

React Hookでインタースティシャル広告を管理します。

シグネチャ

function useAdropInterstitialAd(unitId: string | null): AdHookReturns & AdStates
パラメータ:
  • unitId (string | null):広告ユニットID
戻り値:
  • load:広告ロード関数
  • show:広告表示関数
  • reset:状態リセット関数
  • isBackPressed:戻るボタン押下状態(Androidのみ)
  • isClicked:クリック状態
  • isClosed:閉じた状態
  • isEarnRewarded:ユーザーがリワードを獲得したかどうか
  • isLoaded:ロード状態
  • isOpened:表示状態
  • isReady:準備完了状態
  • errorCode:エラーコード
  • reward:リワード情報({ type: number, amount: number } または undefined
  • browserTarget:ブラウザターゲット設定(BrowserTarget または undefined
例:
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でリワード広告を管理します。

シグネチャ

function useAdropRewardedAd(unitId: string | null): AdHookReturns & AdStates
パラメータ:
  • unitId (string | null):広告ユニットID
戻り値:
  • load:広告ロード関数
  • show:広告表示関数
  • reset:状態リセット関数
  • isBackPressed:戻るボタン押下状態(Androidのみ)
  • isClicked:クリック状態
  • isClosed:閉じた状態
  • isEarnRewarded:ユーザーがリワードを獲得したかどうか
  • isLoaded:ロード状態
  • isOpened:表示状態
  • isReady:準備完了状態
  • errorCode:エラーコード
  • reward:リワード情報({ type: number, amount: number } または undefined
  • browserTarget:ブラウザターゲット設定(BrowserTarget または undefined
例:
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(`リワード: type=${reward.type}, amount=${reward.amount}`)
    }
  }, [isEarnRewarded, reward])

  return <View />
}

useAdropWebView

Adrop SDKにWebViewを登録するフックです。ビュータグの解決と登録を自動的に処理します。

シグネチャ

function useAdropWebView(): {
  containerRef: React.RefObject<View>
  isReady: boolean
  onLayout: () => void
}
戻り値:
  • containerRef: WebViewをラップするViewに接続するref
  • isReady: WebViewの登録完了状態
  • onLayout: レイアウト時に登録をトリガーするコールバック
例:
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
ユーザープロパティを設定します。 パラメータ:
  • key (string):プロパティキー
  • value (any):プロパティ値
例:
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配列をサポートします。 パラメータ:
  • name (string):イベント名(1〜64文字)
  • params (Record<string, any>, optional):イベントパラメータ
例:
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: 'Product A', price: 29900, quantity: 1 },
    { item_id: 'SKU-002', item_name: 'Product B', price: 15000, quantity: 2 },
  ],
})

logEvent (deprecated)

/** @deprecated sendEventを使用してください */
static logEvent(name: string, params?: Record<string, any>): void
カスタムイベントを記録します。内部的にsendEventを呼び出します。 パラメータ:
  • name (string):イベント名
  • params (object, optional):イベントパラメータ

properties

static properties(): Promise<Record<string, any>>
設定されたすべてのプロパティを取得します。 戻り値:
  • Promise<Record<string, any>>:プロパティオブジェクト

AdropProperties

ユーザープロパティキーを定義する列挙型。
enum AdropProperties {
  AGE = 'AGE',
  BIRTH = 'BIRTH',
  GENDER = 'GDR',
}
値:
  • AGE:年齢
  • BIRTH:生年月日
  • GENDER:性別

AdropGender

性別を定義する列挙型。
enum AdropGender {
  MALE = 'M',
  FEMALE = 'F',
  OTHER = 'O',
  UNKNOWN = 'U',
}
値:
  • MALE:男性
  • FEMALE:女性
  • OTHER:その他
  • UNKNOWN:不明

AdropConsent

ユーザー同意(GDPR、CCPAなど)を管理するクラス。

requestConsentInfoUpdate

static requestConsentInfoUpdate(): Promise<AdropConsentResult>
同意情報を更新し、必要に応じて同意ポップアップを表示します。 戻り値:
  • Promise<AdropConsentResult>:同意結果
例:
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>
現在の同意ステータスを取得します。 戻り値:
  • Promise<AdropConsentStatus>:現在の同意ステータス
例:
const status = await AdropConsent.getConsentStatus()

canRequestAds

static canRequestAds(): Promise<boolean>
現在の同意に基づいて広告をリクエストできるかどうかを確認します。 戻り値:
  • Promise<boolean>:広告をリクエストできるかどうか
例:
const canRequest = await AdropConsent.canRequestAds()
if (canRequest) {
  // 広告をロード
}

reset

static reset(): void
同意設定をリセットします。テストおよびデバッグ目的で使用します。 例:
AdropConsent.reset()

setDebugSettings

static setDebugSettings(geography: AdropConsentDebugGeography): void
同意フローテスト用のデバッグ地域を設定します。DEBUGビルドでのみ動作します。 パラメータ:
  • geography (AdropConsentDebugGeography):シミュレートする地域
例:
import { AdropConsent, AdropConsentDebugGeography } from 'adrop-ads-react-native'

AdropConsent.setDebugSettings(AdropConsentDebugGeography.EEA)

AdropConsentStatus

ユーザー同意ステータスを表す列挙型。
enum AdropConsentStatus {
  UNKNOWN = 0,
  REQUIRED = 1,
  NOT_REQUIRED = 2,
  OBTAINED = 3,
}
値:
  • UNKNOWN:未確定
  • REQUIRED:同意が必要(ポップアップ表示が必要)
  • NOT_REQUIRED:同意不要(該当しない地域)
  • OBTAINED:同意取得済み

AdropConsentResult

同意情報更新の結果を表すインターフェース。
interface AdropConsentResult {
  status: AdropConsentStatus
  canRequestAds: boolean
  canShowPersonalizedAds: boolean
  error?: string
}
プロパティ:
  • status (AdropConsentStatus):同意ステータス
  • canRequestAds (boolean):広告をリクエストできるかどうか
  • canShowPersonalizedAds (boolean):パーソナライズ広告を表示できるかどうか
  • error (string, optional):エラーメッセージ(ある場合)

AdropConsentDebugGeography

同意テストでデバッグ地域を指定するための列挙型。
enum AdropConsentDebugGeography {
  DISABLED = 0,
  EEA = 1,
  NOT_EEA = 2, // deprecated - 代わりに OTHER を使用
  REGULATED_US_STATE = 3,
  OTHER = 4,
}
値:
  • DISABLED:デバッグ設定なし(実際の場所を使用)
  • EEA:欧州経済領域(GDPRが適用)
  • NOT_EEA(非推奨 - 代わりに OTHER を使用)
  • REGULATED_US_STATE:規制対象の米国州(カリフォルニアなど、CCPAが適用)
  • OTHER:規制対象外の地域

非推奨API

以下のAPIは非推奨であり、将来のバージョンで削除されます。推奨される代替APIに移行してください。

AdropAd.destinationUrl

destinationUrlは非推奨です。代わりにdestinationURLを使用してください。
// 変更前(非推奨)
const url = ad.destinationUrl

// 変更後
const url = ad.destinationURL

AdropPopupAd.createIds()

createIds()は非推奨です。代わりにcreativeIdを使用してください。
// 変更前(非推奨)
const ids = popupAd.createIds()

// 変更後
const id = popupAd.creativeId

AdropNativeAd.requestId

AdropNativeAd.requestIdは非推奨で、常に空文字列を返します。このプロパティは将来のバージョンで削除されます。
// 変更前(非推奨)
const reqId = nativeAd.requestId // 常に '' を返す

// 変更後 - requestId の使用を削除

AdropMetrics.logEvent()

logEvent()は非推奨です。代わりにsendEvent()を使用してください。
// 変更前(非推奨)
AdropMetrics.logEvent('purchase', { item_id: 'SKU-001' })

// 変更後
AdropMetrics.sendEvent('purchase', { item_id: 'SKU-001' })