...
Code Block | ||
---|---|---|
| ||
import UIKit import R89SDK import WebKit class ViewController: UIViewController, WKNavigationDelegate { @IBOutlet var wkWebView: WKWebView! ... override func viewDidLoad() { super.viewDidLoad() ... let url = <YOUR-URL> wkWebView.navigationDelegate = self // This helps the channel to identify this as an app let userAgent = R89SDK.shared.getUserAgent( webView: wkWebView, siteName: <YOUR-SITE-NAME>) R89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent) ... } } |
Load URLs with consent
Use the following method to replace any webview.load()
methods you might have
Code Block |
---|
R89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)
}
func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
R89SDK.shared.addScriptToNotShowCMPInWebView(webView: webView)
}
} |
Note |
---|
This url must only be the urls related to you content, or own. Other urls can be loaded normally. with webview.loadUrl() |
Go into production
Remove the methods
R89SDK.setDebug()
Change the Google app ID in the manifest for the production one
Change the
appId
andpublisherId
in the initialization method for the production onesChange the
r89ConfigId
in the formats for the production onesit’s also recommended to remove
R89SDK.setLogLevel(LogLevels.DEBUG)
but not needed
How does it work?
Works by creating a channel linking our SDK to your current in-web monetization solutions. This channel just makes sure that the ad units on the web know that the current environment is app and also sends the consent data so you get the same consent on both sides complying with privacy policies.