Skip to main content
All CollectionsAdvertising and SDKs
Heyzap/Fyber Mediation Guide - iOS
Heyzap/Fyber Mediation Guide - iOS

This article will help walk you through the process of integrating Heyzap Mediation into your Buildbox game.

Hue Jacobs avatar
Written by Hue Jacobs
Updated over 6 years ago

*Note* Fyber acquired HeyZap a while back and they are still in the process of transferring everything over for their system, so this tutorial is highly subject to change because of that. Also, you will need to download Xcode to make this work. Xcode only works on the MacOS. 

  1. Once you have created your Fyber account and logged in, go down to the bottom left and select Apps.

2. Next, select either one of the green buttons. One says "Claim App" and the other says "New App", but they both take you to the same place. 

3. For the next part, most of you will not have your app already in the App Store, so go ahead and select the Apple Icon and then select "Not in the App Store yet? You can add your app manually by clicking here."  The part that says "clicking here" will be highlighted in green. You want to click that. 

4. Once you select "clicking here", two text boxes will drop down so you can enter your App Name and Bundle Identifier. 

*Note* make sure your bundle identifier is the same as it is in Buildbox game. Go to your project settings in Buildbox and confirm. 

Once you have confirmed that your Bundle Identifier in Buildbox matches the Bundle Identifier you entered on the Fyber website, then click the purple "ADD" button. 

5. Okay so now that we have our game info set up, you should see a new page where your game is listed and you can manage your Administrator Permissions. Don't worry about the Administrator Permissions. Next, we need to hop over to the "Mediation Overview" so select that. 

6. Once you're in Mediation Overview, go ahead and select the name of your game that is highlighted in green. 

This will take you to your game's revenue page. Next, go ahead and select "Start Integration".

7. Now we need to decide which ad networks we want to include in our mediation. All of these options are great and I highly recommend using a couple different ones. Check the boxes on the ones you want and then click the green "Continue" button. 

8. Now it's time to pick your framework. For this guide, we are going to choose iOS. 

9. This will take you the iOS SDK integration page. This is a very important page so don't click out of it. Save it for a little later because we are going to use it again, but for now, we need to make sure that everything is set up correctly in Buildbox before we export our game from Buildbox and start messing around in Xcode. So get your Buildbox game open and go back to project settings like we did in Step 4

10. Once you open up your project settings, click on "Advertisements" and enter in your HeyZap Publisher ID into the corresponding text box. Make sure you're doing this for the "Apple iOS App Store"

You can find your HeyZap Publisher ID on the Fyber website in a couple places. I'll show you both places. 

  1. You can find it on Fyber's iOS SDK Integration page in "Step 5. Initialize the SDK" 

2. Or you can also find it by checking out your Account Page on the Fyber website. You just go up to the upper righthand corner and select your Fyber username. For this example, I created an account and named it "heyzapstudio" which you can see. 

So either of these places you can find your HeyZap Publisher ID and make sure you transfer it correctly to the project settings in your Buildbox game. 

11. Now it's time to decide where you want these ads playing in your game and how often you want them to appear. Go to your Game Mind Map and select your Game Over UI. Don't click it twice. Just select it once and you'll notice that a menu appears on the righthand side. 

Now select "Ad interstitial" if you would like an advertisement to play when a player enters your Game Over UI a certain amount of times, and then choose Heyzap as the ad network provider. You can do the same thing with "Ad Banner" if you would like to have a banner. 

Once you have chosen HeyZap as your ad network provider, you want to set your frequency. Personally, I wouldn't let your frequency be 1. I would make it higher, at least 3, because your players will not like it if an ad plays every time they are defeated. 

This is good enough for now, but you can also create buttons that will give your players a certain amount of coins if they watch a short video. These are called Rewarded Videos and it's very simple to set these up. Just make sure you choose HeyZap as your ad network provider when setting it up if you want to run HeyZap mediation for your Rewarded Videos. 

12. Now that you've entered in your HeyZap Publisher ID into the Advertisements section of your project settings and chosen HeyZap as your ad network provider for Interstitials and Banner Ads and set the frequency, now you can export your game. Make sure you save your game first, and go to the upper lefthand then Export to iOS.

You may get this HeyZap network warning, but don't worry about it. I'm going to walk you through all of the code you need to add in Xcode to make this work. Just click "Continue".

Next, Buildbox will save your game (it will ask you to name your bbdoc file if you haven't already) and ask you what you want to name your exported game folder. I named my example "HeyZap Studio" for this tutorial. 

13. So this is what the exported Game Folder looks like. You want to make sure you have the latest version of Xcode downloaded and then double-click the file titled, "BBPlayer.xcodeproj"

14. Xcode will automatically open your project. Go ahead and click once on "AppDelegate.mm" and the file will appear in the window to the right. 

15. Now that you're looking at the AppDelegate.mm, we need to add a few lines of code. The lines of code you need to add are shown here on the iOS SDK integration page on the Fyber website. 

*Keep In Mind* -  this list will be different if you are mediating multiple Ad Networks. For this tutorial, I'm only using HeyZap ads so these are the only lines I need to add. BUT, we do need to change this code around a little for it to work properly with our game. We need to change the code into this:

#import <AdSupport/AdSupport.h>
#import <CoreGraphics/CoreGraphics.h>
#import <CoreLocation/CoreLocation.h>
#import <CoreTelephony/CoreTelephonyDefines.h>
#import <MediaPlayer/MediaPlayer.h>
#import <MessageUI/MessageUI.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import <QuartzCore/QuartzCore.h>
#import <Security/Security.h>
#import <StoreKit/StoreKit.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <WebKit/WebKit.h>
#import <HeyzapAds/HeyzapAds.h>


AND, you want to put those lines right here:

16. Now we need to add in another line of code that contains your publisher ID. You can find this line on the iOS SDK integration page on the Fyber website:

Copy that line and paste it here:

17. You'll notice from the above image, that I also added another line of code. The line I added is for the mediation test suite. This is how you can check if things are working properly. This is the line of code: 

[HeyzapAds presentMediationDebugViewController];

*NOTE* - This is only for testing. Whatever you do, don't submit a game to the App Store or to a publisher with this line. As soon as you're done using it to test to see if everything is hooked up correctly, either comment that line of code out using "//" or delete it altogether. This is what the mediation test suite should look like:

18. Check and make sure that the Ad Networks are hooked up properly and are showing Ads (Signified by green check marks), and then exit the mediation test suite by tapping "Done" in the corner. Now play your game and make sure the banners are showing up and your ads are playing after the correct number of defeats. (The number of times you enter your Game Over UI) 

19. You're DONE! You have just implemented HeyZap Mediation in your game! You can go back to your Apps Revenue Page on Fyber and check on how much money you're making (It does take a while to show up). Congrats! 

*FINAL NOTE* - I'll mention one more time that these steps might be slightly different if you decide to mediate using multiple Ad Networks (Which I definitely recommend doing). You'll need to add more lines of code in Step 15 and you might have to add a few extra libraries as well. It totally depends on which Ad Networks you want to use. This guide should definitely get you most of the way there, but there might be a few slight changes. If you are having problems, then make sure you look at the steps on the iOS SDK Integration page closely. It will tell you what extra lines of code you need to add. Also, you shouldn't have to add in any frameworks to your Xcode project because we already include them, just follow the steps above and you should be good to go! :D 

Did this answer your question?