Game Development Reference
In-Depth Information
WARNING
This code is only for locally testing. You will need to replace the applicationID with your
ID supplied by pubCenter before you publish your game or you won't be able to display
your ads. Also, you can't test your ads locally, so use the test ads to make sure they are
placed correctly then use your production applicationID so you don't forget to swap it out
before publishing.
If you ever need a reference to the actual ad, you can use some JavaScript to get its div ID
from the document like this:
this.ad = document.getElementById("ad");
Once you have a reference of the ad in your code you can use simple CSS to hide and show
it by setting this.ad.style.display to “none” or “block.” This is useful when you want to hide
ads on certain parts of the game or if you tie it into the trial mode and hide it if the player has
bought a full version of the game like so:
// Remove Ad if the app was paid for
if (!licenseInfo.isTrial) {
var elm = document.getElementById("ad");
elm.parentNode.removeChild(elm);
}
One of the best ways to capitalize on the trial mode of your game is enabling or disabling ads
based on if the player purchases the full version. You can even use both techniques of limit-
ing features and showing ads to entice the player to buy the game. Be creative with how you
use advertising in your game. If you make it too annoying people will not like your game; if
you don't get users to click on the ads you will not make any money. This is why I suggest
coupling ads with trials and helping augment the users who simply play the trial without ever
upgrading.
In-App Purchase
In-app purchases (IAP) are another great way to help monetize your game. Crafting a viable
and meaningful IAP system into your game takes a lot of thought and planning on your end.
Search WWH ::




Custom Search