WebViews show HTML content inside your iOS app. Because the HTML site is not part of the app's compiled source, the SDK cannot directly track interactions inside it. Instead, the Mapp Intelligence Pixel (v4, Tag Integration, or SmartPixel) running inside the WebView reports back to the SDK via a JavaScript bridge. The SDK then sends the requests using the app's known user and system context — no session break, no path break.
Limitations
Only
WKWebViewis supported (WebKit framework).Minimum supported iOS: iOS 12 (matches the SDK target).
SFSafariViewControllerfrom theSafariServicesframework is not supported.The HTML page must include the Mapp Intelligence Pixel and use the matching JavaScript bridge that the SDK injects via
WKWebViewConfiguration.
Wire up WebView tracking
Use MIWebViewTracker.sharedInstance().updateConfiguration(_:) to inject the bridge into your WKWebViewConfiguration. Then create the WKWebView with that configuration:
import WebKit
import MappIntelligence
override func viewDidLoad() {
super.viewDidLoad()
let request = URLRequest(url: URL(string: "https://demoshop.mapp.com/web2app/index.html")!)
let configuration = WKWebViewConfiguration()
_ = MIWebViewTracker.sharedInstance()?.updateConfiguration(configuration)
let webView = WKWebView(frame: self.view.frame, configuration: configuration)
self.view.addSubview(webView)
webView.load(request)
}#import <WebKit/WebKit.h>
#import <MappIntelligenceiOS/MIWebViewTracker.h>
- (void)viewDidLoad {
[super viewDidLoad];
NSURLRequest *request = [[NSURLRequest alloc]
initWithURL:[[NSURL alloc] initWithString:@"https://demoshop.mapp.com/web2app/index.html"]];
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
[[MIWebViewTracker sharedInstance] updateConfiguration:configuration];
WKWebView *webView = [[WKWebView alloc] initWithFrame:self.view.frame
configuration:configuration];
[self.view addSubview:webView];
[webView loadRequest:request];
}What this delivers
HTML interactions inside the WebView are reported by the pixel and bridged into the SDK queue.
Requests are attributed to the same user (
everID) and session as native app tracking.No additional tracking IDs or sessions are introduced when the user moves from native screens into a WebView and back.
MIWebViewTrackerlives in theMappIntelligenceiOSmodule — make sure you link that target if you use Swift Package Manager.
Related: Add the SDK Dependency, Pages.