Prerequisites
Use XCode 15.2 or higher
Target iOS 12.0 or higher
Step Summary
Import the Library
Add Info.plist App id
Add Info.plist Ad networks
Continue with Implementation type
1. Import the Mobile Ads SDK
Cocoapods
The simplest way to import the SDK into an iOS project is to use CocoaPods.
Open your project's Podfile and add this line to your app's target:
pod 'R89SDK'
Then from the command line run:
$ pod install --repo-update
If you're new to CocoaPods, see their official documentation for info on how to create and use Podfiles.
2. Add Info.plist App Id
Add the App Id to your info.plist file.
<key>GADApplicationIdentifier</key> <string>ca-app-pub-3940256099942544~1458002511</string>
The App ID in the Snippet is a Sample can be used for testing but not for prod apps
You will receive your app ID through your Technical Account manager by email, you can also retrieve them from the web interface after login.
3. Add Info.plist Ad Networks
Add the Ad Networks to your Info.plist file.
Only read the following step if your technical account manager didn’t already provide an Implementation type to follow, otherwise continue there.
4. Choose an Implementation Type
Single Tag Implementation
This is what you are looking for? continue here → https://refinery89.atlassian.net/wiki/x/HgCVTQ
This Implementation provides a way that with minimal code you can remotely control where and how to show the ad inventory.
You will have full remote control over Ad Inventory configurations and with the addition of tags to your wrapper, you will have where you show the inventory.
This is the easiest monetization setup, because all configurations for the Units are done in the Remote Server, you just need to add the tags on the “white spaces of your app” where you might or might not place ads, so no need to manually request request the ads in those places.
This option is recommended under the following circumstances:
You App is native and you are able to add tags to your views
Wants to Disable and enable Inventory slots without updating the application.
Wants tos Edit the ad units remotely over the web without updating the application.
Wants to Change Formats, slot place, sizes, etc.
Manual Implementation
This is what you are looking for? continue here → https://refinery89.atlassian.net/wiki/x/FoCaTQ
This implementation is designed for situations where the Single tag might not align with your requirements, but you can still leverage the benefits of remote inventory configuration.
You can see an example in https://refinery89.atlassian.net/wiki/x/FoB2Tg
Manual configuration means that you have remote control of General Ad Settings over the web or our tech support, but you need to add the ads manually, so instead of just placing the tags you need to create a wrapper and use it to do a request for the format that you want.
This option is recommended under the following circumstances:
Wants control over the logic of showing the Inventory.
You are using a framework that we don’t support but you can use native android code.
You have a web-application but you are not using our monetization in your web and want to place ads natively
Webview Implementation
This is what you are looking for? continue here → https://refinery89.atlassian.net/wiki/x/MgCLTQ
If your application is a web-application and your monetization is already in place in the web through our Header Tag or Adsense. It’s mandatory by google to have a native cmp when selling ad inventory on apps, use our sdk for sending consent from the phone to the cmp in the web view, this will improve performance metrics of the ad inventory in the web-application since now instead of web inventory it will be targeted as app.
This option is recommended under the following circumstances:
You have a web-application and you are using our web monetization tag and CMP
You need to send consent data to you web monetization solution (only our header bidding or adsense)
You need to properly target the ads inside the webview
You need to show ads both inside the webview and outside (combine with manual)
Remember that you should be using our CMP also in web so consent data can be understood.
If you are placing all or some ads natively, meaning that the actions on the web view trigger native code through some kind of javascript interface, then we recommend using Manual Implementation or if you are displaying some ads inside the webview and others in the native app you can use this implementation and manual together.
Comparison table
Feature | Manual | Single Tag | WebView |
---|---|---|---|
Integrated CMP. | ✅ | ✅ | ✅ |
Custom auctions in R89 Servers. | ✅ | ✅ | ✅ |
All Formats supported. | ✅ | ✅ | |
Remote Unit Configs. | ✅ | ✅ | ✅ |
Remote Ad Places. | ✅ | ||
Local Testing without R89 DB or Servers. | ✅ |
| ✅ |
Appendix
ATT (App Tracking Transparency / iOS) configuration.
Since iOS 14 Apple introduced the Apple Tracking Transparency framework, which requires that every app needs to expose which tracking data it uses. The R89SDK
before presenting the CMP will make the ATT request. Add the NSUserTrackingUsageDescription
to the Info.plist
with an appropriate message.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> ... <key>NSUserTrackingUsageDescription</key> <string>This app uses your data to provide personalized ads and improve user experience.</string> ... </dict> </plist>
Geolocation permission configuration
The R89SDK
will ask for the user’s location for setting it as a user-oriented First-Party Data. Add the NSLocationWhenInUseUsageDescription
to the Info.plist
with an appropriate message.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> ... <key>NSLocationWhenInUseUsageDescription</key> <string>This app uses your location to display advertisement according to geolocation</string> ... </dict> </plist>
The location permission will not be requested if the NSLocationWhenInUseUsageDescription
is not available in the Info.plist
.
Background mode configuration
The R89SDK
may track the advertisement session when the application is in the background. It internally uses the BgTaskScheduler and BGAppRefreshTask from the iOS framework. Before enabling the background mode add the “Background Modes“ capability to your project.
After adding the “Background Modes“ capability enable the “Background fetch“ and “Background processing“ modes.
Next, in the Info.plist
, add the following task identifier com.refinery89.background
under the BGTaskSchedulerPermittedIdentifiers
key, as shown below
<dict> ... <key>BGTaskSchedulerPermittedIdentifiers</key> <array> <string>com.refinery89.background</string> </array> ... </dict>