How to advertise on my Firefox OS app

Asked

Viewed 338 times

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

    Can you show what you tried? Did you search anything? If you have more details, please, edit the question to add them.

1 answer

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:

  1. Leadbolt - In some versions advertising does not appear
  2. Inneractive - It takes a long time to approve the account
  3. 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.


Monetization with Inneractive in Firefox OS

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:

Monetization with Inneractive on Firefox OS

Published on 31 October 2013 by Louis Stowasser and Robert Nyman.

Preparation

  1. Download the library from page of the same on Github, where the file will be particularly needed inneractive.js.

  2. Include the file inneractive.js in your HTML:

    <script src="inneractive.js"></script>
    
  3. Create a account at Inneractive. Once approved, you can access the console and register your application:

    Imagem de Monetization with Inneractive on Firefox OS

    This will generate a unique "App ID" ID that can be found at the bottom of the panel:

    Imagem de Monetization with Inneractive on Firefox OS

Create Ad

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);

Apply Ad

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:

  • Upright: top, bottom or center
  • Horizontal position: left, rightor 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");

Remove Ad

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

You are not signed in. Login or sign up in order to post.