• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

newrelic_set_user_id (PHP agent API)

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

$user_id (string)

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);
}
}
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.