sandy234 Posted June 19, 2013 Share Posted June 19, 2013 (edited) 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 June 19, 2013 by Chris Unformatted code hurt my eyes Quote Link to comment Share on other sites More sharing options...
Moen Posted June 19, 2013 Share Posted June 19, 2013 It goes anywhere in the page, e.g. in your page body.Try with a blank page and look at your console, you may occur a js bug ? (while loading a remote ressource...) Have a look to show_ads.js (http://pagead2.googlesyndication.com/pagead/show_ads.js) if your are curious to know how it's work. Quote Link to comment Share on other sites More sharing options...
sandy234 Posted June 19, 2013 Author Share Posted June 19, 2013 when you meant page does that mean index.html or .js file?? I cant understand show_ads.js code is scrambled in there Quote Link to comment Share on other sites More sharing options...
Moen Posted June 20, 2013 Share Posted June 20, 2013 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 Quote Link to comment Share on other sites More sharing options...
sandy234 Posted June 23, 2013 Author Share Posted June 23, 2013 Hi i tried this on blank page and it seem to work.Then i tried it on index.html and it works. But now how do i use this on gamemaker to show and hide ads Quote Link to comment Share on other sites More sharing options...
Rudrabhoj Bhati Posted June 23, 2013 Share Posted June 23, 2013 Hi i tried this on blank page and it seem to work.Then i tried it on index.html and it works. But now how do i use this on gamemaker to show and hide adsWait, you say you implemented it on index.html page which GameMaker created, right? If it work isn't problem solved? Quote Link to comment Share on other sites More sharing options...
sandy234 Posted June 23, 2013 Author Share Posted June 23, 2013 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 Quote Link to comment Share on other sites More sharing options...
Rudrabhoj Bhati Posted June 23, 2013 Share Posted June 23, 2013 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 itWell 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... Quote Link to comment Share on other sites More sharing options...
sandy234 Posted June 23, 2013 Author Share Posted June 23, 2013 What you say is not possible bec gamemaker code is obfuscated Quote Link to comment Share on other sites More sharing options...
Rudrabhoj Bhati Posted June 23, 2013 Share Posted June 23, 2013 What you say is not possible bec gamemaker code is obfuscatedOh :S I think GM forums would be more helpful in this... Quote Link to comment Share on other sites More sharing options...
remvst Posted June 24, 2013 Share Posted June 24, 2013 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. Quote Link to comment Share on other sites More sharing options...
sandy234 Posted June 24, 2013 Author Share Posted June 24, 2013 I have already said ad is running fine when i copy/paste it to index.html.I need ads to load between the levels and thats whats i dont know how to do it. Quote Link to comment Share on other sites More sharing options...
sandy234 Posted June 27, 2013 Author Share Posted June 27, 2013 Ads was working before now it doesnt No idea why. Quote Link to comment Share on other sites More sharing options...
sandy234 Posted June 29, 2013 Author Share Posted June 29, 2013 can ad module be available as separate purchase Quote Link to comment Share on other sites More sharing options...
Solidus Posted June 29, 2013 Share Posted June 29, 2013 Edit: See post below. Quote Link to comment Share on other sites More sharing options...
sandy234 Posted July 8, 2013 Author Share Posted July 8, 2013 This code only seems to work when i run the game locally. It doesnt wehn i upload it to dropbox. Any1 has any idea why this is happening Quote Link to comment Share on other sites More sharing options...
Solidus Posted August 4, 2013 Share Posted August 4, 2013 If anyone needs help with this, please PM me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.