Teonnyn

Adding a single ad to one game?

Recommended Posts

I've created something that's akin to somewhat of a joke site, but it's a fairly good one. Somehow, I would like to monetize it with just one advertisement.

However, actually finding material on this is proving to be baffling. My original intent was to add a sidebar ad to the site side itself, however

Phaser.io seems to block additional divs when loaded dynamically. I'd like to possibly show a ad in the preload, but finding a way to do this is confusing at best. 

Everything relevant seems to be rather scattered. I stumbled on the Orange Games plugin, but going through DoubleClick appears to require approval, etc.

In 2017, are there any better tutorials or structured frameworks, suggestions on how to do this?

Share this post


Link to post
Share on other sites

I'm sorry, but I think it would be very easy to do this if you don't put the Ad inside Phaser. 

I mean, your Phaser game will eventually be put on a HTML file, right?

How about just put that Ad on the HTML along side with your Phaser game. You can easily do this with some CSS.

 

As for showing the Ad in the loading screen, you can also use the same technique.

1. Put the Ad div next to (sibling to) your Phaser game div.

2. Use CSS to make these 2 div overlap each other. (or whatever position you want them to be)

3. Use javascript with CSS to show the Ad and hide the game until the game is fully loaded (e.g. display: none)

Share this post


Link to post
Share on other sites

If you absolutely want to have your ads inside the Phaser game, you could use Google's IMA SDK to make ad requests to AdMob for instance, and then use Phaser's video objects to display the ads with input handlers to open the appropriate links if the user clicks on the video. I haven't done anything like this, but from a quick glance at the SDK docs, what you'd need to do is create an invisible video element in your markup, make a request to your ad network through IMA and then pick the necessary information from the video element through the DOM and plug the values into a Phaser video object.

That being said, I agree with @cccc that it'd be far easier to implement the ad either next to the Phaser canvas, or on top of it with absolute positioning or the like.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.