Track Webviews
To enable WebView tracking, it is required to build a JavaScript Bridge between the content of the WebView and the native SDK. To do so, you will have to implement the Contentsquare WebView JavaScript Tracking Tag in the web pages called in your app WebViews.
For more information, refer to 📚 Mobile Apps WebView Tracking Documentation.
Once the Web Tracking Tag is implemented in the web pages, the following native API needs to be called to establish the JavaScript Bridge:
At the UIViewController level, call the register method above in the viewWillAppear method. And unregister the WebViews in the view controllers viewWillDisappear method.
Validate WebView tracking
Section titled Validate WebView trackingValidating the implementation on the native side
Section titled Validating the implementation on the native sideOnce you arrive on the screen with the tracked WebView, you should see the following log:
Once the web page is loaded in the WebView, you should see the following log:
Validating the implementation on the Web side
Section titled Validating the implementation on the Web sideOnce the Web Tracking tag is detected in the web page, you should see the following log:
Validating Pageview and Gestures tracking on the Web side
Section titled Validating Pageview and Gestures tracking on the Web side- Page views fired by the Web Tracking Tag in the same format as for screen views:
- Taps and swipes detected by the Web Tracking Tag in the same format as for defaults taps and swipe but with the end of the target containing HTML DOM elements values: