Unity3D SDK - Offer Wall

The Heyzap SDK provides access to the Fyber Offer Wall as of SDK version 9.12.0 and above. The Offer Wall allows your users to complete certain activities in exchange for in-game currency.

In order to use the Offer Wall in your app, make sure to include the latest Fyber SDK when adding ad networks, configure and enable Fyber on your Mediation Settings dashboard, and configure Offer Wall on your Fyber Dashboard.

Fetch

To fetch an Offer Wall ad (which will always succeed unless the Fyber SDK is not present/configured/enabled, or if the tag is disabled):

HZOfferWallAd.Fetch();

To check if an Offer Wall ad is available (it will always be unless the Fyber SDK is not present/configured/enabled, or if the tag is disabled):

HZOfferWallAd.IsAvailable();

Show

To show an Offer Wall ad, configure the HZOfferWallShowOptions class:

HZOfferWallShowOptions  = new HZOfferWallShowOptions();
offerwallOptions.ShouldCloseAfterFirstClick = true;
HZOfferWallAd.ShowWithOptions(offerwallOptions);
var offerwallOptions : HZOfferWallShowOptions = new HZOfferWallShowOptions();
offerwallOptions.ShouldCloseAfterFirstClick = true;
HZOfferWallAd.ShowWithOptions(offerwallOptions);

The options object is a subclass of HZShowOptions, so it also supports setting the Tag just like other ad formats.

Setting Up Callbacks

To track validated rewards via Fyber's Virtual Currency Server (necessary to reward users for Offer Wall interactions), you must register a delegate and request VCS updates periodically.

If the response object's DeltaOfCurrency property is nonzero, give that amount of the currency identified by CurrencyID to the user. Subsequent VCS requests will have a DeltaOfCurrency of 0 until the user completes another offer, so you can always use this value to determine how much to award the user without worrying about over-rewarding.

Here's the code you'll need to use to set the delegate and listen for a response:

HZOfferWallAd.VirtualCurrencyResponseListener listener = delegate(VirtualCurrencyResponse response) {
    // reward the user with `response.DeltaOfCurrency` of the currency identified
    // by `response.CurrencyID` and `response.CurrencyName` if it's > 0
};
HZOfferWallAd.SetVirtualCurrencyResponseListener(listener);

HZOfferWallAd.VirtualCurrencyErrorListener errorListener = delegate(string errorMessage) {
    // an error occurred during the VCS request. Try again later.
    // The Fyber SDK may not have started yet (it will once an OfferWall ad is requested/shown)
    // or there may have been a network error.
};
HZOfferWallAd.SetVirtualCurrencyErrorListener(errorListener);

HZOfferWallAd.SetVirtualCurrencyResponseListener(function(response : VirtualCurrencyResponse){
    // reward the user with `response.DeltaOfCurrency` of the currency identified
    // by `response.CurrencyID` and `response.CurrencyName` if it's > 0
});

HZOfferWallAd.SetVirtualCurrencyErrorListener(function(errorMessage : String){
    // an error occurred during the VCS request. Try again later.
    // The Fyber SDK may not have started yet (it will once an OfferWall ad is requested/shown)
    // or there may have been a network error.
});

AdDisplayListener

An AdDisplayListener is used for Offer Wall just like our other ad formats. These can be used to track fetch success/failure, show success/failure, ad dismissal, etc. Details about these can be found on our advanced docs.

Rewarding the User

On Fyber's dashboard, you can configure the currency ID and exchange rate for your users to earn from the Offer Wall.

In order to not double reward users for Rewarded Video views from Fyber via Fyber's VCS system, it is important that you set up a separate currency for Offer Wall and Rewarded Video on the Fyber Dashboard, and only request VCS updates for the Offer Wall currency. This is important since Fyber offers the same VCS system for both ad formats, but Heyzap Mediation does not support Fyber's VCS system for Rewarded Videos.

You will need to call the RequestDeltaOfCurrency method periodically to check for validated offers. This method will trigger a response via the delegate methods above. Offers are validated server-side and can take any amount of time, depending on the offer, so there may be some time between the user's offer completion and a successful VCS callback. Fyber suggests requesting an update:

  • 5 seconds after the Offer Wall is closed, and
  • once every time your user returns to a screen that displays how much currency they have, such as the main menu of your game.

To request the VCS update and check for any new rewards:

HZOfferWallAd.RequestDeltaOfCurrency("gold_coin"); // pass the currency ID you set up with Fyber

Fyber's docs have more advanced information on configuring the Offer Wall if you are interested.