2
I’ve created some HTML5 apps for Firefox OS, but I can’t place advertisements to monetize it. Is there any tool for it?
2
I’ve created some HTML5 apps for Firefox OS, but I can’t place advertisements to monetize it. Is there any tool for it?
5
Any advertising network running in a browser will work in Firefox OS. You can use Leadbolt, Inneractive or Google Adsense, among others.
Note: the Hilty member of HTML5 Game Devs Forum placed some reticence:
- Leadbolt - In some versions advertising does not appear
- Inneractive - It takes a long time to approve the account
- Google Adsense - Block advertising discovering you are on Firefox OS
Of course these indications may or may not be true at present, we need to explore each case.
The Inneractive network seems to be the one that will work best, at least with the information available to date.
Mozilla has a library to integrate ads using the Inneractive network that is detailed in the following article:
Published on 31 October 2013 by Louis Stowasser and Robert Nyman.
Download the library from page of the same on Github, where the file will be particularly needed inneractive.js
.
Include the file inneractive.js
in your HTML:
<script src="inneractive.js"></script>
Create a account at Inneractive. Once approved, you can access the console and register your application:
This will generate a unique "App ID" ID that can be found at the bottom of the panel:
The application should have access to the global object Inneractive
. We can create an ad with the function createAd()
:
var myAd = Inneractive.createAd(options);
The object options
allows us to customize the ad. Available options
are the following:
APP_ID
The unique application ID that we have seen how can be obtained in the "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
Full Screen Ad to display normally during game levels or application screens.
REFRESH_RATE
Time in seconds between rotating ads. Minimum is 15 seconds, 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 remains to put it on the screen.
The function addTo()
allows you to place the ad in the DOM tree under a parent node. Normally using the document.body
the question is resolved well:
myAd.addTo(document.body);
This will place the ad under the element <body>
on the page.
Next, we need to position the ad using the function placement()
.
This function takes two arguments concerning 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 stand at the bottom of the screen:
myAd.placement("bottom", "center");
A banner appearing right in the center of the screen:
myAd.placement("center", "center");
If for any reason it is necessary to remove the ad from the screen, we can make use of the function remove()
:
myAd.remove();
Once removed, we can no longer use the ad in question.
It is necessary to make use of the global object Inneractive
and create a new advertisement:
var myAd = Inneractive.createAd();
Only works for Firefox OS or for android and IOS as well?
Browser other questions tagged html5 firefox app
You are not signed in. Login or sign up in order to post.
Can you show what you tried? Did you search anything? If you have more details, please, edit the question to add them.
– brasofilo