Skip to main content
AdXensor integrates cleanly with any React application using the npm package. The SDK is fully compatible with Vite, Create React App, and any other React bundler.

Installation

Basic setup

1

Create a reusable AdSlot component

2

Set your Site ID in the environment

3

Use the component anywhere

React Router — handling navigation

When using React Router, ads need to be re-initialized on each route change. Add an AdXensorProvider at the router root:
Wrap your routes with it:

Initializing once at app level

If you want a single initialization point instead of one per slot, use a top-level effect:

AdSense-style push

If you prefer the AdSense push pattern, use the push() method instead:

Lazy loading per slot

Lazy loading is enabled by default — each slot loads when it enters the viewport. Disable it per slot if needed:
Or disable globally at initialization:

Environment variable reference

TypeScript support

The SDK ships full type declarations. All props and config options are typed:

Troubleshooting

Full troubleshooting guide