RUM JavaScript API - 1.345.1
    Preparing search index...

    Function addEventModifier

    • Safe wrapper for dynatrace.addEventModifier which reverts to a noop if RUM JavaScript is not available.

      Parameters

      • eventModifier: (jsonEvent: Readonly<JSONEvent>, eventContext?: EventContext) => JSONEvent

        The modifier function to modify a given (readonly) JSONEvent. It receives an optional context depending on the type of event, if available. The returned event must be a new object, otherwise modification will be ignored.

      Returns () => void

      The unsubscriber function to turn off event modification, or undefined if RUM JavaScript is not available.

      import { addEventModifier } from '@dynatrace/rum-javascript-sdk/api';

      const unsubscribe = addEventModifier((event, context) => {
      return {
      ...event,
      'event_properties.user_tier': 'premium'
      };
      });

      // Later, remove the modifier
      unsubscribe?.();