Jump to content

Running ads GMS


sandy234
 Share

Recommended Posts

One of clients have told me to implement ads in the game He has given me some code.

I dont know where to put it.

I tried putting it in index.html but it doesnt seem to work

 

<script type="text/javascript"><!--    google_ad_client = "xxxxxxxxxxxxx";    /* baloons-320-50 */    google_ad_slot = "xxxxxxx";    google_ad_width = 320;    google_ad_height = 50;    //--></script><script type="text/javascript"    src="http://pagead2.googlesyndication.com/xxxxxxxxx.js"></script>

 

Where does this go. He wants ads between each level

Edited by Chris
Unformatted code hurt my eyes
Link to comment
Share on other sites

I mean html file by 'page'. The ad script try to extend the page with its own box (div), but it may conflic with another javascript. So first try the ad script (the code you paste above) on a blank html page (with just

<html>

<body>

...[ your script] ...

</body>

</html>

If this work, then try with your index.html
Link to comment
Share on other sites

No ads are always on.

Publisher only wants ads displayed when going from one level to another on a fake loading screen.

 

I probably need to turn above code to a function and call inside game maker.

 

But i have no idea about javascript to do it

Link to comment
Share on other sites

No ads are always on.

Publisher only wants ads displayed when going from one level to another on a fake loading screen.

 

I probably need to turn above code to a function and call inside game maker.

 

But i have no idea about javascript to do it

Well that is very difficult. One way is to make a global variable in game maker say 'displayGOOGLEads' and set it to '0' declared by any object (I hope we can do it with any object?). Then make an controller object without sprite which is present in every room. What controller object do is turn on the displayGOOGLEads to '1' for say 5 seconds (hint: Alarm) when you enter a new room/level. se ctrl+F to find the word 'displayGOOGLEads' if you find it declared then hopefully it would work. Make sure if it is global to get rid of any problems. Now, try to edit your index.html there place a javascript code to make it visible only if variable displayGOOGLEads is 1.

Though, I never tried seeing Game Maker's HTML 5 output in text editor so I am not very sure if game Maker preserves the variable names. But if it don't preserve the value of variable but do indeed declare all variables we are using then a good way to set the value of variable to something unique which wouldn't be seen anywhere else like 1111212210, then try to find the location of that value and near it you would find variable you have to deal with. Hope this helps ;)

 

EDIT:

I think asking over some Game Maker forum would be helpful if problem isn't solved...

Link to comment
Share on other sites

Did you check if your ad was actually enabled? Sometimes it takes some time for Google to enable it, so all you see is an empty transparent block.

 

You should try to find the block on your page using Firebug, or the webkit development tools, and see if it is replaced by the ad. Maybe it's just your CSS.

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...