APIs for User Monitoring and Replay

GermainUX RUM JS provides JavaScript APIs that let developers control Real User Monitoring and create custom data points for application-specific actions, metrics, transactions, and logs.

The APIs are organized into two categories:

API category

Purpose

Monitoring Control API

Start, stop, or uninstall Real User Monitoring.

Custom Data API

Generate custom UX events, metrics, transactions, and logs.

⚙️ Monitoring Control API

⏯️ Start Monitoring

User Monitoring normally starts automatically after germainapm.js is downloaded and initialized on the monitored application.

Use start() when monitoring was previously stopped or when your application needs to start it programmatically.

germainApm.start(
    settings: MonitoringSettings,
    onAllTabs?: boolean
): void;

Parameter

Description

settings

Monitoring configuration to apply.

onAllTabs

When true, starts monitoring in all open tabs if the browser supports BroadcastChannel. When false, starts monitoring only in the active tab. Default: false.

🛑 Stop Monitoring

Use stop() to remove the active monitoring instrumentation from the application.

This method:

Action

Details

Stops monitoring immediately.

Stops monitoring immediately.

Does not flush data still waiting in the browser.

Does not flush data still waiting in the browser.

Does not remove the germainApm code from the page.

Does not remove the germainApm code from the page.

Allows monitoring to restart after a full server-side page load, hard navigation, or browser refresh.

Allows monitoring to restart after a full server-side page load, hard navigation, or browser refresh.

germainApm.stop(onAllTabs?: boolean): void;

Parameter

Description

onAllTabs

When true, stops monitoring in all monitored tabs if the browser supports BroadcastChannel. When false, stops only the active tab. Default: true.

🗑️ Uninstall Monitoring

Use uninstall() to stop monitoring, flush data available in the browser cache, and optionally remove the stored monitoring state.

Internally, this method calls germainApm.stop(onAllTabs).

germainApm.uninstall(
    clearSessionState?: boolean,
    onAllTabs?: boolean
): void;

Parameter

Description

clearSessionState

When true, removes the monitoring state and metadata stored in the browser. When false, preserves the stored state. Default: false.

onAllTabs

When true, uninstalls monitoring from all monitored tabs if the browser supports BroadcastChannel. When false, affects only the active tab. Default: false.

A custom logout handler should use:

germainApm.uninstall(true, true);

Monitoring can start again after a full server-side page load, hard navigation, or browser refresh.

👥 Custom Data API

The Custom Data API lets developers capture application-specific behavior that GermainUX does not collect automatically.

You can create:

Data type

GermainUX KPI

Custom event

Browser Event

Custom metric

Browser Metric

Custom transaction

Browser Transaction

Custom log

Germain Agent Debug

✨ Create an Event

Use createEvent() to record a custom UX event.

germainApm.api.createEvent(
    name: string,
    details?: Record<string, any>
): void;

Parameter

Description

name

Name of the event.

details

Optional object containing additional event context.

Example:

germainApm.api.createEvent('Product Added to Wishlist', {
    productId: 'SKU-123',
    category: 'Shoes'
});

This creates a data point under the Browser Event KPI.

📏 Create a Metric

Use createMetric() to record a custom numeric measurement.

germainApm.api.createMetric(
    name: string,
    value: number,
    details?: Record<string, any>
): void;

Parameter

Description

name

Name of the metric.

value

Numeric value to record.

details

Optional object containing additional metric context.

Example:

germainApm.api.createMetric('Search Result Count', 12, {
    searchTerm: 'running shoes'
});

This creates a data point under the Browser Metric KPI.

⏱️ Create a Transaction

Use custom transactions to measure the duration of an application action or business operation.

GermainUX supports two methods:

  • Provide a known duration.

  • Calculate the duration between start and end markers.

🔖 Create a Transaction with a Known Duration

germainApm.api.createTransaction(
    name: string,
    duration: number,
    details?: Record<string, any>
): void;

Parameter

Description

name

Name of the transaction.

duration

Transaction duration. Use seconds for consistency with other GermainUX transactions.

details

Optional object containing additional transaction context.

Example:

germainApm.api.createTransaction('Quote Generated', 2.45, {
    quoteId: 'Q-18425'
});

🔁 Calculate a Transaction Duration

Call startTransaction() when the operation begins:

germainApm.api.startTransaction(
    name: string,
    details?: Record<string, any>
): void;

Call endTransaction() when it finishes:

germainApm.api.endTransaction(
    name: string,
    details?: Record<string, any>
): void;

Parameter

Description

name

Unique transaction name. The same name must be used when starting and ending the transaction.

details

Optional object containing additional context for the transaction.

Example:

germainApm.api.startTransaction('login-txn');

// Application login operation

germainApm.api.endTransaction('login-txn');

The completed duration is recorded under the Browser Transaction KPI.

📄 Create a Log

Use germainApm.log() to add a custom internal monitoring log.

germainApm.log(
    level: 'TRACE' | 'INFO' | 'WARN' | 'ERROR' | 'NONE',
    message: string,
    obj?: Object
): void;

Parameter

Description

level

Severity level assigned to the log.

message

Primary log message.

obj

Optional object containing additional context.

Logs can be accessed through:

germainApm.rootWindow.state.debugLog

To collect logs as GermainUX data points, configure the following properties in the Monitoring Profile’s Init Script:

Property

Notes

MonitoringSettings.constants.logLevel

Configure the log level to collect.

MonitoringSettings.constants.logLevelToEmitAsFacts

Configure which log levels are emitted as facts.

Collected logs are available under the Germain Agent Debug KPI.

🐛 Log a Caught Exception

try {
    // Application logic
} catch (ex) {
    germainApm.log('ERROR', 'Function ABC failed.', ex);
}

🔍 Create a Trace Log

germainApm.log('TRACE', 'My trace information', {
    timestamp: Date.now(),
    details: 'Additional context'
});

Component: RUM JS

Feature Availability: