Adding "Ads" to a Game

Where can I get more information about adding ad’s to my game?   I looked at the information on plug ins and I’m not sure of what I really need…there is a lot of information.

I am looking for a way to have an ad on the screen while the game is playing that does not interrupt the player and a way to do in app purchases such as buy additional game lives or one time items that help the player complete a level.

Any suggestions for which plug in’s are best for IOS?

How much room do I need to save on the screen?

I appreciate any and all guidance.

Thanks,

Lori

Hi Lori

There are generally two types of ads provided:  banner ads and interstitial ads.  Banner ads are small, generally around 50 pixels high that can usually be placed at the top or the bottom of the screen.  In many games, banner ads are ineffective.  Imagine a fast paced game where the player is constantly doing something.  They will never interact with the ad and if they do, it breaks the flow of the game.  But people use them anyway.  Interstitial ads are full screen ads that are designed to run “in between” other screens, for instance after your menu screen but before the game actually starts.  These full screen ads earn more money but you have fewer of them.

Next, there are multiple ad providers that you can use.  They all have their pros and cons.  Some people will use multiple providers to make sure they are always getting ads.  Many ad providers don’t have the inventory (sold ads) to always have ads for you.  It can take time for your ad to earn enough reputation to get their  available inventory.  Because of that several developers will support multiple ad providers to try and make sure they get the ads needed to always show them.

All Corona ads are done through plugins and most are available to Starter accounts.  Occasionally there will be an update that requires a daily build to implement, but usually the next public release catches up.  This will involve adding some code to your build.settings for each plugin you need.

Each ad vendor will require you to setup information with them including how to pay out to you, etc.  They all will be different.  You will create an entry for your app and in many cases you may have two or more per app (one iOS, on Android for instance).  You will need the ID number they give you (and they all call them something else). 

In your Corona SDK code you will require the plugin in, then call

ad.init()

with some parameters and some listener function and the ID you got for the ad provider.  after that you can call ad.show() to show the ad (it needs parameters too).

As far as In App Purchases, you will need to be a Basic, Pro or Enterprise subscriber to use IAP.  Google’s IAP v3 is implemented as a plugin but Apple’s IAP is built into the core with the store.* API. 

Rob

Don’t forget there are video ads too! You use them in a similar way to interstitial ads, and show them during a “break” in the gameplay. The general Corona ads plugin supports a video provider: Vungle. Here’s an example:

local function adListener(e) if e.isError then print("an error happened :-(") elseif e.type == "adStart" then print("ad has started playing") elseif e.type == "adView" then if e.isCompletedView then print("user watched enough video to count as being watched") else print("user quit out of ad early") end elseif e.type == "adEnd" then print("ad has closed") end end local ads = require "ads" ads.init( "vungle", "your\_App\_ID", adListener ) if ads.isAdAvailable then if ads.isAdAvailable() then ads.show( "incentivized", { isBackButtonEnabled = false, isCloseShown = false } ) else --try another ad provider end else --try another ad provider end

I use ads.isAdAvailable() to check whether an ad is available before I attempt to show it. Most ad plugins will have a similar function. Before I call it, I actually check that the function itself exists which is why there is this line without the parentheses:

if ads.isAdAvailable then

Not sure if that’s still needed, but I had issues where I would call the function but it didn’t exist, so it’s just a safety net I use.

Where I’ve added ‘–try another provider’, there are other plugins which are independent of the “ads” plugin, such as Chartboost. So when the ads plugin doesn’t have an ad available, you could call chartboost.show() or something like that here (assuming you initialise that beforehand).

Thanks for all of the helpful information!  

Hi Lori

There are generally two types of ads provided:  banner ads and interstitial ads.  Banner ads are small, generally around 50 pixels high that can usually be placed at the top or the bottom of the screen.  In many games, banner ads are ineffective.  Imagine a fast paced game where the player is constantly doing something.  They will never interact with the ad and if they do, it breaks the flow of the game.  But people use them anyway.  Interstitial ads are full screen ads that are designed to run “in between” other screens, for instance after your menu screen but before the game actually starts.  These full screen ads earn more money but you have fewer of them.

Next, there are multiple ad providers that you can use.  They all have their pros and cons.  Some people will use multiple providers to make sure they are always getting ads.  Many ad providers don’t have the inventory (sold ads) to always have ads for you.  It can take time for your ad to earn enough reputation to get their  available inventory.  Because of that several developers will support multiple ad providers to try and make sure they get the ads needed to always show them.

All Corona ads are done through plugins and most are available to Starter accounts.  Occasionally there will be an update that requires a daily build to implement, but usually the next public release catches up.  This will involve adding some code to your build.settings for each plugin you need.

Each ad vendor will require you to setup information with them including how to pay out to you, etc.  They all will be different.  You will create an entry for your app and in many cases you may have two or more per app (one iOS, on Android for instance).  You will need the ID number they give you (and they all call them something else). 

In your Corona SDK code you will require the plugin in, then call

ad.init()

with some parameters and some listener function and the ID you got for the ad provider.  after that you can call ad.show() to show the ad (it needs parameters too).

As far as In App Purchases, you will need to be a Basic, Pro or Enterprise subscriber to use IAP.  Google’s IAP v3 is implemented as a plugin but Apple’s IAP is built into the core with the store.* API. 

Rob

Don’t forget there are video ads too! You use them in a similar way to interstitial ads, and show them during a “break” in the gameplay. The general Corona ads plugin supports a video provider: Vungle. Here’s an example:

local function adListener(e) if e.isError then print("an error happened :-(") elseif e.type == "adStart" then print("ad has started playing") elseif e.type == "adView" then if e.isCompletedView then print("user watched enough video to count as being watched") else print("user quit out of ad early") end elseif e.type == "adEnd" then print("ad has closed") end end local ads = require "ads" ads.init( "vungle", "your\_App\_ID", adListener ) if ads.isAdAvailable then if ads.isAdAvailable() then ads.show( "incentivized", { isBackButtonEnabled = false, isCloseShown = false } ) else --try another ad provider end else --try another ad provider end

I use ads.isAdAvailable() to check whether an ad is available before I attempt to show it. Most ad plugins will have a similar function. Before I call it, I actually check that the function itself exists which is why there is this line without the parentheses:

if ads.isAdAvailable then

Not sure if that’s still needed, but I had issues where I would call the function but it didn’t exist, so it’s just a safety net I use.

Where I’ve added ‘–try another provider’, there are other plugins which are independent of the “ads” plugin, such as Chartboost. So when the ads plugin doesn’t have an ad available, you could call chartboost.show() or something like that here (assuming you initialise that beforehand).

Thanks for all of the helpful information!