Documentation - v7.19.0
    Preparing search index...

    Interface RumPluginOnInitOptionsExperimental

    onInit plugin API options.

    interface RumPluginOnInitOptions {
        initConfiguration: RumInitConfiguration;
        isTrackingConsentGranted: () => boolean;
        publicApi: DatadogRum;
        registerAssembleEventHook: (
            this: void,
            callback: (
                params: AssembleHookParams,
            ) => "DISCARDED" | "SKIPPED" | DefaultRumEventAttributes,
        ) => { unregister: () => void };
        registerEventCollectedHook: (
            this: void,
            callback: (params: EventCollectedHookParams) => void,
        ) => { unregister: () => void };
    }
    Index
    initConfiguration: RumInitConfiguration
    isTrackingConsentGranted: () => boolean

    Whether tracking consent is granted, whether it was set with the trackingConsent init option or with setTrackingConsent(), including before init(). RUM doesn't start until it is.

    publicApi: DatadogRum
    registerAssembleEventHook: (
        this: void,
        callback: (
            params: AssembleHookParams,
        ) => "DISCARDED" | "SKIPPED" | DefaultRumEventAttributes,
    ) => { unregister: () => void }

    Register a callback invoked when a RUM event is assembled, so plugins can enrich or override event fields before they are sent. Callbacks registered in onInit run before any event is assembled, including events buffered during the pre-start phase.

    Type Declaration

      • (
            this: void,
            callback: (
                params: AssembleHookParams,
            ) => "DISCARDED" | "SKIPPED" | DefaultRumEventAttributes,
        ): { unregister: () => void }
      • Registers a callback and returns a handle to unregister it.

        Parameters

        • this: void
        • callback: (
              params: AssembleHookParams,
          ) => "DISCARDED" | "SKIPPED" | DefaultRumEventAttributes

        Returns { unregister: () => void }

    registerEventCollectedHook: (
        this: void,
        callback: (params: EventCollectedHookParams) => void,
    ) => { unregister: () => void }

    Register a callback invoked when a RUM event is collected, once beforeSend and the event rate limits have let it through, right before it is sent. Plugins can use it to send data related to an event only if the event itself is sent.