Jump to content

How do I put cocoonjs ads into my pandajs game?


Recommended Posts



I have been trying everything to put ads in my pandajs game but I am struggling to do so. The cocoonjs website is not clear on what code exactly I need to put into my game.


I just want banner ads on the bottom of the screen


Could someone please help me!



Link to comment
Share on other sites

Yea, their web is a chaos in terms of site navigation. And not pretty clear about how make stuffs work.


Here there is an article about Ads:




Javascript API DOC:




I also suggest you download the launcher examples and search inside the code:



Link to comment
Share on other sites

Config your MoPub account as described here:




Put these Code to your main.js:

if(CocoonJS && CocoonJS.nativeExtensionObjectAvailable && CocoonJS.Ad) {CocoonJS.Ad.onBannerReady.addEventListener(function(width,height) {CocoonJS.Ad.setBannerLayout(CocoonJS.Ad.BannerLayout.BOTTOM_CENTER);CocoonJS.Ad.showBanner(); });CocoonJS.Ad.preloadBanner(); }

Now it should work  :)

Link to comment
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.

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.


  • Recently Browsing   0 members

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