To work with the DT Offer Wall Edge using the DT SDK you must ensure that you have:
- Decided to integrate the DT Offer Wall Edge via the SDK.
- Successfully set up your app, properly configured the DT SDK.
Step 1: Enabling the DT Offer Wall
Before you can configure the DT Offer Wall, you must make sure that you have your virtual currency configured. If you have not already done so, you can add additional virtual currencies here.
- Go to the Dashboard and click through to your selected App.
- Please make sure to enable the app and select your preferable metrics according to the getting started article under Creating Placements.
Step 2: Requesting the DT Offer Wall
First you request the DT Offer Wall, then you display it.
Using the DT Offer Wall Requester
To make a request for the DT Offer Wall you must create an instance of an OfferWallRequester
through the Create
method. You may choose to store the OfferWallRequester
instance or use it immediately, chaining methods as in the following example.
using FyberPlugin;
[...]
OfferWallRequester offerWallRequester = OfferWallRequester.Create();
[...]
offerWallRequester.Request();
The call to Request
returns immediately. However, the result of the request is asynchronous and is explained in Handling the Fill Response below.
Requesting a Placement
If you are using Placements on the DT Offer Wall you can request a Placement by passing the Placement ID.
OfferWallRequester offerWallRequester =
OfferWallRequester.Create().WithPlacementId("placement Id");
Controlling DT Offer Wall Behavior after Offer Redirecting
When a user clicks on offers, they are redirected outside of your app to complete the offers. You can choose to set the behavior by calling the method CloseOnRedirect
of the OfferWallRequester
, before making the request.
Parameter Value | Behavior |
---|---|
true | When the user returns to your app, DT Offer Wall closes itself automatically. |
false | When the user returns to your app, DT Offer Wall remains open and refresh the list of offers. |
OfferWallRequester.Create()
.CloseOnRedirect(shouldCloseOfferwall)
.Request();
By default, DT Offer Wall remains open. This is equivalent to passing false to closeOnRedirect
.
Best Practice Check
If you are rewarding with VCS, DT recommends setting the DT Offer Wall to close when returning to your app. This is equivalent to passing true to CloseOnRedirect
.
Step 3: Handling the Fill Response
There are two ways of handling the asynchronous response after requesting the DT Offer Wall.
Select the method that you want to use in your integration.
Handling Response with Events
Handling the response requires dealing with one of three possible scenarios: Fill
, No-fill
, or Error
. The class FyberCallback
contains the next events to help:
Event | Scenario | DT Offer Wall Availability |
---|---|---|
AdAvailable | Fill | Available |
AdNotAvailable | No-fill | Not Available |
RequestFail | Error | Not Available |
You must set up some delegates to listen to those events.
In the case of a fill scenario, the AdAvailable
event passes an instance of the Ad
class that is saved to be used later to show the DT Offer Wall.
This is illustrated in the following example.
[...]
private Ad ofwAd;
[...]
void OnEnable()
{
FyberCallback.AdAvailable += OnAdAvailable;
FyberCallback.AdNotAvailable += OnAdNotAvailable;
FyberCallback.RequestFail += OnRequestFail;
}
void OnDisable()
{
FyberCallback.AdAvailable -= OnAdAvailable;
FyberCallback.AdNotAvailable -= OnAdNotAvailable;
FyberCallback.RequestFail -= OnRequestFail;
}
private void OnAdAvailable(Ad ad)
{
// store ad response
if (ad.AdFormat == AdFormat.OFFER_WALL)
ofwAd = ad;
}
private void OnAdNotAvailable(AdFormat adFormat)
{
// discard previous stored response
if (adFormat == AdFormat.OFFER_WALL)
ofwAd = null;
}
private void OnRequestFail(RequestError error)
{
// process error
Debug.Log("OnRequestError: " + error.Description);
}
DT Offer Wall availability does not necessarily indicate offer availability. DT Offer Wall is still available, even if no offers can be shown to the user.
In this case, DT Offer Wall loads with a message indicating that there are no offers available.
Handling Response with Callbacks
Handling the response requires dealing with one of three possible scenarios: Fill
, No-fill
, or Error
. The interface RequestCallback
contains the next methods to help:
Method | Scenario | DT Offer Wall Availability |
---|---|---|
OnAdAvailable | Fill | Available |
OnAdNotAvailable | No-fill | Not Available |
OnRequestError | Error | Not Available |
You must create a class that implements that interface.
In the case of a fill scenario, the OnAdAvailable
method receives an instance of the Ad
class that is saved to be used later to show the DT Offer Wall.
Consider the following example as a guide to implementing the interface RequestCallback
.
using FyberPlugin;
[...]
public class OfferWallRequestCallback : RequestCallback
{
public Ad ofwAd;
public void OnAdAvailable(Ad ad)
{
// store ad
if (ad.AdFormat == AdFormat.OFFER_WALL)
ofwAd = ad;
}
public void OnAdNotAvailable(AdFormat adFormat)
{
// discard previous stored ad
if (adFormat == AdFormat.OFFER_WALL)
ofwAd = null;
}
public void OnRequestError(RequestError error)
{
// process error
Debug.Log("OnRequestError: " + error.Description);
}
}
To receive the response through the implemented RequestCallback
instead of through events, you must pass an instance of it, using the method WithCallback
, before making the request.
[...]
OfferWallRequestCallback requestCallback = new OfferWallRequestCallback();
[...]
OfferWallRequester.Create()
.WithCallback(requestCallback)
.Request();
Step 4: Displaying DT Offer Wall
Once you've received an DT Offer Wall Ad
you can display through its method Start
, as in the following example:
private Ad ofwAd;
[...]
private void ShowOfferWall()
{
if (ofwAd != null)
{
ofwAd.Start();
ofwAd = null;
}
}
DT Offer Wall Notifications
If you want to be notified when the DT Offer Wall is started and closed this is performed through events or callbacks.
Select the method that you want to use in your integration.
Handling Notifications Through Events
The class FyberCallback
contains the events OnAdStarted
to notify that the DT Offer Wall was opened, and OnAdFinished
fired when the DT Offer Wall is closed.
void OnEnable()
{
FyberCallback.AdStarted += OnAdStarted;
FyberCallback.AdFinished += OnAdFinished;
}
void OnDisable()
{
FyberCallback.AdStarted -= OnAdStarted;
FyberCallback.AdFinished -= OnAdFinished;
}
[...]
private void OnAdStarted(Ad ad)
{
if (ad.AdFormat == AdFormat.OFFER_WALL)
{
// this is where you mute the sound and toggle buttons if necessary
ofwAd = null;
}
}
private void OnAdFinished(AdResult result)
{
if (result.AdFormat == AdFormat.OFFER_WALL)
{
Debug.Log("Ofw closed with result: " + result.Status +
" and message: " + result.Message);
}
}
Handling Notifications Through Callbacks
The interface AdCallback
contains the methods OnAdStarted
to notify that the DT Offer Wall was opened, and OnAdFinished
fired when the DT Offer Wall is closed.
The following is an example of how to implement the interface AdCallback
for DT Offer Wall.
public class OfferWallAdCallback : AdCallback
{
public void OnAdStarted(Ad ad)
{
// this is where you mute the sound and toggle buttons if necessary
Debug.Log("OnAdStarted. Ad " + ad.AdFormat + " has started");
}
public void OnAdFinished(AdResult result)
{
// this is the place where you can resume the sound
// reenable buttons, etc
Debug.Log("OnAdFinished. Ad " + result.AdFormat +
" finished with status: " + result.Status +
" and message: " + result.Message);
}
}
To be notified through the implemented AdCallback
instead of through events, you must pass an instance of it, using the method WithCallback
, before calling Start
to show the DT Offer Wall.
private OfferWallAdCallback adCallback = new OfferWallAdCallback();
[...]
private void ShowOfferWall()
{
if (ofwAd != null)
{
ofwAd.WithCallback(adCallback)
.Start();
ofwAd = null;
}
}
Step 5: Rewarding the User
There are two options when it comes to rewarding the users with virtual currency:
Option 1: Using your Own Server (Server Side)
If you are interested in using your own server to handle virtual rewarding to your users, DT can interact with it after you've set up your own server.
Click here for details on Server-Side Rewarding.
Option 2: Using the Virtual Currency Server (VCS)
If you do not run your own servers, Fyber can provide you with virtual currency hosting. This is the default setting for mobile applications in the developer Dashboard.
Click here for details on VCS Rewarding.
- Make sure to read the Rewarding your Users section to discover the advantages of each method.
- All rewarded ad formats use the same rewarding mechanism, so keep in mind that whatever you choose here also affects Rewarded Video.
You must set up the developer Dashboard for the option you choose and add the code necessary on the Unity side