Skip to main content

Registering WebViews

Starting from NAM SDK iOS 8.2.0, it is mandatory to register any WKWebView that interating NAM SDK Web with WebView registering interface, to enhance ad targeting accuracy and optimize ad revenue, by leveraging communication with Web SDK.

Registering WebViews

Apply GFPAdManager.register(_ webView: WKWebView) on any WKWebView in the app. Rest of the revenue optimizations are run internally in our SDK.

  • Register web views beforehand rendering.
  • This procedure does not change any configurations on the web views, nor does it retain reference to the web views.
WKWebView *webView = [[WKWebView alloc] init];
[GFPAdManager registerWebView:webView];

Make sure the WKWebView's Cookie Accept Policy level is set to at least .onlyFromMainDocumentDomain, while .always is recommended.

[NSHTTPCookieStorage.sharedHTTPCookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];

Examining WebView registration status

[GFPAdManager examineWebViewStatus:self.webView completion:^(NSError *javaScriptError, NSDictionary *results) {
BOOL isRegistered = [results[@"isRegistered"] boolValue];
}];