WebView Tracking Tag (deprecated)

Use this document to enable WebView tracking in your mobile app. You’ll need to implement the Contentsquare WebView JavaScript Tracking Tag in the web pages called in your mobile app to build a JavaScript Bridge between your WebView content and the native SDK.

The Webview JavaScript Tracking Tag

Section titled The Webview JavaScript Tracking Tag

The WebView JavaScript Tracking Tag is responsible to establish communication with the SDK in the parent app.

To set up, you just need to add the following lines of code on every page that will be called in a WebView of your app, either at the end of the body marker, or via a TMS.

<script type="text/javascript">
(function() {
var mt = document.createElement("script"); mt.type = "text/javascript"; mt.async = true;
mt.src = "//t.contentsquare.net/wvt/web-view.js";
document.getElementsByTagName("head")[0].appendChild(mt);
})();
</script>

This code creates a function which will add an asynchronous call to a script and then execute the function. This is a way to avoid other elements loading being blocked on the page. This reduces the impact of the tag on the page’s performances.