Syntax
newrelic_set_user_id(string $user_id)
Associate a unique user ID with the current transaction.
Requirements
Agent version 10.12 or higher.
Description
This API allows an application to assign a unique User ID to the current transaction.
This will allow a user to gain insight about individual end users, such as the impact of an error event.
Parameters
Parameter | Description |
---|---|
| Required. Should be a unique value (such as a UUID) that will be assigned to the current transaction. |
Return values
This function will return true
if the user ID was added successfully, otherwise false
.
Examples
function example() { if (extension_loaded('newrelic')) { // Ensure PHP agent is available $user_id = "YOUR UNIQUE USER ID"; newrelic_set_user_id($user_id); }}