Skip to main content

Overview

Integrate Adrop Web SDK into your React project to display banner ads and native ads.

Supported Ad Formats

  • Banner Ads
  • Native Ads (with custom UI support)

Requirements

  • React 16.8 or higher
  • Node.js 14 or higher

Installation

Install the SDK using NPM or Yarn.

Initialization

Initialize the SDK at your app’s entry point (main.tsx or index.tsx). The SDK works as a singleton, so you only need to initialize it once.
main.tsx

Initialization Options (AdropConfig)

string
required
App ID issued from Ad Control Console
string
User identifier (used for targeting)
string
API authentication key (required for updating user properties)
boolean
default:false
Enable debug logging
'responsive' | 'fixed'
default:"responsive"
Publisher-wide backfill rendering mode. Per-slot overrides take precedence. See the Backfill Rendering Mode guide for details. (SDK 1.2.3+)
Set debug: false in production environments.

Instance Access

After initialization, you can access the SDK from anywhere using Adrop.instance().

Dynamic Configuration Updates

You can change settings at runtime, such as setting a user ID after login.
For targeted ads to work properly, set uid before entering the ad placement.

WebView Setup (For Backfill Ads)

If you serve this site inside your app’s in-app WebView, we recommend also adopting the Adrop SDK for the wrapping platform (Android · iOS · Flutter · React Native) and calling Adrop.registerWebView(). Google states that this registration makes app signals available to ad tags inside the WebView, helping to improve monetization. Additionally, default WebView settings are not optimized for ads — follow each platform guide’s WebView configuration (JavaScript, DOM storage, third-party cookies, media autoplay). No extra setup is needed for browser (mobile or desktop) traffic.

Android Setup

Register a WebView on Android

iOS Setup

Register a WKWebView on iOS

Flutter Setup

Register a WebView in Flutter

React Native Setup

Register a WebView in React Native

Table of Contents

Banner Ads

Implement banner ads

Native Ads

Implement native ads

Targeting

Audience/Contextual targeting

Reference

Classes, interfaces, constants

Examples

React, CDN example code