To use assisted injection of the JavaScript agent using attribute injection, you: 

Not all frameworks support attribute injection. See the Script Injection columns in the Supported Platform Matrix for Web EUM matrices to check if you can use this method.

Access the JavaScript Injection Configuration Panel

  1. In the left navigation menu, click Configure -> Instrumentation.
  2. Click the End User Experience tab.
  3. Click the Web JavaScript Instrumentation tab if it is not already selected.
  4. Scroll down to the Advanced panel and expand it if it is closed.
  5. Expand Advanced Instrumentation of your HTML Pages if it is closed.
  6. Click the Configure JavaScript Injection tab if it is not already selected.

7. Check Request Attribute Injection.

8. Click Save.

Copy Code Snippets into Your Page Template

The following examples show code snippets that can be copied directly into your page templates or other code creating your page. These code snippets tell the app agent where to inject information. The header value must be injected at the very top of the <head> section and the footer value must be added at the very end of the code creating the page.  

(info) If you have already injected the header portion of the agent using manual injection, you can use these code snippets to automatically inject the footer data portion only.  In this case, add only the JS_FOOTER values:


<h:outputText rendered="#{AppDynamics_JS_HEADER != null}" value='#{request.getAttribute("AppDynamics_JS_HEADER")}' escape="false"/>
<h:outputText rendered="#{AppDynamics_JS_FOOTER != null}" value='#{request.getAttribute("AppDynamics_JS_FOOTER")}' escape="false"/>


<% if (request.getAttribute("AppDynamics_JS_HEADER") != null) { %> <%=request.getAttribute("AppDynamics_JS_HEADER")%> <% } %>
<% if (request.getAttribute("AppDynamics_JS_FOOTER") != null) { %> <%=request.getAttribute("AppDynamics_JS_FOOTER")%> <% } %>


if (request.getAttribute("AppDynamics_JS_HEADER") != null)
if (request.getAttribute("AppDynamics_JS_FOOTER") != null)


<g:if test="${AppDynamics_JS_HEADER}">

<g:if test="${AppDynamics_JS_FOOTER}">

Velocity Template

#if ($AppDynamics_JS_HEADER)
#if ($AppDynamics_JS_FOOTER)


<% if (Context.Items.Contains("AppDynamics_JS_HEADER"))
    Response.Write(Context.Items["AppDynamics_JS_HEADER"]); %>
<% if (Context.Items.Contains("AppDynamics_JS_FOOTER"))
    Response.Write(Context.Items["AppDynamics_JS_FOOTER"]); %>

MVC Razor

{ @Html.Raw((string)HttpContext.Current.Items["AppDynamics_JS_HEADER"]) }
{ @Html.Raw(HttpContext.Current.Items["AppDynamics_JS_FOOTER"].ToString()) }


Learn More