How Does It Work?
We configure your webview to create a channel between our web header script and the Native SDK, this enables better privacy compliance and targeting.
With this in place you can use loadUrlWithConsentDataOrWait to load the URL with consent data
What Is Needed?
- Comience creando una cuenta con nosotros. Contact us para iniciar el proceso y proporcionar toda la información necesaria que se detalla a continuación.
- Add the Initialization code.
- Follow This Guide
- Your web-app is now prepared for monetization with us.
Información que necesitamos sobre tu aplicación
- Enlace de la tienda (métricas de Google o Manzana uno).
- Dominio de la aplicación. Por ejemplo: www.refinery89.com.
Ejemplos
At the end of the example, you can find a plantilla de producción aquí.
If you are in Debug mode, please add these lines before any of the examples. Marking the SDK as Debug will make the SDK use ConfigBuilder IDs and data.
R89SDK.shared.setLogLevel(level: LogLevels.debug)
R89SDK.shared.setDebug(getLocalFakeData: true,
forceCMP: true,
useProductionAuctionServer: false)
The example in the demo
El línea única bandera está establecida en false. Use the RefineryAdFactory to create and place the ADs in a UIView.
@IBOutlet var wkWebView: WKWebView!
R89SDK.shared.initialize( publisherId: "TestRefinery89ID",
appId: "TestAppId",
singleLine: false,
publisherInitializationEvents: nil)
let url = "https://refinery89.com/"
wkWebView.navigationDelegate = self
let userAgent = R89SDK.shared.getUserAgent(webView: wkWebView, siteName: "WebViewDemo")
R89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)
R89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)
Plantilla
R89SDK.shared.initialize(publisherId: <YOUR PUBLISHER ID>,
appId: <YOUR APP ID>,
singleLine: false,
publisherInitializationEvents: nil)
let url = <YOUR URL>
wkWebView.navigationDelegate = self
let userAgent = R89SDK.shared.getUserAgent(webView: wkWebView, siteName: "WebViewDemo")
R89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)
R89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)
Initialization
To initialize the SDK call R89SDK.shared.initialize method and pass the publisherId y appId.
class MainViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
R89SDK.shared.initialize(publisherId: "TestRefinery89ID",
appId: "TestConfigDemoApp",
singleLine: false,
publisherInitializationEvents: nil)
}
}
After initilization you can configure your WebView using R89SDK.shared.configureWebView. You will also need to create userAgent for your webView, you can do so with R89SDK.shared.getUserAgent.
class MainViewController: UIViewController {
@IBOutlet var adContainer:UIView! = nil
override func viewDidLoad() {
super.viewDidLoad()
R89SDK.shared.initialize(publisherId: <YOUR PUBLISHER ID>,
appId: <YOUR APP ID>,
singleLine: false,
publisherInitializationEvents: nil)
let url = "https://refinery89.com/"
wkWebView.navigationDelegate = self
let userAgent = R89SDK.shared.getUserAgent(webView: wkWebView, siteName: "WebViewDemo")
R89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)
R89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)
}
}
At this point, the advertisements can be displayed. To place a simple banner Ad add RefineryAdFactory.shared.createBanner like in the example below. The SDK will put the advertisement inside the provided adContainer.
class MainViewController: UIViewController {
@IBOutlet var adContainer:UIView! = nil
override func viewDidLoad() {
super.viewDidLoad()
R89SDK.shared.initialize(publisherId: <YOUR PUBLISHER ID>,
appId: <YOUR APP ID>,
singleLine: false,
publisherInitializationEvents: nil)
let url = "https://refinery89.com/"
wkWebView.navigationDelegate = self
let userAgent = R89SDK.shared.getUserAgent(webView: wkWebView, siteName: "WebViewDemo")
R89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)
R89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)
RefineryAdFactory.shared.createBanner(configurationId: <CONFIGURATION ID>, wrapper: adContainer, lifecycleCallbacks: nil)
}
}
Note that no need to await for SDK initialization, advertisements can be used right after calling the R89SDK.shared.initialize method.
If your webPage, that you want to load in a webView, already has CMP and you dont want for both CMPs ro show, you can use R89SDK.shared.addScriptToNotShowCMPInWebView to add script to webView and disable web CMP.
func webView(_ webView: WKWebView) {
R89SDK.shared.addScriptToNotShowCMPInWebView(webView: webView)
}