For the complete documentation index, see llms.txt. This page is also available as Markdown.

WebApp Integration

This feature is supported in iOS SDK 2.27.0 and above, and JavaScript SDK 11.25.1 and above.

For information about WebApp, see the documentation.

When rendering your own website via WKWebView, you can use the following configuration to use the Hackle JavaScript SDK included in your website with the same functionality as the Hackle iOS SDK, without modifying the website code.

Once the bridge is configured, Hackle events generated in the WebView are collected through the iOS SDK.

The WebView bridge only hooks and processes data passed as a bridge from the Hackle JavaScript SDK, and passes the remaining data to the referenced delegate.

...
Hackle.app().setWebViewBridge(webView)
...

If you already have a UIDelegate in use, pass it together with this function as shown below.

  • If no UIDelegate is configured, the UIDelegate of the WebView object is referenced if it exists.

  • If a UIDelegate is configured, that delegate is referenced.

...
Hackle.app().setWebViewBridge(webView, myUiDelegate)
...

Integrating Auto-collected Events from WebView

This feature is supported in iOS SDK 2.57.0 and above, and JavaScript SDK 11.51.0 and above.

$page_view and $engagement generated on websites within the WebView are disabled by default. You can enable each auto-collected event by configuring HackleWebViewConfig when setting up the WebView bridge.

Configuration Options

Option
Default
Description

automaticScreenTracking

false

Whether to collect $page_view generated on the website

automaticEngagementTracking

false

Whether to collect $engagement generated on the website

automaticRouteTracking

true

Whether to automatically collect page information generated on the website

To automatically collect $page_view and $engagement on page navigation, set automaticScreenTracking, automaticEngagementTracking, and automaticRouteTracking all to true.

To manually collect $page_view and $engagement on page navigation, set automaticScreenTracking and automaticEngagementTracking to true, and set automaticRouteTracking to false.

Last updated