Configure Hybrid Application Support

By default, the iOS Agent instruments iOS WKWebViews, but does not collect and report Ajax calls. See Hybrid Application Support for an overview and an explanation of how it works.

You can configure the static or runtime configuration to disable hybrid application support or modify its behavior. The sections below show you how to change the defaults for hybrid support through either runtime or static configuration.

Runtime Configuration for Hybrid Application Support

The code example below disables the injection of the JavaScript Agent. By disabling the injection, the WKWebViews in your application will not be instrumented and Ajax calls will not be reported.

CODE
ADEumAgentConfiguration *adeumAgentConfig = [[ADEumAgentConfiguration alloc] initWithAppKey: <#EUM_APP_KEY#>];
// Disable the JavaScript Agent Injection
adeumAgentConfig.jsAgentEnabled = NO;
[ADEumInstrumentation initWithConfiguration:adeumAgentConfig];

The JavaScript Agent injection is enabled by default. To also enable the collection and reporting of Ajax calls:

CODE
ADEumAgentConfiguration *adeumAgentConfig = [[ADEumAgentConfiguration alloc] initWithAppKey: <#EUM_APP_KEY#>];
// Enable the collection and reporting of Ajax calls
adeumAgentConfig.jsAgentAjaxEnabled  = YES;
[ADEumInstrumentation initWithConfiguration:adeumAgentConfig];

Static Configuration for Hybrid Application Support

You should use static configuration for the following reasons:

  • force the instrumentation of WKWebViews and/or Ajax calls (override the runtime configuration).
  • disable hybrid support and override the runtime configuration.
  • set the URL to your self-hosted JavaScript Extension file.

The table below describes the supported properties and provides the default value for the info.plist file.

Property Default Value Description
serverJsAgentEnabled true

If the client receives a false for this flag, then the JavaScript Agent will be disabled. Thus, the WKWebViews and Ajax requests will not be monitored.

The injection occurs during the creation of a new WKWebView. So, if a WKWebView is created when this flag is set to false, that particular WKWebView won't be instrumented even if the flag is subsequently set to true.

ForceWebviewInstrumentation false When set to true , the iOS Agent will inject the JavaScript Agent into the WKWebViews regardless of the runtime configuration.
ForceAjaxInstrumentation true When set to true , Ajax operations will always be collected and reported regardless of the runtime configuration.
ADRUMExtUrlHttp

http://cdn.appdynamics.com

The JavaScript Agent consists of two components: the base JavaScript Agent and the JavaScript Agent extension. The base JavaScript Agent is built into the Mobile Agent binary and injected according to the rules above.

After initialization, the JavaScript Agent fetches the JavaScript Agent extension from the URLs specified by these properties.

ADRUMExtUrlHttps https://cdn.appdynamics.com

Example Configuration

The example info.plist below forces the instrumentation of WKWebViews (overriding the runtime configuration), but does not force the collection and reporting of Ajax requests. The configuration also sets the URL where the JavaScript Extension file is obtained.

CODE
<plist>
  <dict>
    ...
    <key>ADEUM_Settings</key>
    <dict>
      <key>ForceWebviewInstrumentation</key>
      <true/>
      <key>ForceAjaxInstrumentation</key>
      <false/>
      <key>ADRUMExtUrlHttp</key>
      <string>http://<your-domain>/adrum.cdn</string>
      <key>ADRUMExtUrlHttps</key>
      <string>https://<your-domain>/adrum.cdn</string>
    </dict>
    ...
 </dict>
</plist>