> ## Documentation Index
> Fetch the complete documentation index at: https://docs.germainux.com/llms.txt
> Use this file to discover all available pages before exploring further.

# APIs for Salesforce (Classic, Lightning)

> GermainUX provides JavaScript APIs for extending Salesforce Real User Monitoring and Session Replay.

Components
[`Engine`](https://docs.germainux.com/main/germain-ux-engine)
[`JS Profiler`](https://docs.germainux.com/main/germain-ux-js-profiler)
[`Mobile App`](https://docs.germainux.com/main/germain-ux-mobile-app)
[`RPA Bot Recorder`](https://docs.germainux.com/main/germain-ux-rpa-bot-recorder)
[`RUM Ext`](https://docs.germainux.com/main/germain-ux-rum-extension)
[`RUM JS`](https://docs.germainux.com/main/germain-ux-rum-js)

Availability
2017.1 or later

> [card] [Prerequisites](#prerequisites)
>
> Confirm germainapm.js loads

> [card] [Salesforce security considerations](#salesforce-security-considerations)
>
> Lightning isolation limits explained

> [card] [Monitoring Control API](#monitoring-control-api)
>
> Programmatically control monitoring

> [card] [Custom Data API](#custom-data-api)
>
> Log custom Salesforce activity

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

| Resource | Link |
| - | - |
| Salesforce Monitoring Deployment | [Deploy Monitoring for Salesforce](https://docs.germainux.com/main/salesforce-monitoring-deployment.md) |
| Salesforce Monitoring Configuration | [Configure Monitoring for Salesforce](https://docs.germainux.com/main/salesforce-monitoring-configuration.md) |

## 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

> [accordion] Show all 9
>
> * Record-processing volumes
> * Caught JavaScript exceptions
> * Application-specific diagnostic details

> [!NOTE]
>
> 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](https://docs.germainux.com/main/user-monitoring-and-replay-apis.md).

That reference covers:

* Starting monitoring
* Stopping monitoring
* Uninstalling monitoring
* Creating custom events
* Creating custom metrics
* Creating transactions with known or measured durations

> [accordion] Show all 9
>
> * 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.

## Related documentation

| Document | Link |
| - | - |
| Salesforce Monitoring KPIs | [KPIs for Salesforce Monitoring](https://docs.germainux.com/main/salesforce-monitoring-kpis.md) |
| Salesforce User Monitoring and Replay | [User Monitoring and Session Replay for Salesforce Cloud (Configure)](https://docs.germainux.com/main/salesforce-user-monitoring-and-replay.md) |
| Salesforce User Click Analysis | [User Click Analysis for Salesforce Cloud (Configure)](https://docs.germainux.com/main/salesforce-user-click-analysis.md) |
| User Monitoring and Replay APIs | [APIs of User Monitoring and Session Replay](https://docs.germainux.com/main/user-monitoring-and-replay-apis.md) |
| Troubleshooting | [GermainUX Enterprise Troubleshooting](https://docs.germainux.com/main/germain-enterprise-troubleshooting.md) |

## Get Help

> [card] [Contact GermainUX Support](https://docs.germainux.com/main/support.md)
>
> The GermainUX team helps you get up and running faster, empower your team, turn data into actionable insights, and optimize performance to deliver measurable business outcomes.

> [card] Can't find what you need?
>
> Search all GermainUX docs with **Ctrl + K**, or use the feedback buttons at the bottom of this page to tell us what is missing.

The content of this document is proprietary to GERMAIN SOFTWARE.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.