User and session management

  • Latest Dynatrace
  • How-to guide
  • 1-min read
  • Published Dec 24, 2025

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

import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';
// After user logs in
Dynatrace().identifyUser('user@example.com');
// Or use an internal user ID
Dynatrace().identifyUser('user-12345');

Remove user identification

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

import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';
void logout() {
// Clear user identification
Dynatrace().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.

Configure event and session properties

Before you can send event or session properties from your application, you must first define them in the Dynatrace web UI. Any properties that are not pre-configured will be discarded.

To define a new property:

  1. In Experience Vitals Experience Vitals, select the frontend for which you want to add the property.
  2. Select the Settings tab, then choose Event and session properties.
  3. Select Add under either Defined event properties or Defined session properties, depending on the type of property you want to create.
  4. In the Field name box, enter a name for your property (for example, cart.total_value).
  5. Optional To make the field name case-insensitive, turn on Field name validation should be case-insensitive.
  6. From the Datatype list, select the appropriate data type for your property: string, boolean, or number.

Dynatrace automatically prefixes your field name with event_properties. or session_properties. based on the property type you selected. For example, a field name of cart.total_value will become event_properties.cart.total_value.

Send session properties

import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';
// Using constructor
Dynatrace().sendSessionPropertyEvent(SessionPropertyEventData(
sessionProperties: {
'session_properties.product_tier': 'premium',
'session_properties.loyalty_status': 'gold',
'session_properties.onboarding_complete': true,
},
));
// Using addSessionProperty method
Dynatrace().sendSessionPropertyEvent(SessionPropertyEventData()
..addSessionProperty('session_properties.product_tier', 'premium')
..addSessionProperty('session_properties.loyalty_status', 'gold')
..addSessionProperty('session_properties.onboarding_complete', true));

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, num, 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).

import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';
// Initial properties
Dynatrace().sendSessionPropertyEvent(SessionPropertyEventData()
..addSessionProperty('session_properties.cart_value', 0));
// Update after user adds items
Dynatrace().sendSessionPropertyEvent(SessionPropertyEventData()
..addSessionProperty('session_properties.cart_value', 149.99));

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.

import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';
void logout() {
// Clear user identification
Dynatrace().identifyUser(null);
// End the current session
Dynatrace().endSession();
}

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

Related tags
Digital Experience