In-game video ads

Video ads are not intended to be used to advertise your app. It is a different way to monetize non-paying players of your game.


To get advertisement placement reward a contract is required:

On Odnoklassniki there does exist another way to monetize non-paying players of you game via special video advertisements.

By using our API developer can get a video ad for displaying it to a non-paying player and grant him some in-game currency or other bonuses in case of a successful ad view.

Video ads are supported for all WEB applications and Mobile HTML (Instant) applications.

Video ads in WEB games

To implement video ads in your HTML game it must use our javascript SDK.

To display an ad to your player follow these two steps:

  1. Make sure that video ad is available for current user with SDK-method ui.prepareMidroll.
    • If method responded without an error ad is ready to be shown to a user. Only after this you can show user an invitation to view an ad in your UI.
    • If an error occurred when method was invoked then it is most likely that no ads are available to be shown to current user. Retry getting an ad after some time. UI invitation to view an ad should not be shown when there is no prepared video to play.
    • We highly recommend to renew prepared video ad every 5 or so minutes since a prepared video can be expired.
  2. If user agreed to view an ad to initiate this process you need to use SDK-method ui.showMidroll.
    • If video is indeed prepared, it will be shown to user. It will be shown on top of the game’s UI and game itself will be faded.
    • After video is viewed you’ll get response from API (callback).
    • It’s important to know that in case of user navigating to another browser window or closing browser an ad will be stopped from playing. It will only continue playing if browser window is opened and active.

Video ads in Mobile HTML games (Instant games)

To implement video ads in a mobile app you should use OKSDK.Ads methods in a following order:

Test application

If you want to check how video ads are working for both WEB and Instant applications you can use our test application:

To view an add do the following:

  • press a button “prepare midroll”;
  • press a button “show midroll”.

For MOBILE_HTML app:

  • press a button “inject frame”;
  • press a button “prepare midroll”;
  • press a button “show”.

Statistics

Ad is counted as viewed only if:

  • it was played for a at least 10 seconds;
  • a response “showMidroll$ok$complete” was returned after an ad was played.

If you have any questions about how to implement video ads in our game, how they work or how the statistics are counted you can sent an email with your question to api-support@ok.ru.