User and session management

  • Latest Dynatrace
  • Explanation
  • 1-min read
  • Published Jan 12, 2026

Dynatrace allows you to identify users across sessions and devices, manage session lifecycle, and attach properties that apply to all events in a session.

Identify users

Use IdentifyUser() to tag the current session with a user identifier. This enables you to track individual users across different sessions, browsers, and devices.

Basic usage

using Dynatrace.MAUI;
// After user logs in
Agent.Instance.IdentifyUser('user@example.com');
// Or use an internal user ID
Agent.Instance.IdentifyUser('user-12345');

Remove user identification

To remove the user tag (for example, on logout), pass null or an empty string:

using Dynatrace.MAUI;
void Logout() {
// Clear user identification
Agent.Instance.IdentifyUser(null);
}

Important considerations

  • Not persisted—the user tag is not stored. You must call IdentifyUser() for every new session.
  • Automatic re-tagging—when a session splits due to idle or duration timeout, the subsequent session is automatically re-tagged with the same user identifier.
  • Privacy—consider privacy regulations when choosing what identifier to use. Hashed or anonymized IDs may be preferable.

When the user closes the app or when privacy settings change, sessions are not automatically re-tagged. You must call IdentifyUser() again after the new session starts.

Session properties

Session properties are key-value pairs that apply to all events in the current session. Use them to add context that characterizes the user's session. Event and session properties must be configured before they can be used. Incoming event and session properties that are not configured are dropped during event ingest. Read more about configuring custom events and session properties.

Send session properties

using Dynatrace.MAUI;
var sessionEventData = new SessionPropertyEventData()
.AddSessionProperty("session_properties.product_tier", "premium")
.AddSessionProperty("session_properties.loyalty_status", "gold")
.AddSessionProperty("session_properties.onboarding_complete", true);
Agent.Instance.SendSessionPropertyEvent(sessionEventData);

Property naming rules

  • Keys must be prefixed with session_properties..
  • Field names must contain only alphanumeric characters, underscores, and dots.
  • Each dot must be followed by an alphabetic character.
  • Each underscore must be followed by an alphabetic character or number.
  • Values must be primitive types (string, int, bool).

Session properties require server-side configuration in Dynatrace. Properties that are not configured will be dropped during ingest.

Limits

  • Naming:
    • Field name maximum length: 100 characters (including the event_properties. / session_properties. prefix).
    • Allowed characters in field name: A–Z, a–z, 0–9, underscore _, and dot ..
  • Counts—a maximum of 50 event and session properties can be configured.
  • Values—for event and session properties of data type string, the length is limited to 5000 characters.

Update session properties

You can send session properties multiple times during a session. However, if you send the same property multiple times, session aggregation will keep only one value (first or last, depending on configuration).

using Dynatrace.MAUI;
var firstSessionEventData = new SessionPropertyEventData()
.AddSessionProperty("session_properties.cart_value", 0);
var secondSessionEventData = new SessionPropertyEventData()
.AddSessionProperty("session_properties.cart_value", 149.99);
// Initial properties
Agent.Instance.SendSessionPropertyEvent(firstSessionEventData);
// Update after user adds items
Agent.Instance.SendSessionPropertyEvent(secondSessionEventData);

End session

Use EndSession() to manually close the current session and start a new one. All open actions are closed and sent to the server.

using Dynatrace.MAUI;
void Logout() {
// Clear user identification
Agent.Instance.IdentifyUser(null);
// End the current session
Agent.Instance.EndSession();
}

Sessions also end automatically based on idle timeout and maximum session duration configured in your Dynatrace environment.

Related tags
Digital Experience