Download PDF
Download page Automatic Injection of the JavaScript Agent.
Automatic Injection of the JavaScript Agent
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
- 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 Version | JavaScript Agent Version Supported for Auto-Injection |
---|---|
21.9.0 | 21.7.0 |
21.4.0 | 20.12.0 |
Access the User Experience App Integration Panel
- From the Applications page, open the business application that you want to automatically inject the JavaScript Agent into your browser application.
- From the left navigation bar, select Configuration.
- Click User Experience App Integration.
Enable Business Transaction Correlation
From Business Transaction Correlation, check the Enable Business Transaction Correlation checkbox 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:
- Click the plus icon. The Create HTTP Request Match Rule will display.
- Check the Method checkbox and select an HTTP method that you want to match.
- Check the URI checkbox and enter your criteria.
- Click Save.
Enable Automatic Injection
- Select the JavaScript Agent Injection tab.
- From the Inject the JavaScript Agent configured for this Browser App dropdown, select the browser application you want to use automatic injection.
- Check the Enable Automatic Injection of JavaScript check box to enable automatic injection.
- If you enabled automatic injection, click OK in the Confirm Enabling Automatic Injection dialog.
- 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.
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.
- Click < Add to move the business transaction to the list on the left.
- 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.
- 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:
- Expand Only enable Automatic Injection for certain Pages if it is closed.
- Click the plus icon to create a match rule or an exclude rule. The Create HTTP Request Match Rule dialog displays.
- 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.
- Click Save.
- 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.