react-native-google-mobile-ads
    Preparing search index...

    Class CustomNativeAd

    A Google Ad Manager custom native ad (custom native ad format).

    Unlike NativeAd, a custom native ad has no system-defined assets and is not rendered with NativeAdView: read its assets by their exact Ad Manager names and build the UI yourself. You must call recordImpression() when the ad is shown and performClick(assetName) when the user taps it; the SDK does not track views for custom native ads.

    Index
    • Returns the text asset named assetName (exact, case-sensitive), or null when the creative has no such text asset.

      Parameters

      • assetName: string

      Returns string | null

    • Reports a click on assetName to Google Ad Manager. The library never navigates.

      With clickHandling: 'app' the SDK records the click and calls the custom click handler instead of navigating, which emits NativeAdEventType.CUSTOM_CLICK. Navigate however the app prefers once this resolves (deep link, router, in-app browser, …).

      With clickHandling: 'sdk' the SDK navigates to the creative's own click-through.

      Resolves once the SDK has been told about the click. Rejects when the ad is unknown to native (for example after destroy()).

      Parameters

      • assetName: string

      Returns Promise<void>

    • Loads a Google Ad Manager custom native ad.

      import { CustomNativeAd, NativeAdEventType } from 'react-native-google-mobile-ads';

      const ad = await CustomNativeAd.createForAdRequest('/1234/carousel', {
      customFormatIds: ['12345678'],
      });
      const cta = ad.getText('Calltoaction');
      const image = ad.getImage('Secondaryimage');
      ad.recordImpression();
      // on tap: report the click, then navigate however the app prefers
      await ad.performClick('Calltoaction');
      openInAppBrowser(ad.getText('Clickurl'));

      Parameters

      Returns Promise<CustomNativeAd>

    adId: string

    Library registry key. Stable for the lifetime of this ad.

    adUnitId: string
    assets: Readonly<Record<string, CustomNativeAsset>>

    Text and image assets keyed by their exact Ad Manager name.

    availableAssetNames: readonly string[]

    Every asset name the creative carries, verbatim (case-sensitive).

    customFormatId: string

    The Ad Manager custom native format ID that served this ad.

    mediaContent: NativeMediaContent | null

    Video asset description, or null when the creative has no media content.

    responseId: string | null

    SDK response id, or null when the backend does not expose one (classic Android).

    responseInfo: ResponseInfo | null