APIs for Salesforce (Classic, Lightning)

⚙️ 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:

  1. Deploy and configure Salesforce user monitoring.

  2. Verify that germainapm.js loads and initializes successfully.

  3. Confirm that germainApm is available in the JavaScript execution context where the API will be called.

  4. Define any required GermainUX KPIs, business processes, rules, SLAs, or data-privacy settings.

  5. Test the implementation in a Salesforce sandbox before deploying it to production.

See:

🛡️ 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

germainApm.start()

Starts or restarts Real User Monitoring.

germainApm.stop()

Stops active monitoring without removing the GermainUX code from the page.

germainApm.uninstall()

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:

  • 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:

  • 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:

  1. Perform the instrumented action in Salesforce.

  2. Confirm that the expected data reaches GermainUX.

  3. Verify that it is associated with the correct user session, application, page, and Salesforce organization.

  4. Confirm that the data appears under the intended KPI.

  5. Review payloads for sensitive or unnecessary data.

  6. Test the behavior across Lightning, Classic, console applications, and multiple browser tabs when applicable.

ℹ️ Get Help

The Germain Team can help you set this up. Contact GermainUX Support.

 

Feature Availability: 2017.1 or later