Any way to display AdMob ads (or other ad provider) in pure JavaScript

后端 未结 4 1282
孤街浪徒
孤街浪徒 2021-01-03 00:19

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?

相关标签:
4条回答
  • 2021-01-03 01:05

    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:

    • PhoneGap Build (see notice below),
    • many ad types, including full screen ads,
    • many ad providers and ad networks (with plugins, see below),
    • serving ads using pure Javascript, with just a few lines of code.

    Plugin supports following ad networks / providers:

    • AdMob,
    • DFP,
    • Facebook Audience Network,
    • Flurry,
    • iAd,
    • InMobi,
    • Millennial Media,
    • MobFox.

    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:

    <gap:plugin name="com.google.cordova.admob" source="plugins.cordova.io" />
    

    with:

    <gap:plugin name="cordova-plugin-admobpro" source="npm"/>
    

    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:

    • docs,
    • GitHub repo,
    • npm repository.
    0 讨论(0)
  • 2021-01-03 01:06

    Check this AdMob's mobile guide.

    I wasn't aware, they had such an API, until I googled it.

    0 讨论(0)
  • 2021-01-03 01:07

    tl;dr Displaying mobile ads using pure Javascript:

    • AdMob: no,
    • mMedia: no,
    • AdSense: no (details),
    • MobFox: yes.

    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.

    0 讨论(0)
  • 2021-01-03 01:25

    You can try InMobi, where you only need 3 lines of Javascript (details).

    0 讨论(0)
提交回复
热议问题