⚙️ APIs for Salesforce Classic and Lightning
GermainUX provides JavaScript APIs for extending Salesforce Real User Monitoring and Session Replay. These APIs allow developers to control monitoring programmatically and capture Salesforce-specific events, metrics, transactions, and diagnostic logs.
The APIs are provided by GermainUX RUM JS and become available through the global germainApm object after monitoring has initialized.
📑 Available APIs
|
API category |
Purpose |
Common Salesforce uses |
|---|---|---|
|
Monitoring Control API |
Start, stop, or uninstall Real User Monitoring. |
Consent management, login and logout handling, troubleshooting, and selective monitoring. |
|
Custom Data API |
Create custom events, metrics, transactions, and logs. |
Track custom Lightning components, business-process milestones, validation outcomes, integrations, and application-specific errors. |
✅ Prerequisites
Before using these APIs:
-
Deploy and configure Salesforce user monitoring.
-
Verify that
germainapm.jsloads and initializes successfully. -
Confirm that
germainApmis available in the JavaScript execution context where the API will be called. -
Define any required GermainUX KPIs, business processes, rules, SLAs, or data-privacy settings.
-
Test the implementation in a Salesforce sandbox before deploying it to production.
See:
|
Resource |
Link |
|---|---|
|
Salesforce Monitoring Deployment |
https://docs.germainux.com/main/salesforce-monitoring-deployment |
|
Salesforce Monitoring Configuration |
https://docs.germainux.com/main/salesforce-monitoring-configuration |
🛡️ Salesforce security considerations
Salesforce Lightning uses security isolation mechanisms that restrict JavaScript access across components and page contexts.
Code running inside a custom Aura or Lightning Web Component might not be able to access a germainApm instance loaded in the root Salesforce page. Likewise, component-level instrumentation does not automatically provide access to every action occurring elsewhere in the Salesforce interface.
For comprehensive monitoring of Salesforce Classic and Lightning—including standard Salesforce pages and components—deploy the GermainUX RUM Browser Extension as described in the Salesforce deployment guide.
Disabling Salesforce security controls solely to obtain broader JavaScript access is not recommended.
🎛️ Monitoring Control API
The Monitoring Control API supports the following operations:
|
Method |
Purpose |
|---|---|
|
|
Starts or restarts Real User Monitoring. |
|
|
Stops active monitoring without removing the GermainUX code from the page. |
|
|
Stops monitoring, flushes available cached data, and can clear the stored monitoring state. |
Monitoring normally starts automatically after germainapm.js has loaded and initialized. Programmatic control is primarily useful for consent workflows, authentication events, selective monitoring, and troubleshooting.
🧰 Custom Data API
Use the Custom Data API to capture Salesforce activity that GermainUX does not collect automatically or that is specific to a customized implementation.
|
Custom data type |
GermainUX KPI |
Example |
|---|---|---|
|
Event |
Browser Event |
A user submits a custom approval, encounters a validation message, or changes a workflow stage. |
|
Metric |
Browser Metric |
Number of records selected, search results returned, or items processed. |
|
Transaction |
Browser Transaction |
Duration of a custom Lightning action, Flow, integration request, or business-process step. |
|
Log |
Germain Agent Debug |
Diagnostic information or a caught JavaScript exception. |
💡 Example use cases
The APIs can be used to capture:
|
Use case |
|---|
|
Custom Lightning component actions |
|
Salesforce Flow milestones |
|
Opportunity, Case, and approval-process steps |
|
User validations and user-facing errors |
|
Custom search results |
|
Integration request durations |
|
Record-processing volumes |
|
Caught JavaScript exceptions |
|
Application-specific diagnostic details |
Do not include passwords, authentication tokens, session identifiers, protected health information, payment information, or other sensitive data in custom API payloads. Apply GermainUX masking, anonymization, and exclusion rules before production deployment.
📖 API reference
For complete method signatures, parameters, default values, examples, and behavior, see APIs for User Monitoring and Replay.
That reference covers:
|
Topic |
|---|
|
Starting monitoring |
|
Stopping monitoring |
|
Uninstalling monitoring |
|
Creating custom events |
|
Creating custom metrics |
|
Creating transactions with known or measured durations |
|
Creating diagnostic logs |
|
Logging caught exceptions |
|
Creating trace logs |
✅ Validation
After implementing a Salesforce API call:
-
Perform the instrumented action in Salesforce.
-
Confirm that the expected data reaches GermainUX.
-
Verify that it is associated with the correct user session, application, page, and Salesforce organization.
-
Confirm that the data appears under the intended KPI.
-
Review payloads for sensitive or unnecessary data.
-
Test the behavior across Lightning, Classic, console applications, and multiple browser tabs when applicable.
🔗 Related documentation
|
Document |
Link |
|---|---|
|
Salesforce Monitoring KPIs |
|
|
Salesforce User Monitoring and Replay |
https://docs.germainux.com/main/salesforce-user-monitoring-and-replay |
|
Salesforce User Click Analysis |
https://docs.germainux.com/main/salesforce-user-click-analysis |
|
User Monitoring and Replay APIs |
https://docs.germainux.com/main/user-monitoring-and-replay-apis |
|
Troubleshooting |
ℹ️ Get More Information
GermainUX can help determine which monitoring, analytics and automation capabilities are appropriate for your Salesforce CRM environment.
Component: Engine, JS Profiler, Mobile App, RPA Bot Recorder, RUM Ext
Feature Availability: 2017.1 or later