This page describes how to instrument a browser application by automatically injecting the JavaScript Agent. Automatic injection uses AppDynamics server-side agents to automatically add the adrum header and footer to each of your web pages.

Automatic Injection Support for Server-side Agents

The Java Agent and .NET Agent support automatic injection. See .NET Supported Environments for version specifics. 

Automatic injection is available only for server-side applications built on these environments:

  • Jasper-supported JSP (Java)
  • ASP.NET Core
  • ASPX (.NET) Framework
  • Although the Apache Agent does not support automatic injection, you can configure Apache or Nginx to inject the JavaScript Agent.
  • If the server-side application does not return well-formed HTML, the JavaScript Agent may not be able to instrument the page. For example, the JavaScript Agent may not be able to instrument HTML pages that are missing elements or have unclosed tags.

JavaScript Agent and Controller Versions

The table below lists the Javascript Agent version deployed for auto-injection in each Controller version.

The JavaScript Agent version does not match the Controller version because the Controller and agents have different release cycles.

Controller VersionJavaScript Agent Version Supported for Auto-Injection

Access the User Experience App Integration Panel

  1. From the Applications page, open the business application that you want to automatically inject the JavaScript Agent into your browser application.
  2. From the left navigation bar, select Configuration.
  3. Click User Experience App Integration.

Enable Business Transaction Correlation

From the Business Transaction Correlation, check the Enable Business Transaction Correlation check box to correlate Pages and Ajax requests with server-side business transactions. 

Specify Business Transactions to Include Correlation Headers

You can also specify which business transactions will include or exclude correlation headers. If you do not add request match rules or request exclude rules, correlation headers will be added to all requests.

To add a request rule:

  1. Click the plus icon. The Create HTTP Request Match Rule will display.
  2. Check the Method checkbox and select an HTTP method that you want to match.
  3. Check the URI checkbox and enter your criteria.
  4. Click Save.

Enable Automatic Injection

  1. Select the JavaScript Agent Injection tab.
  2. From the Inject the JavaScript Agent configured for this Browser App dropdown, select the browser application you want to use automatic injection.
  3. Check the Enable Automatic Injection of JavaScript check box to enable automatic injection.
  4. If you enabled automatic injection, click OK in the Confirm Enabling Automatic Injection dialog.
  5. Click Save in the outer configuration pane.

Configure Automatic Injection

After you have enabled automatic injection:

  • You must specify the server-side business transactions for which automatic JavaScript injection is enabled.
  • You can limit which pages to inject by creating custom match and exclude rules for automatic injection. If you do not configure these rules, by default AppDynamics injects all pages visited by the enabled business transactions.

Use these rules to fine-tune which business transactions to include or exclude from injection based on match criteria. For example, you can exclude all business transactions that have a certain string in their URLs or set a certain cookie. The configurations for include rules and exclude rules are similar. It depends on your situation whether it is more convenient to restrict transactions based on inclusion or exclusion.

Specify Business Transactions for Automatic Injection

You must select at least one business transaction for automatic injection.

  1. From the list on the right shown in the screenshot, select one or more business transactions. (If you don't see any business transactions, click Refresh List.) Not all your business transactions may appear hereā€”the list includes only those transactions that AppDynamics can parse for automatic injection, those based on Jasper-compiled JSPs or ASP.NET, ASP.NET Core, or ASPX.NET pages.

  2. Click < Add to move the business transaction to the list on the left.
  3. Repeat until all the transactions you wish to enable are on the left and those you do not wish to enable are on the right.
    Automatic JavaScript Injection
  4. Click Save.

Create Match Rules for Automatic Injection

You may not wish to instrument every page in your application. For example, if your application has a very large number of pages, you might want to instrument only the key ones for your business, to avoid hitting licensing limits. Or, when you are in the setup and test phase, you might only want to instrument a few pages to keep your initial sample manageable. 

Use match rules to include or exclude certain pages:

  1. Expand Only enable Automatic Injection for certain Pages if it is closed.
     Request Match Rules
  2.  Click the plus icon to create a match rule or an exclude rule. The Create HTTP Request Match Rule dialog displays.
     Create HTTP Request Match Rule
  3. Select one or more criteria to match. If you select multiple criteria, all must match for the rule to come into effect. Use the gear icon to set a NOT condition. See Using Regular Expressions for general information about match rules.
  4. Click Save.
  5. Click Save in the outer configuration pane.

You can later edit or remove a match rule by selecting it in the list and clicking the edit or delete icon.