任何的方式来显示AdMob的广告(或其他广告商)的纯JavaScript [英] Any way to display AdMob ads (or other ad provider) in pure JavaScript
问题描述
有没有办法只使用纯JavaScript显示AdMob的广告?或以任何其他方式,我可以直接用内置的PhoneGap PhoneGap的应用程序使用它建立?
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?
我正在开发使用PhoneGap的移动应用程序。我见过许多解决方案和办法,这个问题(如<一个href="http://therockn$c$cr.blogspot.jp/2012/05/cordova-phonegap-and-admob-together-ios.html">this或此)。但是,由于我使用的唯一的PhoneGap构建,我不能使用任何它。我见过 AdMob的科尔多瓦插件的,但既然是平台化的(目前只适用于iOS和Android),并有大量的Java和SDK的文档,我是pretty的肯定,我不能在应用程序与PhoneGap的编译使用它构建。
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.
如果没有办法通过JS获得AdMob的,那么也许还有另外一个广告商,它的API可达完全从JavaScript?
If there is no way to get AdMob via JS, then maybe there is another ad provider, which API is reachable entirely from JavaScript?
我听说 MillenialMedia 可以显示使用纯JavaScript的广告,甚至允许外部广告商(如AdMob的)。因此,这将是对我来说是完美的解决方案。但他们的网页是非常糟糕有组织的(很多自销BLA-BLA并没有实际联系的一些API,例子或文档,至少没有,当你没有登录),我不能确认它支持JavaScript和AdMob的。是否有人有这个系统中的任何经验,可以证实这一点?
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?
推荐答案
有一个强大的 AdMob广告插件临(免费,即使名称的 PRO 的听起来很吓人),可以很容易地使用PhoneGap的构建。我认为,这是国家的最先进的解决方案,对于这个问题,因为 - 用的介绍故宫插件的PhoneGap构建 - 你现在可以使用纯Java脚本的PhoneGap构建应用程序的所有广告网络,需要你用自己的原生软件开发工具包
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构建(见下面的注意),
- 在众多的广告类型,包括全屏广告,
- 在许多广告商和广告网络(使用插件,见下文),
- 在服务使用纯Javascript中,用code短短的几行广告。
- 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的受众网络,
- 乱舞,
- 的iAd,
- 的InMobi,
- 在千禧传媒
- MobFox。
- 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.
有文章使用这个插件中的PhoneGap构建。这是一个有点过时。你不应该使用pcated现在去$ P $ plugins.cordova.io
,但新支持的故宫库。对于这一点,只需更换:
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" />
与
<gap:plugin name="cordova-plugin-admobpro" source="npm"/>
插件的作者提供了一个扩展文档其中包括API文档,$ C $在不同的开发平台上的C例子和示例实现。真正的好作品!
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!
资源:
- docs,
- GitHub repo,
- npm repository.
这篇关于任何的方式来显示AdMob的广告(或其他广告商)的纯JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!