Safe wrapper for dynatrace.isEnabled which returns false if RUM JavaScript is not available.
false
Indicates whether RUM JavaScript is currently enabled, taking into account the opt-in mode settings and the current opt-in (consent) state.
true if RUM JavaScript is enabled, otherwise false (including when RUM JavaScript is not available).
true
import { isEnabled, sendEvent } from '@dynatrace/rum-javascript-sdk/api';// Skip expensive computation when the agent is not collecting dataif (isEnabled()) { const payload = buildExpensiveAnalyticsPayload(); sendEvent(payload);} Copy
import { isEnabled, sendEvent } from '@dynatrace/rum-javascript-sdk/api';// Skip expensive computation when the agent is not collecting dataif (isEnabled()) { const payload = buildExpensiveAnalyticsPayload(); sendEvent(payload);}
Safe wrapper for dynatrace.isEnabled which returns
falseif 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.