Overview

Real User Monitoring allows you to monitor web views and eliminate blind spots in your hybrid iOS and tvOS applications.

You can perform the following:

  • Track user journeys across web and native components in mobile applications
  • Scope the root cause of latency to web pages or native components in mobile applications
  • Support users that have difficulty loading web pages on mobile devices

Setup

Prerequisites

Set up the web page you want rendered on your mobile iOS and tvOS application with the RUM Browser SDK first. For more information, see RUM Browser Monitoring.

Declare DatadogWebViewTracking as a dependency

To enable Crash Reporting, make sure to also enable RUM and, or Logs. Then, add the package according to your dependency manager and update your initialization snippet.

You can use CocoaPods to install dd-sdk-ios:

pod 'DatadogWebViewTracking'

To integrate using Apple’s Swift Package Manager, add the following as a dependency to your Package.swift:

.package(url: "https://github.com/Datadog/dd-sdk-ios.git", .upToNextMajor(from: "2.0.0"))

In your project, link the following libraries:

DatadogCore
DatadogWebViewTracking

You can use Carthage to install dd-sdk-ios:

github "DataDog/dd-sdk-ios"

In Xcode, link the following frameworks:

DatadogWebViewTracking.xcframework

Instrument your web views

The RUM iOS SDK provides APIs for you to control web view tracking. To enable Web View Tracking, provide the WKWebView instance.

import WebKit
import DatadogWebViewTracking

let webView = WKWebView(...)
WebViewTracking.enable(webView: webView, hosts: ["example.com"])

To disable Web View Tracking:

WebViewTracking.disable(webView: webView)

Access your web views

Your web views appear as events and views in the RUM Explorer with associated service and source attributes. The service attribute indicates the web component the web view is generated from, and the source attribute denotes the mobile application’s platform, such as iOS.

Filter on your iOS and tvOS applications, and click a session. A side panel with a list of events in the session appears.

Webview events captured in a session in the RUM Explorer

Click Open View waterfall to navigate from the session to a resource waterfall visualization in the view’s Performance tab.

Further Reading

Additional helpful documentation, links, and articles: