Download PDF
Download page Overview of Injection Types.
Overview of Injection Types
You need to inject the JavaScript Agent into your web pages to use Browser RUM. There are several injection types that you can use depending on your use case. This page describes the different injection types, how they work, and when to use each type.
Choosing an Injection Method
If you are uncertain which procedure to use to inject the agent into your web pages, follow these guidelines in the given order:
- If you want to use Browser RUM and do not have any app agents on the server side, use manual injection. See Manual Injection of the JavaScript Agent.
- If automatic injection is available and works for your framework, use automatic injection. Automatic injection requires the least amount of effort because you do not have to manually instrument every page. Check the matrices at Browser RUM Supported Environments to see if automatic injection has been tested in your environment. Also, see Automatic Injection of the JavaScript Agent.
- If you cannot use automatic injection, and you can edit the source code of your web pages, use manual injection. See Manual Injection of the JavaScript Agent.
- If you cannot use automatic injection, and you can edit the source code of your web application, use one of the kinds of assisted injection. See Assisted Injection-Using Attribute Injection.
Manual Injection
Manual injection is supported on all platforms and frameworks. To set up a manually injected page:
- Choose a JavaScript Agent hosting option. See JavaScript Agent Hosting Options to learn what hosting option best suits your use case.
Manually configure each page to find the location of the JavaScript Agent, so that it can be executed as the page is constructed by the browser.
For detailed instructions on using manual injection in your application, see Manual Injection of the JavaScript Agent.
Automatic Injection
If you are using a Java or .NET app agent on the server-side, and your application is running in an environment that supports any of the following:
- Apache Jasper JSP compiler (for Java) or
- ASP.NET or ASPX (for .NET) or
- ASP.NET Core (for .NET; Windows support only)
You may be able to use automatic injection, where the server-side app agent completely manages injecting the code at runtime. For instructions on using automatic injection in your application, see Automatic Injection of the JavaScript Agent.
Assisted Injection
Assisted injection is available in two variants. In both cases, some of the work is done manually by you and some of the work is done by the server-side Java or .NET app agent.
Assisted injection is currently not supported for .NET Core.
Assisted Injection Using Injection Rules (Java Only)
In this type of assisted injection, you configure rules that define which app server Java classes and methods write to the output stream of your application and the writer object that is used to do that writing. AppDynamics intercepts the method and injects the JavaScript Agent into the output stream. You also specify which server-side business transactions you wish to have instrumented in this way.
For detailed information on using this form of assisted injection, see Assisted Injection.
Assisted Injection Using Attribute Injection
In this type of assisted injection, you copy small code snippets appropriate to your framework into your page templates or other code that creates your pages. This snippet contains the two variables JS_HEADER
and JS_FOOTER
, which the app agent replaces with the appropriate information in the response object at runtime.
For detailed information on using this form of assisted injection, see Using Attribute Injection.
Container-Based Injection
If you are using Nginx or Apache as a web container or as a reverse proxy in front of your web container, you can use directives to inject the agent into the response object. See Injection Using Nginx or Injection Using Apache.