SDK Version: 4.10.3
For Swift documentation, please click here.
This document describes the basic procedure for integrating Start.io (Formerly StartApp) In-App Ads into your iOS applications.
After this simple integration process, Start.io In-App Ads enables you to reap the benefits of Start.io's In-App monetization products, which maximize the revenue generated by your application. All this profit-making is achieved with minimal effort and minimal interference with your users’ experience.
- The code samples in this document can be copy/paste into your source code
- You can also checkout our sample project here
- When submitting your application to the App Store,do not forget to update your "IDFA Settings"
- We strongly recommend you incorporate Integration Tests during the integration and before going live
- If you have any questions, contact us here.
Getting Started
Step 1, Adding the SDK to Your Project
Open your project's Podfile and add this line to your app's target:
pod 'StartAppSDK'
Run pod install from command line:
$ pod install
If you're new to CocoaPods, see their official documentation (https://guides.cocoapods.org/using/using-cocoapods) for info on how to create and use Podfiles.
Click here if you would like to manually download our iOS SDK.
Right-click on you project and choose "Add Files to…"
- Add the Start.io (Formerly StartApp) SDK files:
StartApp.framework
Make sure to check the "Copy items if needed" checkbox.
Add the Start.io SDK files to your application project directory:
- Select your application project to bring up the project editor
- Select your application target to bring up the target editor
- Select the Build Phases tab and disclose the "Link Binary with Libraries" phase and click the plus button in that phase
- Add the following frameworks:
AdSupport.framework
AppTrackingTransparency
AVFoundation.framework
CoreAudio.framework
CoreFoundation.framework
CoreGraphics.framework
CoreMedia.framework
CoreTelephony.framework
Foundation.framework
JavaScriptCore.framework
QuartzCore.framework
StoreKit.framework
SystemConfiguration.framework
UIKit.framework
WebKit.framework
libz.tbd
Step 2, Initialization
In your application delegate class (AppDelegate.m), import the Start.io (Formerly StartApp) SDK and add the following line to your application's didFinishLaunchingWithOptions function:
// AppDelegate.m
#import <StartApp/StartApp.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// initialize the SDK with your appID
STAStartAppSDK* sdk = [STAStartAppSDK sharedInstance];
sdk.appID = @"your app Id";
return YES;
}
Replace "your app id" with your own value provided in the developers’ portal.
To find your application ID, click on the "Apps and Sites" tab on the left pane and choose the relevant ID from your app list:
Step 3, User Consent (GDPR)
Start.io (Formerly StartApp) requires you to pass user consent flag via the API as detailed herein below. The user consent flag indicates whether a user based in the EU has provided consent for ads personalization, collection and use of personal data. Based on this consent flag, Start.io will be able to use the data to target the most relevant ads to your users. If a user has not consented, we will not show personalized ads to this user.
- Collection of consent is only required in countries covered by GDPR (EU member states). Consent is not required for users that are based outside those countries.
- We recommend you to pass the consent flag to Start.io (Formerly StartApp) right after initializing the SDK.
- In case of any consent change during the lifetime of the user activity, you are required to re-submit the relevant consent flag to Start.io.
- Older SDK versions (before 3.8.0): We'll continue to support them with showing ads. It’s important to know that in case you cannot update the SDK version and the user consent is false for GDPR users, do not initialize Start.io SDK for such users.
Use this method in case the user has consented:
[[STAStartAppSDK sharedInstance] setUserConsent:YES forConsentType:@"pas" withTimestamp:[[NSDate date] timeIntervalSince1970]];
Use this method in case the user has not consented:
[[STAStartAppSDK sharedInstance] setUserConsent:NO forConsentType:@"pas" withTimestamp:[[NSDate date] timeIntervalSince1970]];
NOTE:timestamp parameter should represent the specific time a consent was given by the user.
To make the process easier, we have added a consent window to our demo apps. Please follow the link to see demo projects.
iOS sample consent window:
Step 4, CCPA Compliance
Start.io’s SDK (Version 4.7.0 and above) supports publishers to restrict the sale of end users’ personal information under the California Consumer Privacy Act (CCPA).
The notification about opt out of specific users located in California should be handled based on IAB US Privacy String.
To set the IAB US privacy string, use the following API:
STAStartAppSDK *sdk = [STAStartAppSDK sharedInstance];
[sdk handleExtras:^(NSMutableDictionary<NSString*,id>* extras) {
[extras setObject:@"1YNN" forKey:@"IABUSPrivacy_String"];
}];
To determine what value to use for the US Privacy String, refer to IAB document. Note that it is case-sensitive.
Example values:
- When CCPA does not apply (for example if the user is not a resident of California) you can either skip this API or use the following value “1---“.
- If the user chooses NOT to opt out, and is ok with advertising as usual, you can use "1YNN".
- If the user chooses to restrict advertising and opt out, you can use 1YYN
For more information on Start.io and CCPA, refer to Start.io’s Blog Page.
Ad Formats
Splash Ad (recommended)
Start.io (Formerly StartApp) Splash Ad is a top performing ad unit, presenting the industry's highest CPM's
A Splash Ad is a full-page ad that is displayed immediately after the application is launched. A Splash Ad first displays a full page splash screen that you define (as described below) followed by a full page ad.
Adding the Splash Screen
In your application delegate class (AppDelegate.m), after initializing the SDK, call the [sdk showSplashAd] method:
// AppDelegate.m
#import <StartApp/StartApp.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// initialize the SDK with your appID
STAStartAppSDK* sdk = [STAStartAppSDK sharedInstance];
sdk.appID = @"your app Id";
[sdk showSplashAd]; // display the splash screen
return YES;
}
If you wish to customize or use a different splash screen, please refer to the Advanced Usage.
Interstitial Ads
Interstitial Ads are full page ads, displayed before or after a certain content page or action, such as upon entering a stage, between stages, while waiting for an action, upon exiting the application and more. When integrating this ad type you are open to get both Display or Video ads. Our optimization will auto-select the ad type that will generate the most revenue for you.
In order to show rewarded video ad in your app, follow the following steps:
First, declare STAStartAppAd instance:
// YourViewController.h
#import <StartApp/StartApp.h>
@interface YourViewController : UIViewController
{
STAStartAppAd* startAppInterstitialAd; // ADD THIS LINE
}
Use the "loadAdWithDelegate" method:
// YourViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
startAppInterstitialAd = [[STAStartAppAd alloc] init];
[startAppInterstitialAd loadAdWithDelegate:self];
}
Then, you can implement the following method in order to get a callback when ad is loaded and ready to be shown:
- (void)didLoadAd:(STAAbstractAd*)ad;
Finally, add the following lines where you want to show the ad
[startAppInterstitialAd showAd];
Loading an ad might take a few seconds so it's important to show the ad as late as you can. In case you call showAd() while the ad hasn't been successfully loaded yet, nothing will be displayed. For example, if you'd like to show an ad after completing a game's level, the best practice would be to show the ad upon completing the level (for example in your viewDidDisappear() function). On the other hand, loading and showing the ad together at the beginning of the next level might result with a failure – as the ad might not have enough time to load.
Return Ad
The Return Ad is a new ad unit which is displayed once the user returns to your application after a certain period of time. To minimize the intrusiveness, short time periods are ignored. For example, the Return Ad won't be displayed if the user leaves your application to take a short phone call before returning.
Return ads are enabled and activated by default. If you want to disable this feature, simply do sdk.returnAdEnabled = NO as part of the initialization process, in your AppDelegate.m file:
// AppDelegate.m
#import <StartApp/StartApp.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// initialize the SDK with your appID
STAStartAppSDK* sdk = [STAStartAppSDK sharedInstance];
sdk.appID = @"your app Id";
sdk.returnAdEnabled = NO; // disable return ads
return YES;
}
Rewarded Video Ads
Rewarded Ads are interstitial video ads that provide a reward to the user in exchange for watching an entire video ad. The reward might be in-app goods, virtual currency or any premium content provided by the application. Because users actually opt-in to watch a rewarded video and are granted with something valuable in return, Rewarded Ads are an effective and clean monetization solution for stronger user retention and keeping users engaged in your application for a longer amount of time.
In order to show rewarded video ad in your app, follow the following steps:
First, declare STAStartAppAd instance:
// YourViewController.h
#import <StartApp/StartApp.h>
@interface YourViewController : UIViewController
{
STAStartAppAd* startAppRewardedVideoAd; // ADD THIS LINE
}
Use the "loadRewardedVideoAdWithDelegate" method:
// YourViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
startAppRewardedVideoAd = [[STAStartAppAd alloc] init];
[startAppRewardedVideoAd loadRewardedVideoAdWithDelegate:self];
}
Then, you can implement the following method in order to get a callback when the user completes watching the video and is eligible for getting the reward:
- (void) didCompleteVideo:(STAAbstractAd*)ad;
Finally, add the following line where you want to show the ad
[startAppRewardedVideoAd showAd];
Native Ads
A "Native Ad" is a raw representation of an ad without any pre-defined wrapping UI, which gives you the freedom to design and control the ad exactly as you want. Using Native Ads, you can design an ad experience that perfectly fits your application's scene, content and functionality.
For a full integration guide, please refer to "Advanced Usage" page.
Banner Ads
To display banners in your app, add a STABannerView to your application according to the following steps:
1. In the header file of your view controller, import STABannerView.h and STABannerSize.h and declare an STABannerView instance variable
// YourViewController.h
#import <UIKit/UIKit.h>
#import <StartApp/StartApp.h>
@interface YourViewController : UIViewController
{
STABannerView* bannerView;
}
2. Create and initialize the STABannerView and add it as a subView to the view where you want it to be displayed. Remember to release the bannerView object in your dealloc() function in case you're not using ARC in your project
// YourViewController.m
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (bannerView == nil) {
bannerView = [[STABannerView alloc] initWithSize:STA_AutoAdSize
autoOrigin:STAAdOrigin_Top
withDelegate:nil];
[self.view addSubview:bannerView];
}
}
- (void) dealloc
{
// Don't release bannerView if you are using ARC in your project
[bannerView release]; // Add this line
[super dealloc];
}
The STA_AutoAdSize detects the width of the device's screen in its current orientation, and provides the optimal banner for this size.
- You can find your "developerId" and "appId" the same way as in step 3 above
- This example shows the banner at the top of the root view controller (self.view), but you can pass any other view where you want to show the banner
The origin of the banner is determined by the "autoOrigin" parameter which can receive one of the following values
Value | Position | Behavior |
STAAdOrigin_Top | Auto Top | The banner will be centered and pinned to the top of the view. In case the view is a root view controller, the banner will be located under the status bar, if exists. |
STAAdOrigin_Bottom | Auto Bottom | The banner will be centered and pinned to the bottom of the view. |
If you wish to use a fixed origin for the banner, please refer to the "Advanced Manual"
MRec Ads
MRec is a 300X250 rectangular ad integrated within an app's layout. The ad will be refreshed automatically.
In order to integrate MRec ad inside your app, you should use the Banner implementation and initiate it with the specific size: STA_MRecAdSize_300x250.
Cover Ads
Cover is a 1200X628 rectangular ad integrated within an app's layout. The ad will be refreshed automatically.
In order to integrate Cover ad inside your app, you should use the Banner implementation and initiate it with the specific size: STA_CoverAdSize.
Updating your IDFA Settings
When submitting your application to the App Store you need to update its "Advertising Identifier (IDFA)" settings in order to comply with Apple advertising policy.
On the "Advertising Identifier" section:
- Choose "Yes" on the right pane
- Opt-in the "Serve advertisements within the app" checkbox
- Opt-in the confirmation checkbox under "Limit Ad tracking setting in iOS"
App-ads.txt
What is app-ads.txt?
With a goal of increasing transparency to the mobile advertising echo system, IAB Tech Lab released app-ads.txt.
App-ads.txt allows the publishers to declare who is officially authorized to sell their inventory, this in return, allows the buyers to purchase the same inventory with confidence in terms of it's legitimacy and authenticity.
Adding App-ads.txt with Start.io
At Start.io (Formerly StartApp) we strive to comply with the highest industry standards, we strongly encourage you to add Start.io entries to your app-ads.txt file.
In order to do so, you need to simply follow the instructions on this article.
Advanced Usage
For advanced usage, please refer to "Advanced Usage"
Entering your App Privacy Information
For more information on the data information you must provide when uploading your App to the App Store, please refer to "Manage Your App Privacy Details"