zenocross

Issue with FB Ads?

Recommended Posts

Hi,


I've been using Phaser 3 (3.11.0) and although I've got FB ads to work already, it looks like after playing an ad the scene becomes unresponsive ('pointerdown' listeners stop working from what I can tell). The Phaser systems look to be running though since I have this console for debug that gets cleared up over time. I'm wondering if anyone else encountered this and has a solution for it or knows what I'm doing wrong/missing anything? The ad fetching and showing code is same as whats in the FB instant documentation.

I though it has something to do with the scene not being on top of the window or something so I've tried bringing the scene in front and even restarting the scene but it's also not working.
 

Fetch Code:

this.preloadedInterstitial = null;

FBInstant.getInterstitialAdAsync(
  this.INTERSTITIAL_PLACEMENT_ID, // Variable set in scene
).then((interstitial) => {
    DebugConsole.instance.append("LOADING INTERSTITIAL");
  // Load the Ad asynchronously
  this.preloadedInterstitial = interstitial;
  return this.preloadedInterstitial.loadAsync();
}).then(function() {
    DebugConsole.instance.append("INTERSTITIAL LOADED");
}).catch(function(err){
    DebugConsole.instance.append("INTERSTITIAL FAILED TO LOAD " + err);             
});

Show Code:
this.preloadedInterstitial.showAsync()
    .then(() => {
    // Perform post-ad success operation
        DebugConsole.instance.append("SHOWN VID");
    }).catch((e) => {
        DebugConsole.instance.append("SHOW VID ERR" + e);
    }).finally(() => {
        DebugConsole.instance.append("FINALLY WORKS");
    });
});

 

Share this post


Link to post
Share on other sites

Thank you for the immediate responses. :)

@Noel I did but still had issues with it though I have figured it out already. Sorry, apparently the actual issue in the code was not included in my snippet.

Hi @rich,

No, there's no overlay after closing the ad so I thought everything looked like it was still normal. Anyway I have figured it out after looking through the github issues and reading about someone stating the pointerdown function is queued for next update or something like that. The issue was that in my code that shows the ad, the function was put inside a text gameobject's pointerdown function. After that, it looks like the input is blocked totally. I'm not sure if it's something that needs attention with Phaser itself but the fix is actually simpler than I thought.

For anyone else with this problem : showing Facebook Ads should be put on the pointerup event. I hope it helps.

Share this post


Link to post
Share on other sites

Hi guys,

I'm using Phaser 2 to build a Multiplayer FB game. We've got it pretty much working, but now we're trying to add Rewards/Interstitual Ads,

However following the examples/tutorials the best I can, I keep getting and error "Client does not support the message: getinterstitialadasync" (Obviously if I try it with the reward ad code, it would be similar to this)

Another example I tried (snippet):

const INTERSTITIAL_PLACEMENT_ID = '***_***';

FBInstant.startGameAsync().then(function() {
	var supportedAPIs = FBInstant.getSupportedAPIs();
	
        if (supportedAPIs.includes('getInterstitialAdAsync')){
	    displayError("Supported Interstitial API");
	    FBInstant.getInterstitialAdAsync(
  		INTERSTITIAL_PLACEMENT_ID, // Variable set in scene
		).then((interstitial) => {
			displayError('Interstitial video loading');
    			//console.log("LOADING INTERSTITIAL");
  		        // Load the Ad asynchronously
  			preloadedInterstitial = interstitial;
			return preloadedInterstitial.loadAsync();
		}).then(function() {
			displayError("INTERSTITIAL LOADED");
		}).catch(function(err){
			displayError("INTERSTITIAL FAILED TO LOAD " + err);             
		});
	}
	else {
		displayError('Insterstitial Ads not supported');
	}

If I use this code above the supportedAPIs.includes('getInterstitialAdAsyn') also fails.

Any ideas would be appreciated.
Thanks.

Share this post


Link to post
Share on other sites

Hi Noel, I was testing on my Samsung S9, but it seems to work now, I'm not sure why it suddenly started working.
I submitted for review (the ads) and was declined, because it wasn't working and still had a load of debugging in the game. But since I did this, it started working.. So could just be that it doesn't work instantly? and you have to wait a few days for it to kick in maybe? I dont know.. But it works now. Just wish I knew what the issue was incase it happened again :)

Thanks for the reply

Share this post


Link to post
Share on other sites

We already know that facebook has a documentation for this, but it's basic not for all the supported engines like Phazer, Construct 2&3 or GameMaker Studio, we have to search and ask about this or write it by your self, we wait for this also for construct 2 we have the same problem in the games, the ads appears just 1 time in the launch of the game, a big problem 😕

Share this post


Link to post
Share on other sites

@BerMon Why don't you request those features to the game engine creators then? They are the ones who know and control their engine the best.

The only alternative is to make the changes by yourself. For most engines you will find tutorials made by developers who managed to do it.

Share this post


Link to post
Share on other sites

hello guys, 

Im new here, and i get the code for both, inters and rewards :but it s not working i don t know why ?

and i did a showrewards and inter in my init.js file but nothing's happening .

 

Any ideas, 

FYI : my Audience network mark it s not green i don t know why maybe is it the problème ??


//*=================================================*//
//*-------------------------------------------------*//
//*----------------- Facebook ----------------------*//
//*--------------- Instant Game --------------------*//
//*--------------- AdsController -------------------*//

const INTERSTITIAL_PLACEMENT_ID = 'xx'; //*-------- Interstitial -------*//
const REWARDED_PLACEMENT_ID = 'xx'; //*-------- Rewarded Video -----*//

// LoadRewarded();
// LoadInter();


// ShowRewarded();
// ShowInter();

    


var preloadedRewardedVideo;
var preloadedInterstitial;

//*=================================================*//
//*-------- Interstitial ADS By edward -------*//
//*=================================================*//

//*-------- Load Interstitial --------*//
function LoadInter() {
    var supportedAPIs = FBInstant.getSupportedAPIs();
    if (supportedAPIs.includes('getInterstitialAdAsync')){
        preloadedInterstitial = null;
        FBInstant.getInterstitialAdAsync(
            INTERSTITIAL_PLACEMENT_ID,
        ).then(function(interstitial) {
            preloadedInterstitial = interstitial;
            return preloadedInterstitial.loadAsync();
        }).then(function() {
            console.log('Interstitial preloaded')
        }).catch(function(err){
            console.error('Interstitial failed to preload: ' + err.message);
        });
    } else {
        displayError('Ads not supported in this session');
    }
}         
//*-------- Show Interstitial --------*//
function ShowInter() {
preloadedInterstitial.showAsync()
    .then(function () {
        console.log('Interstitial ad finished successfully');
    })
    .catch(function (e) {
        console.error(e.message);
    });
}

//*=================================================*//
//*-------- Rewarded Video ADS By edward-----*//
//*=================================================*//

//*-------- Load Rewarded --------*//
function LoadRewarded() {
    var supportedAPIs = FBInstant.getSupportedAPIs();
    if (supportedAPIs.includes('getRewardedVideoAsync')){
        preloadedRewardedVideo = null;
        FBInstant.getRewardedVideoAsync(
            REWARDED_PLACEMENT_ID
        ).then(function(rewarded) {
          preloadedRewardedVideo = rewarded;
          return preloadedRewardedVideo.loadAsync();
        }).then(function() {
            console.log('Rewarded Video preloaded')
        }).catch(function(err){
            console.error('Rewarded Video failed to preload: ' + err.message);
        });
    } else {
        displayError('Ads not supported in this session');
    }
}
//*-------- Show Rewarded --------*//
function ShowRewarded() {
preloadedRewardedVideo.showAsync()
    .then(function () {
        console.log('Rewarded Video ad finished successfully');
    })
    .catch(function (e) {
        console.error(e.message);
    });
}

//*=================================================*//
//*-------------------------------------------------*//
//*----------------- Facebook ----------------------*//
//*--------------- Instant Game --------------------*//
//*--------------- AdsController -------------------*//

//*-------------- edward------------------*//
//*-------------------------------------------------*//
//*=================================================*//

 

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.