AppDynamics Application Intelligence Platform

3.8.x Documentation



Release Notes

Skip to end of metadata
Go to start of metadata

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

  • Enable attribute injection in AppDynamics
  • Copy code snippets into your page template 

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

  • No labels


  1. Unknown User (

    In the code snippet, it would be nice to see a distinction between VB.NET and C#.  Second, it would be nice to have "then / end if" or curly braces for consistency, when compared with snippets of other languages/frameworks.

    1. Thanks for the feedback, Eric.

      I've updated the ASP.NET example to clarify that it is C# code.

      The code snippet uses the supported syntax provided by our engineering team.

  2. Unknown User (

    A JIRA has been created.  The doc will be updated when the information is available.