Skip to main content

Adrop

Class for initializing the Adrop SDK and managing global settings.

initialize

static initialize(
  production: boolean,
  targetCountries?: string[],
  useInAppBrowser?: boolean
): void
Initializes the Adrop SDK. Parameters:
  • production (boolean): Production mode (true: production, false: development)
  • targetCountries (string[], optional): Target country code array (default: [])
  • useInAppBrowser (boolean, optional): Whether to use in-app browser (default: false)
Example:
import Adrop from 'adrop-ads-react-native'

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

setUID

static setUID(uid: string): void
Sets the unique user identifier. Parameters:
  • uid (string): Unique user identifier
Example:
Adrop.setUID('user123')

setTheme

static setTheme(theme: AdropTheme): void
Sets the app theme. Parameters:
  • theme (AdropTheme): Theme value (‘light’, ‘dark’, ‘auto’)
Example:
import Adrop, { AdropTheme } from 'adrop-ads-react-native'

Adrop.setTheme(AdropTheme.dark)

AdropTheme

Constant object for specifying app theme.
const AdropTheme = {
  light: 'light',
  dark: 'dark',
  auto: 'auto',
} as const

type AdropTheme = typeof AdropTheme[keyof typeof AdropTheme]
Values:
  • light: Light theme
  • dark: Dark theme
  • auto: Follow system setting

AdropErrorCode

Error codes that may occur during ad loading and display.
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',
  undefined = 'UNDEFINED',
}
Error Codes:
  • network: Network error
  • internal: Internal error
  • initialize: SDK initialization error
  • invalidUnit: Invalid ad unit
  • notTargetCountry: Not a target country
  • inactive: Deactivated ad
  • adNoFill: No ad available
  • adDuplicated: Duplicate ad load request
  • adLoading: Ad is loading
  • adEmpty: Ad is empty
  • adShown: Ad already shown
  • adHideForToday: Ad hidden for today
  • adLandscapeUnsupported: Landscape mode not supported
  • undefined: Undefined error

AdropBanner

React component for displaying banner ads.

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): Banner style (including height and width)
  • unitId (string, required): Ad unit ID
  • useCustomClick (boolean, optional): Custom click handling (default: false)
  • adSize (object, optional): Ad size setting
  • autoLoad (boolean, optional): Auto load (default: true)
  • onAdReceived (function, optional): Called on ad reception
  • onAdImpression (function, optional): Called on ad impression
  • onAdClicked (function, optional): Called on ad click
  • onAdFailedToReceive (function, optional): Called on ad reception failure

Methods

load()
load(): void
Loads the ad. (Called via ref)

AdropBannerMetadata

type AdropBannerMetadata = {
  creativeId: string
  txId: string
  campaignId: string
  destinationURL: string
}
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

Class for managing native ads.

Constructor

constructor(unitId: string, useCustomClick: boolean = false)
Parameters:
  • unitId (string): Ad unit ID
  • useCustomClick (boolean, optional): Custom click handling (default: false)

Properties

isLoaded (readonly)
get isLoaded(): boolean
Returns whether the ad is loaded. unitId (readonly)
get unitId(): string
Returns the ad unit ID. creativeId (readonly)
get creativeId(): string
Returns the creative ID. isBackfilled (readonly)
get isBackfilled(): boolean
Returns whether it’s a backfill ad. properties (readonly)
get properties(): AdropNativeProperties
Returns ad properties. listener
listener?: AdropNativeAdListener
Sets the ad event listener.

Methods

load()
load(): void
Loads the ad. destroy()
destroy(): void
Releases the ad instance.

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
}

AdropNativeAdListener

interface AdropNativeAdListener {
  onAdReceived?: (ad: AdropNativeAd) => void
  onAdClicked?: (ad: AdropNativeAd) => void
  onAdImpression?: (ad: AdropNativeAd) => void
  onAdFailedToReceive?: (ad: AdropNativeAd, errorCode?: any) => void
}

AdropInterstitialAd

Class for managing interstitial ads.

Constructor

constructor(unitId: string)
Parameters:
  • unitId (string): Ad unit ID

Properties

isLoaded (readonly)
get isLoaded(): boolean
Returns whether the ad is loaded. unitId (readonly)
get unitId(): string
Returns the ad unit ID. creativeId (readonly)
get creativeId(): string
Returns the creative ID. listener
listener?: AdropListener
Sets the ad event listener.

Methods

load()
load(): void
Loads the ad. show()
show(): void
Shows the ad. destroy()
destroy(): void
Releases the ad instance. 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

Class for managing rewarded ads.

Constructor

constructor(unitId: string)
Parameters:
  • unitId (string): Ad unit ID

Properties

Same properties as AdropInterstitialAd.

Methods

Same methods as AdropInterstitialAd. Example:
import { AdropRewardedAd } from 'adrop-ads-react-native'

const rewardedAd = new AdropRewardedAd('YOUR_UNIT_ID')

rewardedAd.listener = {
  onAdReceived: (ad) => {
    console.log('Ad loaded')
    ad.show()
  },
  onAdEarnRewardHandler: (ad, type, amount) => {
    console.log(`Reward earned: type=${type}, amount=${amount}`)
  },
  onAdFailedToReceive: (ad, errorCode) => {
    console.log('Ad failed to load', errorCode)
  },
}

rewardedAd.load()

AdropPopupAd

Class for managing popup ads.

Constructor

constructor(
  unitId: string,
  colors?: AdropPopupAdColors,
  useCustomClick?: boolean
)
Parameters:
  • unitId (string): Ad unit ID
  • colors (AdropPopupAdColors, optional): Popup color customization
  • useCustomClick (boolean, optional): Custom click handling (default: false)

Methods

load()
load(): void
Loads the ad. show()
show(): void
Shows the ad. close()
close(): void
Closes the popup ad. destroy()
destroy(): void
Releases the ad instance.

AdropPopupAdColors

type AdropPopupAdColors = {
  closeTextColor?: string
  hideForTodayTextColor?: string
  backgroundColor?: string
}
Properties:
  • closeTextColor (string, optional): Close button text color
  • hideForTodayTextColor (string, optional): ‘Hide for today’ text color
  • backgroundColor (string, optional): Background color

AdropListener

Listener interface for receiving ad events.
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
}
Events:
  • onAdReceived: Ad reception complete
  • onAdClicked: Ad clicked
  • onAdImpression: Ad impression
  • onAdFailedToReceive: Ad reception failed
  • onAdDidPresentFullScreen: Full-screen ad presented
  • onAdWillPresentFullScreen: Full-screen ad about to present
  • onAdDidDismissFullScreen: Full-screen ad dismissed
  • onAdWillDismissFullScreen: Full-screen ad about to dismiss
  • onAdFailedToShowFullScreen: Full-screen ad failed to show
  • onAdEarnRewardHandler: Reward earned (rewarded ads only)

useAdropInterstitialAd

Manages interstitial ads with a React Hook.

Signature

function useAdropInterstitialAd(unitId: string | null): AdHookReturns & AdStates
Parameters:
  • unitId (string | null): Ad unit ID
Returns:
  • load: Ad load function
  • show: Ad show function
  • reset: State reset function
  • isClicked: Click status
  • isClosed: Closed status
  • isEarnRewarded: Reward earned status
  • isLoaded: Loaded status
  • isOpened: Opened status
  • isReady: Ready status
  • errorCode: Error code
  • reward: Reward info
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

Manages rewarded ads with a React Hook.

Signature

function useAdropRewardedAd(unitId: string | null): AdHookReturns & AdStates
Parameters:
  • unitId (string | null): Ad unit ID
Returns: Same return values as useAdropInterstitialAd. 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 />
}

AdropMetrics

Class for managing user attributes and events.

setProperty

static setProperty(key: string, value: any): void
Sets a user property. Parameters:
  • key (string): Property key
  • value (any): Property value
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')

logEvent

static logEvent(name: string, params?: Record<string, any>): void
Logs a custom event. Parameters:
  • name (string): Event name
  • params (object, optional): Event parameters
Example:
import { AdropMetrics } from 'adrop-ads-react-native'

AdropMetrics.logEvent('purchase', {
  item_id: 'ITEM_123',
  price: 9.99,
  currency: 'USD',
})

properties

static properties(): Promise<Record<string, any>>
Gets all set properties. Returns:
  • Promise<Record<string, any>>: Property object

AdropProperties

Enum defining user property keys.
enum AdropProperties {
  AGE = 'AGE',
  BIRTH = 'BIRTH',
  GENDER = 'GDR',
}
Values:
  • AGE: Age
  • BIRTH: Birth date
  • GENDER: Gender

AdropGender

Enum defining gender.
enum AdropGender {
  MALE = 'M',
  FEMALE = 'F',
  OTHER = 'O',
  UNKNOWN = 'U',
}
Values:
  • MALE: Male
  • FEMALE: Female
  • OTHER: Other
  • UNKNOWN: Unknown