# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.webtonative.com/javascript-apis/admob-old.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
