On this page
Connect the website inside your Android WebView to CUX without treating it as a native screen image. The native app and website use separate CUX projects and keep separate visits.
Applies to native Android SDK 1.2.0. A compatible web collector and configured project pair are also required. Contact CUX to confirm them before enabling the bridge.
Prepare your projects
Use a mobile project for the app and a separate web project for the website. Both projects must belong to the same organization.
Add the web project's collector to the website displayed in WebView. Use the mobile project token in Android and the web project token on the website. Do not swap them or add a second collector alongside an existing one.
CUX will confirm the compatible collector and how to configure the project pair. Android registration alone does not connect the projects.
Choose the allowed origin
An origin contains the scheme, host and optional port. For https://shop.example.com/checkout?step=payment, the origin is https://shop.example.com.
Use exact HTTPS origins that match the agreed web project configuration. Do not use *, HTTP origins, paths, query parameters or fragments in the allowed-origin set.
Register before loading the website
Register each actual WebView on the main thread before its first loadUrl():
import io.cux.analytics_sdk.CuxAnalytics
webView.settings.javaScriptEnabled = true
webView.settings.domStorageEnabled = true
CuxAnalytics.registerWebView(
webView,
setOf("https://shop.example.com")
)
webView.loadUrl("https://shop.example.com/checkout")
webView is your existing Android WebView. Replace the example origin and URL with your own approved values. Registration preserves your WebViewClient.
The website must load its collector inside WebView as well as in an ordinary browser. Check that its CSP and network settings allow the scripts and connections required by the collector confirmed by CUX.
Remove registration during cleanup
Before destroying the WebView, remove its registration:
CuxAnalytics.unregisterWebView(webView)
Then perform your existing WebView cleanup. In a Fragment, this belongs in the cleanup path for the View that owns it, usually onDestroyView().
Check Android System WebView support
The bridge requires WEB_MESSAGE_LISTENER and DOCUMENT_START_SCRIPT support. Availability depends on Android System WebView, not only on the Android OS version.
If those features are unavailable, the bridge does not run. The registered WebView area remains hidden in mobile screenshots. Updating the SDK does not guarantee bridge support on every device.
Verify both privacy paths
Mobile screenshots hide the registered WebView area. The web collector records the website and applies its own masking rules.
Check sensitive content in both projects. A mobile mask does not automatically configure the website's masks, and registering WebView does not replace web consent handling.
Verify the connection
- Ask CUX to confirm the collector, project pair and origin configuration.
- Enter WebView from a native test screen, interact with the website and return to the app.
- Check the mobile and web visits with CUX and confirm the connection.
- Repeat on the Android System WebView versions your app supports.
- Inspect sensitive content and consent behavior on both sides.
Provide project names or IDs, the origin, a test path, app build and reproduction steps. Do not send project tokens or customer data.
If only a masked native area appears, use WebView troubleshooting.