{"id":10848,"date":"2024-08-30T09:17:11","date_gmt":"2024-08-30T07:17:11","guid":{"rendered":"https:\/\/refinery89.com\/?post_type=docs&#038;p=10848"},"modified":"2024-08-30T09:17:11","modified_gmt":"2024-08-30T07:17:11","slug":"webview-initialization","status":"publish","type":"docs","link":"https:\/\/refinery89.com\/fr\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/","title":{"rendered":"WebView Initialization"},"content":{"rendered":"<ul class=\"ak-ul\" data-pm-slice=\"0 0 []\">\n<li><a href=\"https:\/\/refinery89.atlassian.net\/wiki\/spaces\/R8P\/pages\/1023082540\/iOS+SDK+-+Manual+Initialization#How-Does-It-Work%3F\">How Does It Work?<\/a><\/li>\n<li><a href=\"https:\/\/refinery89.atlassian.net\/wiki\/spaces\/R8P\/pages\/1023082540\/iOS+SDK+-+Manual+Initialization#What-Is-Needed%3F\">What Is Needed?<\/a>\n<ul class=\"ak-ul\">\n<li><a href=\"https:\/\/refinery89.atlassian.net\/wiki\/spaces\/R8P\/pages\/1023082540\/iOS+SDK+-+Manual+Initialization#Information-we-require-about-your-app\">Information we require about your app<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/refinery89.atlassian.net\/wiki\/spaces\/R8P\/pages\/1023082540\/iOS+SDK+-+Manual+Initialization#Examples\">Examples<\/a>\n<ul class=\"ak-ul\">\n<li><a href=\"https:\/\/refinery89.atlassian.net\/wiki\/spaces\/R8P\/pages\/1023082540\/iOS+SDK+-+Manual+Initialization#The-example-in-the-demo\">The example in the demo<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/refinery89.atlassian.net\/wiki\/spaces\/R8P\/pages\/1023082540\/iOS+SDK+-+Manual+Initialization#Template\">Template<\/a><\/li>\n<li><a href=\"https:\/\/refinery89.atlassian.net\/wiki\/spaces\/R8P\/pages\/1023082540\/iOS+SDK+-+Manual+Initialization#Initialization\">Initialization<\/a><\/li>\n<\/ul>\n<h1>How Does It Work?<\/h1>\n<p>We configure your webview to create a channel between our web header script and the Native SDK, this enables better privacy compliance and targeting.<\/p>\n<p>With this in place you can use <span class=\"code\" spellcheck=\"false\">loadUrlWithConsentDataOrWait<\/span> to load the URL with consent data<\/p>\n<p>&nbsp;<\/p>\n<h1>What Is Needed?<\/h1>\n<ol class=\"ak-ol\" start=\"1\">\n<li>Get started by creating an account with us. <a href=\"https:\/\/refinery89.com\/fr\/lets-connect\/\">Contact us<\/a> to initiate the process and provide all the necessary information listed below.<\/li>\n<li>Add the Initialization code.<\/li>\n<li>Follow This Guide<\/li>\n<li>Your web-app is now prepared for monetization with us.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>Information we require about your app<\/h2>\n<ul class=\"ak-ul\">\n<li>Store Link (<em>Google<\/em> ou <em>Apple<\/em> one).<\/li>\n<li>Domain of the app. E.g.: <a href=\"https:\/\/refinery89.com\/fr\/\"><em>www.refinery89.com<\/em><\/a><em>.<\/em><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h1>Examples<\/h1>\n<div data-panel-type=\"note\">\n<div data-panel-content=\"true\">\n<p>At the end of the example, you can find a <strong>template for production <\/strong><a href=\"https:\/\/refinery89.atlassian.net\/wiki\/spaces\/R8P\/pages\/1023082540\/iOS+SDK+-+Manual+Initialization#Template\">ici<\/a>.<\/p>\n<\/div>\n<\/div>\n<p>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.<\/p>\n<pre><code data-language=\"swift\">R89SDK.shared.setLogLevel(level: LogLevels.debug)\r\nR89SDK.shared.setDebug(getLocalFakeData: true, \r\n                       forceCMP: true, \r\n                       useProductionAuctionServer: false)<\/code><\/pre>\n<h2>The example in the demo<\/h2>\n<p>Le <span class=\"code\" spellcheck=\"false\">singleLine<\/span> flag is set to <em>false. U<\/em>se the <span class=\"code\" spellcheck=\"false\">RefineryAdFactory<\/span> to create and place the ADs in a <span class=\"code\" spellcheck=\"false\">UIView<\/span>.<\/p>\n<pre><code data-language=\"swift\">@IBOutlet var wkWebView: WKWebView!\r\nR89SDK.shared.initialize( publisherId: \"TestRefinery89ID\",\r\n                          appId: \"TestAppId\",\r\n                          singleLine: false,\r\n                          publisherInitializationEvents: nil)\r\nlet url = \"https:\/\/refinery89.com\/\"\r\n        \r\nwkWebView.navigationDelegate = self\r\n        \r\nlet userAgent = R89SDK.shared.getUserAgent(webView: wkWebView, siteName: \"WebViewDemo\")\r\n        \r\nR89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)\r\n        \r\nR89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)<\/code><\/pre>\n<h1>Template<\/h1>\n<pre><code data-language=\"swift\">\r\nR89SDK.shared.initialize(publisherId: &lt;YOUR PUBLISHER ID&gt;, \r\n                         appId: &lt;YOUR APP ID&gt;, \r\n                         singleLine: false, \r\n                         publisherInitializationEvents: nil)\r\nlet url = &lt;YOUR URL&gt;\r\n        \r\nwkWebView.navigationDelegate = self\r\n        \r\nlet userAgent = R89SDK.shared.getUserAgent(webView: wkWebView, siteName: \"WebViewDemo\")\r\n        \r\nR89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)\r\n        \r\nR89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)<\/code><\/pre>\n<h1>Initialization<\/h1>\n<p>To initialize the SDK call <span class=\"code\" spellcheck=\"false\">R89SDK.shared.initialize<\/span> method and pass the <span class=\"code\" spellcheck=\"false\">publisherId<\/span> et <span class=\"code\" spellcheck=\"false\">appId<\/span>.<\/p>\n<pre><code data-language=\"swift\">class MainViewController: UIViewController {\r\n    \r\n    override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        R89SDK.shared.initialize(publisherId: \"TestRefinery89ID\", \r\n                         appId: \"TestConfigDemoApp\", \r\n                         singleLine: false, \r\n                         publisherInitializationEvents: nil)\r\n    }\r\n}<\/code><\/pre>\n<p>After initilization you can configure your WebView using <span class=\"code\" spellcheck=\"false\">R89SDK.shared.configureWebView<\/span>. You will also need to create userAgent for your webView, you can do so with <span class=\"code\" spellcheck=\"false\">R89SDK.shared.getUserAgent<\/span>.<\/p>\n<pre><code data-language=\"swift\">class MainViewController: UIViewController {\r\n    \r\n    @IBOutlet var adContainer:UIView! = nil\r\n    \r\n    override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        R89SDK.shared.initialize(publisherId: &lt;YOUR PUBLISHER ID&gt;, \r\n                         appId: &lt;YOUR APP ID&gt;, \r\n                         singleLine: false, \r\n                         publisherInitializationEvents: nil)\r\n                         \r\n        let url = \"https:\/\/refinery89.com\/\"\r\n        \r\n        wkWebView.navigationDelegate = self\r\n        \r\n        let userAgent = R89SDK.shared.getUserAgent(webView: wkWebView, siteName: \"WebViewDemo\")\r\n        \r\n        R89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)\r\n        \r\n        R89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)\r\n        }\r\n}<\/code><\/pre>\n<p>At this point, the advertisements can be displayed. To place a simple banner Ad add <span class=\"code\" spellcheck=\"false\">RefineryAdFactory.shared.createBanner<\/span> like in the example below. The SDK will put the advertisement inside the provided <span class=\"code\" spellcheck=\"false\">adContainer<\/span>.<\/p>\n<pre><code data-language=\"swift\">class MainViewController: UIViewController {\r\n    \r\n    @IBOutlet var adContainer:UIView! = nil\r\n    \r\n    override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        R89SDK.shared.initialize(publisherId: &lt;YOUR PUBLISHER ID&gt;, \r\n                         appId: &lt;YOUR APP ID&gt;, \r\n                         singleLine: false, \r\n                         publisherInitializationEvents: nil)\r\n                         \r\n        let url = \"https:\/\/refinery89.com\/\"\r\n        \r\n        wkWebView.navigationDelegate = self\r\n        \r\n        let userAgent = R89SDK.shared.getUserAgent(webView: wkWebView, siteName: \"WebViewDemo\")\r\n        \r\n        R89SDK.shared.configureWebView(webView: wkWebView, userAgent: userAgent)\r\n        \r\n        R89SDK.shared.loadUrlWithConsentDataOrWait(webView: wkWebView, url: url)\r\n        \r\n        RefineryAdFactory.shared.createBanner(configurationId: &lt;CONFIGURATION ID&gt;, wrapper: adContainer, lifecycleCallbacks: nil)\r\n    }\r\n}<\/code><\/pre>\n<div data-panel-type=\"info\">\n<div data-panel-content=\"true\">\n<p>Note that no need to await for SDK initialization, advertisements can be used right after calling the <span class=\"code\" spellcheck=\"false\">R89SDK.shared.initialize<\/span> method.<\/p>\n<\/div>\n<\/div>\n<p>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 <span class=\"code\" spellcheck=\"false\">R89SDK.shared.addScriptToNotShowCMPInWebView<\/span> to add script to webView and disable web CMP.<\/p>\n<pre><code>    func webView(_ webView: WKWebView) {\r\n        R89SDK.shared.addScriptToNotShowCMPInWebView(webView: webView)\r\n    }<\/code><\/pre>","protected":false},"featured_media":0,"parent":10012,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-10848","docs","type-docs","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>WebView Initialization | Refinery89<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/refinery89.com\/fr\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WebView Initialization | Refinery89\" \/>\n<meta property=\"og:description\" content=\"How Does It Work? What Is Needed? Information we require about your app Examples The example in the demo Template Initialization 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 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/refinery89.com\/fr\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/\" \/>\n<meta property=\"og:site_name\" content=\"Refinery89\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Refinery89\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/refinery89.com\/wp-content\/uploads\/2025\/08\/r89-thumbnail.png\" \/>\n\t<meta property=\"og:image:width\" content=\"200\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@refinery89\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/\",\"url\":\"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/\",\"name\":\"WebView Initialization | Refinery89\",\"isPartOf\":{\"@id\":\"https:\/\/refinery89.com\/#website\"},\"datePublished\":\"2024-08-30T07:17:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/refinery89.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android &#8211; Monetize App SDK Documentation\",\"item\":\"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Private: Use Manual\",\"item\":\"https:\/\/refinery89.com\/?post_type=docs&p=10006\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Initialization Types\",\"item\":\"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"WebView Initialization\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/refinery89.com\/#website\",\"url\":\"https:\/\/refinery89.com\/\",\"name\":\"Refinery89\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/refinery89.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/refinery89.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/refinery89.com\/#organization\",\"name\":\"Refinery89\",\"alternateName\":\"R89\",\"url\":\"https:\/\/refinery89.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/refinery89.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/refinery89.com\/wp-content\/uploads\/2025\/08\/r89-thumbnail.png\",\"contentUrl\":\"https:\/\/refinery89.com\/wp-content\/uploads\/2025\/08\/r89-thumbnail.png\",\"width\":200,\"height\":200,\"caption\":\"Refinery89\"},\"image\":{\"@id\":\"https:\/\/refinery89.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Refinery89\/\",\"https:\/\/x.com\/refinery89\",\"https:\/\/www.linkedin.com\/company\/refinery89\/\",\"https:\/\/www.youtube.com\/@refinery89\",\"https:\/\/www.instagram.com\/refinery_89\/\",\"https:\/\/www.reddit.com\/user\/Refinery89\/\",\"https:\/\/share.google\/K8hFf3ktmUrTi1XCa\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WebView Initialization | Refinery89","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/refinery89.com\/fr\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/","og_locale":"fr_FR","og_type":"article","og_title":"WebView Initialization | Refinery89","og_description":"How Does It Work? What Is Needed? Information we require about your app Examples The example in the demo Template Initialization 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 [&hellip;]","og_url":"https:\/\/refinery89.com\/fr\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/","og_site_name":"Refinery89","article_publisher":"https:\/\/www.facebook.com\/Refinery89\/","og_image":[{"width":200,"height":200,"url":"https:\/\/refinery89.com\/wp-content\/uploads\/2025\/08\/r89-thumbnail.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@refinery89","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/","url":"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/","name":"WebView Initialization | Refinery89","isPartOf":{"@id":"https:\/\/refinery89.com\/#website"},"datePublished":"2024-08-30T07:17:11+00:00","breadcrumb":{"@id":"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/webview-initialization\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/refinery89.com\/"},{"@type":"ListItem","position":2,"name":"Android &#8211; Monetize App SDK Documentation","item":"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/"},{"@type":"ListItem","position":3,"name":"Private: Use Manual","item":"https:\/\/refinery89.com\/?post_type=docs&p=10006"},{"@type":"ListItem","position":4,"name":"Initialization Types","item":"https:\/\/refinery89.com\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/"},{"@type":"ListItem","position":5,"name":"WebView Initialization"}]},{"@type":"WebSite","@id":"https:\/\/refinery89.com\/#website","url":"https:\/\/refinery89.com\/","name":"Refinery89","description":"","publisher":{"@id":"https:\/\/refinery89.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/refinery89.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/refinery89.com\/#organization","name":"Refinery89","alternateName":"R89","url":"https:\/\/refinery89.com\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/refinery89.com\/#\/schema\/logo\/image\/","url":"https:\/\/refinery89.com\/wp-content\/uploads\/2025\/08\/r89-thumbnail.png","contentUrl":"https:\/\/refinery89.com\/wp-content\/uploads\/2025\/08\/r89-thumbnail.png","width":200,"height":200,"caption":"Refinery89"},"image":{"@id":"https:\/\/refinery89.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Refinery89\/","https:\/\/x.com\/refinery89","https:\/\/www.linkedin.com\/company\/refinery89\/","https:\/\/www.youtube.com\/@refinery89","https:\/\/www.instagram.com\/refinery_89\/","https:\/\/www.reddit.com\/user\/Refinery89\/","https:\/\/share.google\/K8hFf3ktmUrTi1XCa"]}]}},"comment_count":0,"_links":{"self":[{"href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/docs\/10848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/comments?post=10848"}],"version-history":[{"count":0,"href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/docs\/10848\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/docs\/10012"}],"prev":[{"title":"Manual Initialization","link":"https:\/\/refinery89.com\/fr\/docs\/monetize-app-sdk-documentation\/use-manual\/initialization-types\/manual-initialization\/","href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/docs\/10021"}],"wp:attachment":[{"href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/media?parent=10848"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/refinery89.com\/fr\/wp-json\/wp\/v2\/doc_tag?post=10848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}