Track WebViews
Enable tracking in WebViews
Section titled Enable tracking in WebViewsInject the Bridge between the CS Tag in WebView mode and the SDK
Section titled Inject the Bridge between the CS Tag in WebView mode and the SDKThis step will inject our JavaScript Bridge in order to connect the CS Tag in WebView mode and our SDK.
In order to inject this JavaScript, you will use our CSWebView
component to render your WebView, as detailed bellow.
Here is a screen with a react-native-webview
WebView component. Let’s detail how we will inject it with the Contentsquare JavaScript WebView interface.
1. Use CSWebView component to render your WebView
Section titled 1. Use CSWebView component to render your WebViewCSWebView
component will perform all the needed task to inject and remove the injection from the WebView.
Import CSWebView
component (1) and move your current WebView implementation to the renderWebView
prop (2) in CSWebView
. The renderWebView
prop’s callBack exposes an onLayout
parameter which will be used to extract the WebView tag needed for the injection.
Pass the onLayout
parameter to the WebView’s onLayout
callBack (3).
2. Setting CSWebView URL
Section titled 2. Setting CSWebView URLCSWebView
handles internally setting the URL state. For this pass the URL to CSWebView
(1) then renderWebView
callBack will expose a URL (2) to be set on your webview (3)