---
title: Track WebViews - Android (classic)
description: Track webviews with the Contentsquare Android SDK
lastUpdated: 14 April 2026
source_url:
  html: https://docs.contentsquare.com/en/android/track-webviews/
  md: https://docs.contentsquare.com/en/android/track-webviews/index.md
---

> Documentation index: https://docs.contentsquare.com/llms.txt
> Use this file to discover all available pages before exploring further.

The latest CSQ SDK is here! Learn how to [upgrade your app](https://docs.contentsquare.com/en/csq-sdk-android/experience-analytics/upgrade-from-cs-sdk/).

WebView tracking links the Contentsquare SDK to the JavaScript tag running inside your WebViews to support analytics and Session Replay for web content displayed within your app.

Android compatibility

Contentsquare **only** allows to track instances of `android.webkit.WebView`. `androidx.browser.customtabs` is **not** supported: The Contentsquare SDK **cannot** track what is happening within its context, and its content will **not** be visible in replays.

## Enable tracking in WebViews

### Where to inject your WebViews?

It is **essential** that the following steps are done before an URL is loaded in your WebView. With that in mind, you should inject your webviews in `onCreate()` in Activity and `onCreateView()` in Fragment.

No matter where you decide to add the following injection code, keep in mind that it will not take effect until the next WebView content reload.

### WebView registration

Use the following API:

```kotlin
CsWebViewManager.injectEventTrackingInterface(@NonNull WebView webView) // to start tracking the specific WebView
```

### Tag setup

To complete the implementation, inject the **CS Tag in WebView mode** on your pages.

See 📚 [Mobile Apps WebView Tracking Documentation](https://docs.contentsquare.com/en/webview-tracking-tag/#manual-injection).

## Let's sum it up

Let's illustrate our implementation with an Activity. In your `onCreate()` method, you will add the following:

```kotlin
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_web_view)


    val webView = findViewById<WebView>(R.id.webview)
    webView.settings.javaScriptEnabled = true
    webView.webViewClient = object : WebViewClient() {}


    // Inject the Bridge between the CS Tag in WebView mode and the SDK
    CsWebViewManager.injectEventTrackingInterface(webview)


    webView.loadUrl(DEFAULT_WEB_VIEW_CONTENT_URL)
    webView.reload()
}
```

If you are using Fragments, the approach is similar, but should be done in the `onCreateView()` method, as stated previously.

## Validate your implementation of WebView tracking

*Currently, there is no way of validating the implementation on the native side only.*

### Validating the implementation on the web side

Once you arrive on the screen with the tracked WebView, you should see an initial confirmation log message:

```plaintext
WebView detected and WebView tracking enabled on native side
```

Specific logs are then emitted for:

* Page views fired by the WebView Tracking Tag in the same format as for screen views: `Screenview - Screen name: {{page name given}} - Screen number: 11`
* Taps and swipes detected by the WebView Tracking Tag in the same format as for defaults taps and swipe but with the target matching an HTML DOM element value: `Tap - Target: {Last view info: div:eq(0)} - Unresponsive: false`

***Going further:*** If you still have doubt, you can look for logs by filtering on `WebViewEventProcessor`. Their presence will confirm that it is well implemented on both web and native sides.
