Salesforce DX project used to exercise browser-sdk behavior in a Salesforce Experience Cloud (Digital Experiences / LWR) site.
This app deploys to the same org as sf-lwc-app (alias sf-lwc-ci), site SF Experience Cloud App.
Test Datadog RUM in Experience Cloud using two initialization approaches:
- Head markup — inject the SDK in the LWR template (docs)
experienceDatadogInitLWC — load the RUM Salesforce bundle from a static resource and start views on SPA navigation
experienceHomeActionsandexperienceProductExplorer— page components for manual RUM testingexperienceDatadogInit— loadsdatadog_rum_salesforceand initializes RUM when the URL contains?init=truedatadog_rum_salesforcestatic resource metadata (the.jsbundle is gitignored and produced by the build)browser_intake_datadoghq_comCSP trusted site metadata (US1 intake endpoint)
For the canonical RUM integration setup, see
[packages/browser-rum-slim/src/salesforce/README.md](../../../packages/browser-rum-slim/src/salesforce/README.md)
and [test/apps/sf-lwc-app/README.md](../sf-lwc-app/README.md).
Deploy uses the same JWT-based flow as sf-lwc-app:
yarn salesforce:deploy-apps --app experience-cloudCredentials are set as CI variables; for local overrides, set the matching environment variables from
.env.example at the repository root.
Build the RUM Salesforce bundle, deploy metadata, and publish the site:
yarn build:apps --app sf-experience-app
yarn salesforce:deploy-apps --app experience-cloudyarn salesforce:deploy-apps --app experience-cloud deploys LWC bundles and publishes SF Experience
Cloud App so changes go live.
Regular test runs do not deploy the current SDK bundle to Salesforce. To refresh the static resource locally without deploying:
yarn build:apps --app sf-experience-appThis copies the locally built RUM Salesforce bundle into the gitignored
force-app/main/default/staticresources/datadog_rum_salesforce.js file. Playwright fulfills Salesforce
static resource requests with this local file during E2E tests.
yarn salesforce:get-urls --app experience-cloudThe site is configured for unauthenticated/public access, so this prints the published URL directly:
https://datadog--engrumdev.sandbox.my.site.com/sfexperiencecloud/.
Append ?init=true to enable the experienceDatadogInit component.
E2E tests don't use this script: they build their own URL via the JWT/REST flow in
test/e2e/lib/framework/buildSalesforceUrl.ts, and inject the RUM configuration on the page as
window.RUM_CONFIGURATION.
Build the SDK and test apps, then run the Salesforce scenario:
yarn build
yarn build:apps --app sf-experience-app
yarn test:e2e --project=chromium --grep salesforce