Method signature

To get advertisement placement reward a contract is required:

FAPI.UI.loadAd();

Example usage

/*
* Starts a video ad preparation for an in-game show
*/
function loadRewardedAd() {
    FAPI.UI.loadAd();
}

Callback example

Following arguments can be passed to API_callback function as a result:

Callback if a video was found

method: “loadAd”

result: “ok”

data: “ready”

Callback if a video was not found

method: “loadAd”

result: “error”

data: “empty”

Callback if video ads are not available for current user

method: “loadAd”

result: “error”

data: “disabled”

A callback for a case when a request was blocked by an ad blocker

method: “loadAd”

result: “error”

data: “initialization_error”

Possible error codes on android platform

If an error ocurres while invoking a method on android platform an error code of following format will be returned: native ads failed: {error_code}.

Following codes can be passed in an error_code field:

  • -1 - method invocation limit is reached. 30 seconds should pass between two consequent calls;
  • -2 - client callback function call error;
  • -3 - android ads are not available for current user;
  • -4 - ad is already running.

Possible response codes for successful method calls on android platform

In case of a successful method call on android platform following codes can be returned in a data parameter of a callback function:

  • method = loadAd:
    • data = ad_prepared - ad is ready to be shown;
  • method = showLoadedAd:
    • data = ad_shown - ad is successfully shown to user, ad layer is closed.

How it works

Function initiates a process of video ad selection for current user to show it in-game.
Video selection is personalized and depends on user activity on Web and other personal data.
After a successful video selection method FAPI.UI.showLoadedAd() should be invoked.

Test application

To check how it all works you can use our test application.

You can find it by these links:

To view an ad in html application do the following:

  • press a “load rewarded ad” button;
  • press a “show rewarded ad” button.

Statistics

Ad statistics is available for game developers on app stats page:

  • “Advertisement” section -> “Browser ad views” chart - for ads on web, mobile web and ios (as a part of mobile web) platforms;
  • “Advertisement” section -> “Android ad views” chart - for ads on android platform.

Keep in mind that we count an was successfully viewed on web, mobile web and ios only if:

  • user viewed it for at least 10 seconds;
  • result = ok и data = complete response was returned after video was played.

On android platform ad is counted as viewed if ad_shown response is returned in a callback.