This page explains how to configure Transaction Analytics and Data Collectors for Node.js and PHP applications. 

Before You Begin

Make sure you have installed and configured the components described in Installing Agent-Side Components and, for on-premises, Custom Install and Events Service Deployment before attempting to configure Transaction Analytics.

Configure Analytics for Node.js

Collect Default Node.js Transaction Data

To configure the Node.js Agent to send the default transaction data to the Analytics Agent, modify the require statement in your application.

Add the following variables with the proper values to point to your Analytics Agent:

analytics: {
    host: <analyticsHostName>,
    port: <analyticsPort>,
    ssl: <true || false> 
}
CODE

The Analytics Agent can be on the same host as the Node.js Agent or on a different host. See Install the Node.js Agent.

Your require statement should look similar to the following example where your Analytics Agent is on localhost and listening on Port 9090:

require("appdynamics").profile({
  controllerHostName: '<controller host name>',
  controllerPort: <controller port number>, 
  controllerSslEnabled: false,  // Set to true if controllerPort is SSL
  accountName: '<AppDynamics_account_name>',
  accountAccessKey: '<AppDynamics_account_key>', //required
  applicationName: 'your_app_name',
  tierName: 'choose_a_tier_name', 
  nodeName: 'choose_a_node_name',
  analytics: {
    host: 'localhost',
    port: 9090,
    ssl: false }
});
CODE

Node.js Data Collectors

You can also collect additional data from your Node.js business transactions by using the Node.js API. To configure Transaction Analytics data collectors for Node.js, see txn.addAnalyticsData() in the Node.js Agent API Reference.

Configure Analytics for PHP Applications

Transaction Analytics Configuration

  1. In Transaction Analytics - Configuration, click the Enable Analytics checkbox to enable/disable Application Analytics on a PHP application.
  2. To the right of Business Transactions, click the Enable Analytics checkbox to enable/disable Application Analytics on any Business Transaction(s) in the application.

Analytics data cannot be collected from PHP CLI programs at this time.

To collect Transaction Analytics from the PHP Agent:

  1. Configure the PHP Agent to send the default transaction data to the Analytics Agent. Modify the .ini file depending on the operating system under which your PHP Agent is installed. 
    By default, your .ini file contains the following configuration where your Analytics Agent is on localhost and listens to Port 9090:

    agent.analyticsHostName = localhost
    agent.analyticsPort = 9090
    CODE

    Add the following variables with the proper values to point to your Analytics Agent:

    agent.analyticsHostName = <analyticsHostName>
    agent.analyticsPort = <analyticsPort>
    CODE

    The Analytics Agent can either be on the same host as the PHP Agent, or on a different host. For information about installing the PHP Agent, see Install the PHP Agent.

    You must set the node level setting analytics-dynamic-service-enabled=true for reporting analytics.

  2. HTTP/Method Invocation Data collectors for Analytics must be enabled for both transaction snapshots and Transaction Analytics to report data from the PHP Agent.
    In order to collect the method return value with an MIDC, the value must be assigned to a variable.

    $ret = function()
    CODE

    If the return value is not stored in any variable, it displays as null in both snapshot and Analytics data.