WebView Ads allow you to monetize your Cordova app using Google AdSense instead of traditional AdMob ads. This is useful for apps that display web content.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/admob-plus/admob-plus/llms.txt
Use this file to discover all available pages before exploring further.
Installation
In addition toadmob-plus-cordova, install the WebView Ad plugin:
Setup Requirements
WebView Ads require:- Google AdSense account
- AdSense publisher ID (ca-pub-xxxxx)
- WebView configured for ads
WebView Ads are only supported on Android and iOS platforms with properly configured WebView.
WebViewAdOptions
Your AdSense publisher ID (e.g., “ca-pub-1234567890123456”)
Custom AdSense script URL. Defaults to the standard AdSense script.
Set to “1” to request non-personalized ads for GDPR compliance.
Methods
checkIntegration()
Static method to verify WebView integration:addAd()
Add an ad to a specific element:The HTML element where the ad will be inserted
Your AdSense ad slot ID
Ad format (default: “auto”)
Enable full-width responsive ads (default: true)
Custom HTML for the ad unit. If provided, overrides other options.
Usage Examples
Basic WebView Ad
Non-Personalized Ads
For GDPR compliance, request non-personalized ads:Multiple Ads
Add multiple ad units to different elements:Custom HTML
Provide custom AdSense HTML:Verify Integration
Before using WebView Ads in production, verify your setup:Lifecycle Behavior
WebView Ads automatically handle app pause/resume:- On Pause: Preserves the current URL state
- On Resume: Restores the original URL state
Best Practices
Verify WebView integration before deploying to production
Use appropriate ad formats for different screen sections
Request non-personalized ads (npa: ‘1’) for users in GDPR regions
Test ads thoroughly in both Android and iOS WebView
Follow AdSense policies and placement guidelines
Limitations
Troubleshooting
Ads not displaying
Ads not displaying
- Verify your AdSense publisher ID is correct
- Check that ad slots are valid and approved
- Run
WebViewAd.checkIntegration()to verify setup - Ensure the WebView supports AdSense (check console for errors)
Integration check fails
Integration check fails
The WebView may not be properly configured. Ensure:
admob-plus-cordova-webview-adplugin is installed- Platform is Android or iOS (not browser)
- WebView has necessary ad support capabilities
Revenue not tracking
Revenue not tracking
WebView Ads use AdSense for revenue tracking, not AdMob:
- Check your AdSense dashboard for reports
- Verify ads are approved and serving
- Ensure ad placements comply with AdSense policies
See Also
- AdSense Help Center
- AdSense Policies
- Banner Ads - Traditional AdMob banner ads
- Native Ads - AdMob native ads