Offerwall

The Offerwall is a full-screen visual that appears inside your application.

1. Load the offerwall

Navigate to the header file that you want the offerwall to appear in (e.g. MyViewController.h/ViewController.swift) and modify the top of the file to look like this:

Objective-C
Swift
#import <Tapdaq/Tapdaq.h>

@interface MyViewController : UIViewController <TapdaqDelegate, TDAdRequestDelegate>

The above code imports Tapdaq to the class, and declares that we will conform to the TapdaqDelegate protocol.

Please note that you only need to provide import statement once per header file.

Next, add the following command to the implementation file (e.g. MyViewController.m/ViewController.swift):

Objective-C
Swift
- (void)viewDidLoad {
    [super viewDidLoad];
    [[Tapdaq sharedSession] setDelegate:self];
}

Once this is done, implement the -loadOfferwall method in any method of your choice, for example:

Objective-C
Swift
- (void)myMethod {
    [[Tapdaq sharedSession] loadOfferwallWithDelegate:self];
}

Delegate parameter must conform to TDAdRequestDelegate.

Note: Ads should only be requested once the Tapdaq delegate method -didLoadConfig has been called. This ensures Tapdaq is initialised and ready to begin loading ads. Requesting ads prior to Tapdaq initialising will result in failed ad requests

2. Display the offerwall

Once that is done, implement the following:

Objective-C
Swift
- (void)didLoadAdRequest:(TDAdRequest *)adRequest {
    if ([adRequest isKindOfClass:[TDMediationAdRequest class]]) {
        if (adRequest.placement.adTypes & TDAdTypeOfferwall) {
            [(TDMediationAdRequest *)adRequest display];
        }
    }
}

The code above is executed when the offerwall has successfully loaded. For a full list of offerwall delegate methods we support, see our Advanced page.

It is also possible to check the offerwall is loaded before displaying it to the user, as shown below:

Objective-C
Swift
if ([[Tapdaq sharedSession] isOfferwallReady]) {
    [[Tapdaq sharedSession] showOfferwall];
}

3. Load another offerwall on close

When loading an offerwall the delegate specified in the loadOfferwall can conform to TDDisplayableAdRequestDelegate which will allow it to handle didCloseAdRequest:.

If you wish to load another offerwall after you have shown one, implement the following:

Objective-C
Swift
- (void)didCloseAdRequest:(TDAdRequest *)adRequest {
    if (adRequest.placement.adTypes & TDAdTypeOfferwall) {
        [[Tapdaq sharedSession] loadOfferwallWithDelegate:self];
    }
}

4. Reward the user

Finally, we want to reward the user for completing an offer, implement the following delegate method to obtain the reward.

When loading an offerwall the delegate specified in the loadOfferwall can conform to TDOfferwallAdRequestDelegate which will allow it to handle adRequest:didReceiveOfferwallCredits:.

Objective-C
Swift
- (void)adRequest:(TDAdRequest * _Nonnull)adRequest didReceiveOfferwallCredits:(NSDictionary * _Nullable)creditInfo {
    NSLog(@"The user received offerwall credits! creditInfo: %@", creditInfo);
}

Build and run your application to test the advert displays correctly.

Note: We strongly advise against trying to show an offerwall ad on application launch.

Need help?

If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.

What's next?

Now that you have successfully integrated an offerwall into your app, what would you like to do next?