> For the complete documentation index, see [llms.txt](https://docs.webtonative.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.webtonative.com/javascript-apis/admob-old.md).

# AdMob

{% hint style="info" %}

<pre data-overflow="wrap"><code>You'll need to import the javascript file in your website before starting from this <a data-footnote-ref href="#user-content-fn-1">link</a>.
</code></pre>

{% endhint %}

{% tabs %}
{% tab title="Plain Javascript" %}

```
const {
    bannerAd,
    fullScreenAd,
    rewardsAd,
} = WTN.AdMob;

bannerAd({
  adId:"ca-app-pub-3940256099942544/6300978111"
})

fullScreenAd({
  adId:"ca-app-pub-3940256099942544/1033173712",
  fullScreenAdCallback: (value) => {
    console.log(value)
  }
})

rewardsAd({
  adId:"ca-app-pub-3940256099942544/5224354917",
  rewardsAdCallback: (value) => {
    console.log(value)
  }
})


/** Example for fullScreenAd
  fullScreenAd({
    adId:"ca-app-pub-3940256099942544/1033173712",
    fullScreenAdCallback: (value) => {
      console.log(value);
      try{
        let response = JSON.parse(value);
        let status = response.status;
        let error = response.error;
        let additionalData = response.additionalData;
        let rewardsData = response.rewardsData;
        // Your code to handle the values accordingly.
      }
      catch(e){
        console.log("JSON parse error : ",e);
      }
    }
  })
*/
```

{% endtab %}

{% tab title=" ES5+" %}

```
import {
  bannerAd,
  fullScreenAd,
  rewardsAd,
} from "webtonative/AdMob";

bannerAd({
  adId:"ca-app-pub-3940256099942544/6300978111"
})

fullScreenAd({
  adId:"ca-app-pub-3940256099942544/1033173712",
  fullScreenAdCallback: (value) => {
    console.log(value)
  }
})

rewardsAd({
  adId:"ca-app-pub-3940256099942544/5224354917",
  rewardsAdCallback: (value) => {
    console.log(value)
  }
})


/** Example for fullScreenAd
  fullScreenAd({
    adId:"ca-app-pub-3940256099942544/1033173712",
    fullScreenAdCallback: (value) => {
      console.log(value);
      try{
        let response = JSON.parse(value);
        let status = response.status;
        let error = response.error;
        let additionalData = response.additionalData;
        let rewardsData = response.rewardsData;
        // Your code to handle the values accordingly.
      }
      catch(e){
        console.log("JSON parse error : ",e);
      }
    }
  })
*/
```

{% endtab %}
{% endtabs %}

**bannerAd, fullScreenAd and rewardsAd** can be called for displaying the particular ad.

* **fullScreenAdCallback and rewardsAdCallback** - This callback function is called on successfully displaying the ad, when it is dismissed or in case of any error with values like **status, error, additionalData and rewardsData.**
* **status -** Values for status will be&#x20;
  * "success" - When ad is show successfully.
  * "adDismissed" - When ad is dismissed by user.
  * "adLoadFailure" - When ad could not be loaded.
  * "adError" - When ad could not be loaded on full screen.
  * "rewardSuccess" - When user completes the reward ad.

#### AdMob Ad Load Success/Failure Callback (Webtonative Configuration)

`window.admobLoadCallback` is called to report the success or failure of AdMob ads loaded via Webtonative configuration.

\*Taken Live on 19/12/25

[^1]: <https://docs.webtonative.com/javascript-apis/getting-started>
