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:

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.