Comment ça marche ?
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
Qu'est-ce qu'il faut ?
- Commencez par créer un compte chez nous. Contactez-nous pour initier le processus et fournir toutes les informations nécessaires énumérées ci-dessous.
- Add the Initialization code.
- Follow This Guide
- Your web-app is now prepared for monetization with us.
Informations dont nous avons besoin concernant votre application
- Lien du magasin (Google ou Pomme une).
- Domain of the app. E.g.: www.refinery89.com.
Exemples
At the end of the example, you can find a modèle de production ici.
Si vous êtes en mode Debug, veuillez ajouter ces lignes avant tous les exemples. Marquer le SDK comme Debug fera en sorte que le SDK utilise les identifiants et les données de ConfigBuilder.
R89SDK.shared.setLogLevel(level: LogLevels.debug)
R89SDK.shared.setDebug(getLocalFakeData: true,
forceCMP: true,
useProductionAuctionServer: false)
L'exemple dans la démo
Le ligneUnique drapeau est réglé à 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)
Modèle
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 et 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)
}