1. Insert widget code in the app
You can integrate the widget using native JavaScript. Add the following code to your project, ensuring that the tads script is loaded beforehand:Alternative widget code (async)
Alternative widget code (async)
If you need to speed up page loading, you can use the alternative widget code that includes the Fullscreen banner
async attribute. This setup method requires advanced setup and is recommended for experienced webmasters:- Insert the following script into any place of your HTML document:
- **Insert the following **
<div>where you want to render the ad:
- **Add the following code for the selected format after **
<div>to initialize the widget
2. Add your widget ID
Replace YOUR_WIDGET_ID with the corresponding widget ID you received from your personal account.3. Set a reward (if needed)
If you want to incentivize users to view or click on the ads, add code to theonShowRewardCallback and onClickRewardCallback and onAdsNotFound functions to reward the user for viewing and/or clicking, respectively. You can config your widget using the following parameters
| Parameter | Type | Default | Description | |
|---|---|---|---|---|
| id | required | string | Your widget ID that you received from your personal account | |
| type | required | string | static | Type of your widget. It can be ‘static’ or ‘fullscreen’ |
| debug | optional | boolean | false | Flag which you can use for development mode (it doesn’t collect data in your ads account and doesn’t requests real ads) |
| onShowReward | optional | function | null | Callback which will be called after user watches ad |
| onClickReward | optional | function | null | Callback which will be called after user clicks ad |
| onAdsNotFound | optional | function | null | Callback which will be called if we don’t find ads for user |