I created some HTML5 applications for Firefox OS, but I can not place advertisements to monetize it. Is there any tool for this?
I created some HTML5 applications for Firefox OS, but I can not place advertisements to monetize it. Is there any tool for this?
Any ad network that works in a browser will work in Firefox OS. You can use Leadbolt , Inneractive or Google Adsense , among others.
Note: hilty member of HTML5 Game Devs Forum put some ellipsis:
Leadbolt - In some versions, advertising does not appear Inneractive - Take a long time to approve the account Google Adsense - Block Advertising from Find Out What's In Firefox OS
Of course these indications may or may not be true today, you need to explore each case.
The Inneractive network seems to be the one that will work the best, at least with the information available to date.
Mozilla has a library for integrating ads using the Inneractive network, which is detailed in the following article:
Posted on 31 October 2013 by Louis Stowasser and Robert Nyman.
Unload the library from the Github page where you will particularly need the file inneractive.js
.
Include the inneractive.js
file in your HTML:
<script src="inneractive.js"></script>
Create a account in Inneractive . Once approved, you can access the console and register your application:
Thiswillgenerateaunique"App ID" ID that can be found at the bottom of the panel:
TheapplicationmusthaveaccesstotheglobalobjectInneractive
.WecanthuscreateanadwiththefunctioncreateAd()
:
varmyAd=Inneractive.createAd(options);
Theoptions
objectallowsustocustomizethead.Theavailableoptionsareasfollows:
APP_ID
TheuniqueapplicationIDwe'vealreadyseenascanbeobtainedfromthe"Preparation" part of this answer.
TYPE
It can be one of three types of ads:
Banner
Small ad that is usually constant at the bottom of the screen.
Rectangle
Medium-sized ad that is usually centered in the middle of the screen.
Interstitial
Display Full Screen to display normally during game levels or application screens.
REFRESH_RATE
Time in seconds between rotating ads. Minimum is 15 seconds, the default is 30.
Example making use of options:
var options = {
TYPE: "Banner",
REFRESH_RATE: 18,
APP_ID: "Test_App_ID"
};
var myAd = Inneractive.createAd(options);
Once the ad has been created with the desired options, it is not necessary to place the ad on the screen.
The addTo()
function lets you place the ad in the DOM tree under a parent node. Usually using document.body
solves the issue well:
myAd.addTo(document.body);
This will place the ad under the <body>
element on the page.
Next, we need to position the ad by using the placement()
function.
This function receives two arguments regarding the vertical position and horizontal position where we have the following options:
top
, bottom
or center
left
, right
or center
Examples:
For a banner to be at the bottom of the screen:
myAd.placement("bottom", "center");
A banner appears exactly in the center of the screen:
myAd.placement ("center", "center");
If for any reason you need to remove the ad from the screen, we can make use of the remove()
function:
myAd.remove();
Once removed, we can not reuse the ad in question.
It is necessary to make use of the global object Inneractive
and create a new ad:
var myAd = Inneractive.createAd();