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 |
|---|---|
|
|
Monitoring configuration to apply. |
|
|
When |
🛑 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 |
Does not remove the |
|
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 |
|---|---|
|
|
When |
🗑️ 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 |
|---|---|
|
|
When |
|
|
When |
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 of the event. |
|
|
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 of the metric. |
|
|
Numeric value to record. |
|
|
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 of the transaction. |
|
|
Transaction duration. Use seconds for consistency with other GermainUX transactions. |
|
|
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 |
|---|---|
|
|
Unique transaction name. The same name must be used when starting and ending the transaction. |
|
|
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 |
|---|---|
|
|
Severity level assigned to the log. |
|
|
Primary log message. |
|
|
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 |
|---|---|
|
|
Configure the log level to collect. |
|
|
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: