newrelic_name_transaction(string $name)
Set custom name for current transaction.


Sets the name of the transaction to the specified name. This can be useful if you have implemented your own dispatching scheme and want to name transactions according to their purpose. Call this function as early as possible.

Do not use brackets [suffix] at the end of your transaction name. New Relic automatically strips brackets from the name. Instead, use parentheses (suffix) or other symbols if needed.

Unique values like URLs, Page Titles, Hex Values, Session IDs, and uniquely identifiable values should not be used in naming your transactions. Instead, add that data to the transaction as a custom parameter with the newrelic_add_custom_parameter call.

Do not create more than 1000 unique transaction names (for example, avoid naming by URL if possible). This will make your charts less useful, and you may run into limits New Relic sets on the number of unique transaction names per account. It also can slow down the performance of your application.


Parameter Description



Required. Name of the transaction.

Return value(s)

Returns true if the transaction name was successfully changed. If false is returned, check the agent log for more information.


General transaction naming

You have /product/123 and /product/234. If you generate a separate transaction name for each, then New Relic will store separate information for these two transaction names. Instead, store the transaction as /product/*, or use something significant about the code itself to name the transaction, such as /Product/view:

function example() {
    if (extension_loaded('newrelic')) { // Ensure PHP agent is available

MVC framework naming

In MVC frameworks, one good option is to use the newrelic_name_transaction() call where your request is routed and name your transaction with a Controller/Action format.