Is there any way to display AdMob ads using only pure JavaScript? Or in any other way, that I can use it directly in PhoneGap application built with PhoneGap Build?
I'm developing mobile apps using PhoneGap. I've seen many solutions and approaches to this problem (like this or this). But since I'm using PhoneGap Build only, I can't use any of it. I've seen AdMob Cordova Plugin, but since it is platform-oriented (currently only available for iOS and Android) and has a lot of Java and SDK in documentation, I'm pretty sure, that I can't use it in app compiled with PhoneGap Build.
If there is no way to get AdMob via JS, then maybe there is another ad provider, which API is reachable entirely from JavaScript?
I've heard that MillenialMedia can display ads using pure JavaScript and even allows external ads providers (like AdMob). So this would be a perfect solution for me. But their page is so poorly organised (a lot of self-marketing bla-bla and no actual links to some API, examples or docs, at least no, when you're not logged in), that I can't confirm that it supports both JavaScript and AdMob. Does someone have any experience with this system and can confirm this?
Check this AdMob's mobile guide.
I wasn't aware, they had such an API, until I googled it.
tl;dr Displaying mobile ads using pure Javascript:
I've been through this for long while and your request (JavaScript code) unfortunately is not available neither with mMedia nor AdMob.
mMedia : They have the following source code types for a mobile web site ( not android app ): ASP, Perl, PHP, JSP5, ruby on rails, and vb.net. to get the source code you need a mobile web site and the mobile web site has to be approved by mMedia then you get live ads and I guess if you used the source code of website in your android app they will have the account suspended because in mMedia every project has to be approved first so they expect their ads are displayed on the project they approved on. And there is no JavaScript code as you requested anyway. mMedia will provide with sdk and instruction to download and install in your app off course live ads would be displayed after their approval and I guess that what you don't want.
AdMob: It is little bit confusing reading about them , because in the past they used to serve ads through JavaScript method intended for mobile web site but after google buying the company they removed this and AdMob doesn't serve mobile website any more and for mobile web site they advise you to use AdSense. what confusing about it that there is still instruction for installing AdMob JavaScript which doesn't exist any more. I saw your links and I guess you where trying to install AdMob for iOS app. I did it for Android app which was straight forward and it was easy using In-App-Advertisements, but the problem was what ever I try it shows on the bottom.
AdSense: they have the JavaScript way but they don't allow you to use it on mobile apps and if they find out they will have your account suspended (details).
for MobFox: they serve ads for mobile web site and the source code types for mobile web site are : JavaScript, PHP, cURL, PHP, fSocket, J2SE 1.4, CGI/Perl and ASP.NET. and for application you have to download the SDK. but there is nothing states in MobFox the you can't use their JavaScript for mobile app and they work like google once you are approved you get Publisher ID and do what ever you want without breaking their terms. Unlike mMedia they have to approve every thing first. And they have the Ad network mediation option for the following companies 4INFO, Aditic (Sofialys), Adfonic, AdMarvel, Admoda, BuzzCity, Hunt, Mobile Ads, InMobi, iVdopia, JumpTap, Komli Mobile (ZestAdz), Lumata Group(bMobile), m-perf, Madvertise, MdotM, MobGold, MobPartner, Mocean, Mojiva, Nexage Exchange, Smaato, TapIt!, Vserv, WapStart, YOC Performance (Mocean Platform), YOC Performance (Ubiyoo Platform)
As far as my research goes the only choice you have for JavaScript code would be with MobFox and you need a way to get the approval so you would have a publisher ID. I had a mobile web contains 4 pages with a little traffic like 20 per day and I got their approval.
There's a powerful AdMob Plugin Pro (free, even though name pro sounds scary), that can be quite easily used in PhoneGap Build. I think, this is the state-of-art solution for this problem, because -- with introduction to npm plugins to PhoneGap Build -- you can now use in pure Javascript PhoneGap Build application all the ad networks, that require you to use their native SDKs.
Key advantages (in context of this question) -- out-of-the-box support for:
Plugin supports following ad networks / providers:
Where first two (in bold) has out-of-the-box support, while all other require use of additional plugins.
There's an article on using this plugin in PhoneGap Build. It is a bit out-dated. You should not use now deprecated
plugins.cordova.io
, but newly supported npm repository. For this, simply replace:with:
Plugin's author offers an extensible documentation which includes API documentation, code examples and example implementations among different development platforms. Really good piece of work!
Resources:
You can try InMobi, where you only need 3 lines of Javascript (details).