Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • DtrumApi

Index

Methods

  • Sets the actionName of the currently active action, or the action with the provided id

    Parameters

    • actionName: string

      The new name of the action

    • Optional actionId: number

      The action ID of the to be updated action name

    Returns ActionNameResult

    an ActionNameResult whether the process was successful

  • Adds custom action properties to the currently active action.
    Only accepts valid java long, java double (as a string representation), Date objects, and short strings with a maximum length of 100 characters.
    Action properties must be defined first under Application settings and use a lower case key.

    see

    sendSessionProperties

    Parameters

    • parentActionId: number

      ID of the action.

    • Optional javaLong: PropertyMap<number>

      JSON object containing key value pairs of valid numbers.
      Value should be between range -9223372036854776000 & 9223372036854776000

    • Optional date: PropertyMap<Date>

      JSON object containing key value pairs of JavaScript Date objects.
      Value should be JavaScript Date object

    • Optional shortString: PropertyMap<string>

      JSON object containing key value pairs of strings.
      Value character count should be less than 100 characters

    • Optional javaDouble: PropertyMap<number>

      JSON object containing key value pairs of valid floating point numbers.
      Value should be between range -1.7976931348623157e+308 & 1.7976931348623157e+308

      Each key value pair must be defined in the following format 'key: { value: value, public?: boolean }' Public property is optional and if not declared as true values will be sent as masked(dT_pv) in doNotTrack mode

    Returns void

  • Attaches a listener that gets called while entering an action
    Remove the listener if not needed or make sure to filter actions if using addActionProperties, to prevent sending the same action property for every action. Use to hook into automatic action creation event to influence related concepts like action naming or action properties.

    see

    removeEnterActionListener

    see

    actionName

    see

    addActionProperties

    Parameters

    Returns void

  • Attaches a listener that gets called when leaving an action
    Remove the listener if not needed or make sure to filter actions if using addActionProperties, to prevent sending the same action property for every action. Use to hook into the out of the box action closing event.

    see

    removeLeaveActionListener

    see

    addActionProperties

    Parameters

    Returns void

  • Adds a listener that is called when the user is leaving the page, but before the RUM monitoring beacon is sent Use when you want to hook into the unload of the page.

    Parameters

    • listener: PageLeaveListener

      A function that will be called in case the user leaves the page

    Returns void

  • addVisitTimeoutListener(listener: (visitId: string, newVisitAfterTimeout: boolean) => void): void
  • Adds a listener that gets triggered when the current visit times out and before a new visit id is generted.

    Parameters

    • listener: (visitId: string, newVisitAfterTimeout: boolean) => void

      The listener to add

        • (visitId: string, newVisitAfterTimeout: boolean): void
        • Parameters

          • visitId: string
          • newVisitAfterTimeout: boolean

          Returns void

    Returns void

  • beginUserInput(domNode: string | HTMLElement, type: string, addInfo?: string, validTime?: number): DtRumUserInput
  • Indicates the start of a user input. User inputs must always be stopped by calling endUserInput. If an XHR call or a page load happens, the RUM monitoring code checks if a user input is active. If so, that user input is set to have triggered the user action. Use when a user input is not automatically detected by the RUM monitoring code.

    see

    endUserInput

    Parameters

    • domNode: string | HTMLElement

      DOM node which triggered the action (button, etc) or a string is used for determining its caption

    • type: string

      Type of action: 'click', 'keypress', 'scroll',...

    • Optional addInfo: string

      Additional info for user input such as key, mouse button, etc ('F5', 'RETURN',...)

    • Optional validTime: number

      How long this userInput should be valid(in ms)

    Returns DtRumUserInput

    An object containing all the information about the userInput

  • disable(): void
  • Disables the RUM monitoring code and removes all cookies in case dtrum.enable() has been called earlier, enabling the opt-in mode. Use in combination with a user consent tool to disable RUM monitoring in case the consent has not been provided.

    see

    enable

    Returns void

  • disablePersistentValues(remember: boolean): void
  • Removes all traces of persistent values and disables all functionality that would recreate one. Note that this has to be called on every page, since it removes persistent RUM monitoring data, including the information that persistent data shouldn't be stored. Use when you want to disable monitoring of returning users. Read more about cookie storage.

    Parameters

    • remember: boolean

      If true, this configuration state is persisted in local storage, so that it doesn't reset on each page load

    Returns void

  • disableSessionReplay(): void
  • Disables session replay

    Returns void

  • enable(): void
  • Enables the RUM monitoring code in case it was initially disabled via the opt-in mode. Use in combination with a user consent tool to enable RUM monitoring in case the consent has been provided.

    see

    disable

    Returns void

  • enableManualPageDetection(): void
  • Enables manual page detection. After this is called the RUM monitoring code will stop detecting page and page group names automatically and only accepts them via setPage. It is recommended to call this as early as possible.

    Returns void

  • enablePersistentValues(): void
  • Enables persistent values again. Only applies if 'disablePersistentValues' has been called previously. Use when you want to re-enable monitoring returning users.

    Returns void

  • enableSessionReplay(ignoreCostControl: boolean): void
  • Enables session replay

    Parameters

    • ignoreCostControl: boolean

      Allows to enable session replay despite cost control configuration

    Returns void

  • endSession(): void
  • Ends the currently active session immediately.

    Returns void

  • enterAction(actionName: string, actionType?: string, startTime?: number, sourceUrl?: string): number
  • Enters a new custom action. Use to set the load start event for a new custom action. Needs to be called before leaveAction, which closes the custom action.

    see

    leaveAction

    Parameters

    • actionName: string

      Name of the action

    • Optional actionType: string

      Type of the action (e.g., can be 'click', 'load', 'KD',...) - DEPRECATED: not used any more, will be removed in June 2022.

    • Optional startTime: number

      Timestamp in milliseconds. if null, current time is used.

    • Optional sourceUrl: string

      Source url for the action

    Returns number

    ID of the created action

  • enterXhrAction(type: string, xmode?: 0 | 1 | 2 | 3, xhrUrl?: string): number
  • Extends or initiates actions. Use when you want to extend an active Load or XHR action by another unlinked XHR call (i.e., action). This is particularly useful when the XHR call in question is asynchronous in nature and therefore can't automatically be correlated to an action, which otherwise would lead to the action being closed too early and inaccurate metrics measurements (e.g., user action duration). Needs to be called before leaveXhrAction.

    see

    leaveXhrAction

    Parameters

    • type: string

      Optional additional info about type of XHR (e.g., framework name, etc.)

    • Optional xmode: 0 | 1 | 2 | 3

      XHR action creation mode 0 ... Just extend running XHR actions 1 ... Extend any running action 2 ... Extend any running action - visible subaction - DEPRECATED: use 1 instead 3 ... Start action if user input is present

    • Optional xhrUrl: string

      url of the requested resource

    Returns number

    ID of the XhrAction

  • enterXhrCallback(actionId: number): void
  • Indicates that an XHR callback is active (eg. XMLHttpRequest onreadystatechange) and relinks subsequently triggered XHR actions. For example, when an XHR callback adds a script tag to your page, any XHR call triggered by it would not be automatically added to the currently running action. Calling this function allows relinking to such a subsequent XHR call (i.e., XHR actions) to its initial action. The XHR callback must also be stopped by leaveXhrCallback.

    Parameters

    • actionId: number

      ID of the action where callback belongs to

    Returns void

  • getAndEvaluateMetaData(): { expression: string; failureReason?: string; id: string; type: string; value: string }[]
  • Get and evaluate meta-data for the page. Use to troubleshoot RUM monitoring.

    Returns { expression: string; failureReason?: string; id: string; type: string; value: string }[]

    Array of metadata objects with configured ids, type, expression, and captured values

  • identifyUser(value: string): void
  • Sets the user tag. Use to identify individual users across different browsers, devices, and user sessions.

    Parameters

    • value: string

      The name of the user. For example, use a name, userid, or your user's email address.

    Returns void

  • incrementOnLoadEndMarkers(): void
  • Signals that the load end event is provided manually. Use when you want to extend the onload duration (e.g. to encompass also the initialization of a framework)

    see

    setLoadEndManually Notifies the RUM monitoring code to wait for an additional call of signalOnLoadEnd, before closing the 'onload' action. Note: Only when signalOnLoadEnd is called after, the load action will use the provided load end event correctly.

    Returns void

  • leaveAction(actionId: number, stopTime?: number, startTime?: number): void
  • Leaves an action that has previously been created by an enterAction call. Use to set the load end event for a custom action and to complete its creation. Needs to be called after enterAction.

    see

    enterAction

    Parameters

    • actionId: number

      ID of the action to leave. must be the value returned by enterAction

    • Optional stopTime: number

      Timestamp in milliseconds. Note that, when providing a stop time, it will force stop the action and prevent visually complete from extending it.

    • Optional startTime: number

      Optional start time in milliseconds (necessary if start time should be modified). Note that, when providing a start time, it mustn't be longer than an hour in the past, otherwise the RUM monitoring code will ignore it.

    Returns void

  • leaveXhrAction(actionId: number, stopTime?: number): void
  • Indicates the end of an XHR action

    Parameters

    • actionId: number

      ID of the XHR Action

    • Optional stopTime: number

    Returns void

  • leaveXhrCallback(actionId: number): void
  • Indicates the end of an XHR callback.

    see

    enterXhrCallback

    Parameters

    • actionId: number

      ID of the action where callback belongs to

    Returns void

  • markAsErrorPage(responseCode: number, message: string): boolean
  • Report the HTTP status code and a custom message for the response of the current page. For example, use to mark your 404 pages that respond with a HTTP status code of 200. Needs to be called before the onload event of the page has finished, otherwise the information will be discarded.

    Parameters

    • responseCode: number

      Sets the HTTP status code

    • message: string

      An additional informational message

    Returns boolean

    false if the values were incorrect or the function has been called too late, true otherwise

  • markXHRFailed(responseCode: number, message: string, parentActionId?: number): boolean
  • Reports the HTTP status code and an additional message for the response of the current XHR action. For example, use when the HTTP status code of your XHR response returns 200, while the result returned by the server indicates a failed request. Needs to be called before the XHR action is finished and all listeners have been invoked.

    Parameters

    • responseCode: number

      The response code of the current XHR action

    • message: string

      An additional informational message

    • Optional parentActionId: number

      The optional ID of the action to mark as failed. If it is not present, the currently open action is used.

    Returns boolean

    false if the values were incorrect or the function has been called too late, true otherwise

  • now(): number
  • Returns the current time in milliseconds. It automatically chooses the most accurate way to determine the current time.

    Returns number

    the current time in milliseconds

  • registerPreDiffMethod(method: (diff: string) => string): void
  • Registers a method which will be invoked before the 'diff' action in session replay during recording.

    Parameters

    • method: (diff: string) => string

      Listener which will be called before diff action. Listener receives one argument which is a string with diff. Listener also must return the diff string. Read more about cookie storage.

        • (diff: string): string
        • Parameters

          • diff: string

          Returns string

    Returns void

  • Removes a previously attached listener that detects the enter action event

    Parameters

    Returns void

  • Removes a previously attached listener that detects the leave action event

    Parameters

    Returns void

  • reportCustomError(key: string, value: string, hint?: string, parentingInfo?: number | boolean): void
  • Report your owncustom errors. For example, use when you want to capture form validation errors in your signup process. Custom errors must first be defined in the Application settings.

    Parameters

    • key: string

      The key of the error. For example, 'validation error'

    • value: string

      The error value. For example, 'Email validation failed'

    • Optional hint: string

      A hint to pinpoint the problem, e.g. content of the input element which triggered the failed validation

    • Optional parentingInfo: number | boolean

      How the custom error should be attached (default = false), [case number]: To which open action the custom error event should be attached, [case boolean]: If true it will get attached to the current active action

    Returns void

  • reportError(error: string | Error, parentActionId?: number): void
  • Reports an error object to Dynatrace. Use when you catch errors in your own application code but you also want to propagate them to Dynatrace instead of logging them yourself. If errors are handled by your own application code it will stop the error from being handled by the global JavaScript onerror event handler, which is used by Dynatrace to automatically capture JavaScritp errors.

    Parameters

    • error: string | Error

      The error to be reported. Any browser error object is supported and if the error doesn't have a stacktrace the RUM JavaScipt monitoring code will attempt to generate one. Alternatively create your own object that has the following properties set: 'message', 'file', 'line', 'column', and 'stack'. The 'message' property must be provided; all other values are optional.

    • Optional parentActionId: number

      parent action id. if not passed or null, error is added to current action

    Returns void

  • sendBeacon(forceSync: boolean, sendPreview: boolean, killUnfinished: boolean): void
  • Forces beacon sending to make sure actions aren't lost. For example, use before a window unload event by adding a addPageLeavingListener.

    see

    addPageLeavingListener

    Parameters

    • forceSync: boolean

      Force synchronous sending of beacons. If false, the beacon will be sent asynchronously.

    • sendPreview: boolean

      Force sending of preview beacons which haven't been closed yet.

    • killUnfinished: boolean

      Kills unfinished actions and sends them immediately. Handle with care, actions might be inaccurate.

    Returns void

  • Sends session properties on a beacon currently only accepts valid java long, java double (as a string representation), Date objects, and short strings of a maximum length of 100 characters.
    NOTE: session properties need to have a lower case key!

    Make sure to first define session properties under Application settings before making this API call.

    see

    addActionProperties is related and works similarly.

    Parameters

    • Optional javaLongOrObject: PropertyObject | PropertyMap<number>

      JSON object containing key value pairs of valid numbers.
      Value should be between range -9223372036854776000 & 9223372036854776000

    • Optional date: PropertyMap<Date>

      JSON object containing key value pairs of JavaScript date objects.
      Value should be JavaScript Date object

    • Optional shortString: PropertyMap<string>

      JSON object containing key value pairs of strings.
      Value character count should be less than 100 characters

    • Optional javaDouble: PropertyMap<number>

      JSON object containing key value pairs of valid floating point numbers.
      Value should be between range -1.7976931348623157e+308 & 1.7976931348623157e+308

      Each key value pair must be defined in the following format 'key: { value: value, public?: boolean }' Public property is optional and if not declared as true values will be sent as masked(dT_pv) in doNotTrack mode

    Returns void | PropertiesSendingReport

    Status report about properties that were passed to the function. It contains data about failed properties with the failure reason. Contains data about properties that were sent successfully and a general message with information about total failed properties.

  • sendSignal(forceSync: boolean, sendPreview: boolean, killUnfinished: boolean): void
  • Force signal sending to make sure that actions aren't lost (e.g., use before a window unload event).

    deprecated

    Use sendBeacon instead. We will remove "sendSignal" in June 2022.

    see

    sendBeacon

    Parameters

    • forceSync: boolean

      Force synchronous sending of signal (if false, it'll be sent asynchronously)

    • sendPreview: boolean

      Force sending of preview signals which haven't been closed yet.

    • killUnfinished: boolean

      Kills unfinished actions and sends them immediately. Handle with care, actions might be inaccurate.

    Returns void

  • setAutomaticActionDetection(enabled: boolean): void
  • Enables/disables automatic action detection. Use when you want to instrument your application only manually.

    see

    enterAction

    see

    leaveAction

    Parameters

    • enabled: boolean

      Whether automatic action detection should be enabled or disabled

    Returns void

  • setLoadEndManually(): void
  • Tells the RUM monitoring code to not automatically detect the load end event. The load end event must be set explicitly via signalLoadEnd. Needs to be called immediately after the RUM monitoring code is injected!

    Returns void

  • Starts a new page view and reports it to dynatrace server.

    Parameters

    • newPage: APIPage

      New page containing page name and page group.

    Returns number

    1 if new page is started succesfully. 2 if new page is started during onload. It means it is cached and will be sent with load action. -1 if page that is being set is the same as previous one. -2 if page is trying to be set but mechanism is not active. Probably 'dtrum.enableManualPageDetection()' was not called. Negative number means new page failed to start and positive means that new page is started successfully.

  • signalLoadEnd(): void
  • signalOnLoadEnd(): void
  • signalOnLoadStart(): void
  • Indicates the start of a load action. Frameworks often have their own load callback functions this can be used when framework starts load before 'DOMContentLoaded'.

    Returns void

  • Indicates the start of a third party resource

    deprecated

    Since modern browsers already provide resource timings, including for third parties, we will remove this function in June 2022.

    Parameters

    • type: ResourceSummaryTypes

      'i'...image, 's'...script, 'c'... custom

    • url: string

      Complete URL of resource

    Returns void

  • stopThirdParty(url: string, success: boolean, start?: number, stop?: number): void
  • Indicates the stop of a third party resource

    deprecated

    Since modern browsers already provide resource timings, including for third parties, we will remove this function in June 2022.

    Parameters

    • url: string

      Complete URL of resource (must match URL provided in startThirdParty)

    • success: boolean

      True if the resource was loaded successfully, false if not

    • Optional start: number

      Absolute start time in milliseconds. Optional. When parameter is not passed or <=0, time of startThirdParty call is used

    • Optional stop: number

      Absolute stop time in milliseconds. Optional. When parameter is not passed or <=0, time of stopThirdParty call is used

    Returns void

Generated using TypeDoc