RUM JavaScript API - 1.345.1
    Preparing search index...

    Function isEnabled

    • Safe wrapper for dynatrace.isEnabled which returns false if RUM JavaScript is not available.

      Indicates whether RUM JavaScript is currently enabled, taking into account the opt-in mode settings and the current opt-in (consent) state.

      Returns boolean

      true if RUM JavaScript is enabled, otherwise false (including when RUM JavaScript is not available).

      import { isEnabled, sendEvent } from '@dynatrace/rum-javascript-sdk/api';

      // Skip expensive computation when the agent is not collecting data
      if (isEnabled()) {
      const payload = buildExpensiveAnalyticsPayload();
      sendEvent(payload);
      }