-
Notifications
You must be signed in to change notification settings - Fork 190
✨ Add initial Salesforce support. #4676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d32f6ea
Add initial Salesforce support.
BeltranBulbarellaDD c02e9bf
Guard session
BeltranBulbarellaDD 2fcb2ee
Linting
BeltranBulbarellaDD 0d952b5
Add Resources and APM support
BeltranBulbarellaDD d6d525e
Make getGlobalLocationHref mockable, patch plain usage of location
BeltranBulbarellaDD 363201b
use wire
BeltranBulbarellaDD 2655dc5
Merge branch 'main' into beltran.bulbarella/salesforce_0
BeltranBulbarellaDD 6a2eb32
Refactor for comments
BeltranBulbarellaDD 059c321
Merge branch 'main' into beltran.bulbarella/salesforce_0
BeltranBulbarellaDD f7581c2
Fix bundle
BeltranBulbarellaDD 783c96b
Use globalObject in turn of window
BeltranBulbarellaDD a8474b6
Add isCSPEventSupported function
BeltranBulbarellaDD 59232c7
Create isEventSupported and reuse it
BeltranBulbarellaDD 4f0711a
linter
BeltranBulbarellaDD 721c1a2
Remove config parameter from isEventSupported
BeltranBulbarellaDD 41a66d7
Remove views plugin and try catch debug
BeltranBulbarellaDD 045bd3c
linter
BeltranBulbarellaDD 3293b46
Fix compat
BeltranBulbarellaDD 1f4c882
Revert changes to instrumentMethod.ts
BeltranBulbarellaDD a52f0d5
Move view tracking to bundle, rename bundle
BeltranBulbarellaDD a56d75f
Merge branch 'main' into beltran.bulbarella/salesforce_0
BeltranBulbarellaDD ff6a526
Move SF packages, add README
BeltranBulbarellaDD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| # Salesforce Lightning RUM | ||
|
|
||
| This entrypoint is intended for Salesforce Lightning and LWC applications using the `rum-salesforce-lightning.js` | ||
| bundle. The SDK forces the Salesforce-specific RUM settings required for this environment: | ||
|
|
||
| - `trackViewsManually: true` | ||
| - `profilingSampleRate: 0` | ||
| - `sessionReplaySampleRate: 0` | ||
|
|
||
| ## Recommended LWC Setup | ||
|
|
||
| ```js | ||
| import { LightningElement, api, wire } from 'lwc' | ||
| import { NavigationMixin, CurrentPageReference } from 'lightning/navigation' | ||
| import rumSalesforceLightning from '@salesforce/resourceUrl/rum_salesforce_lightning' | ||
| import { loadScript } from 'lightning/platformResourceLoader' | ||
|
|
||
| export default class DatadogInit extends NavigationMixin(LightningElement) { | ||
| @api applicationId | ||
| @api clientToken | ||
| @api site | ||
| @api service | ||
| @api env | ||
|
|
||
| connectedCallback() { | ||
| this.loadDatadogRum() | ||
| } | ||
|
|
||
| @wire(CurrentPageReference) | ||
| handleCurrentPageReference(pageReference) { | ||
| if (!pageReference) { | ||
| return | ||
| } | ||
|
|
||
| this.loadDatadogRum().then(() => { | ||
| this.startPageReference(pageReference) | ||
| }) | ||
| } | ||
|
|
||
| startPageReference(pageReference) { | ||
| window.DD_RUM?.startSalesforceView?.({ | ||
| pageReference, | ||
| baseUrl: window.location.origin || window.location.href, | ||
| generateUrl: (pageReferenceToGenerate) => this[NavigationMixin.GenerateUrl](pageReferenceToGenerate), | ||
| }) | ||
| } | ||
|
|
||
| loadDatadogRum() { | ||
| return loadScript(this, rumSalesforceLightning).then(() => { | ||
| window.DD_RUM.initSalesforce({ | ||
| applicationId: this.applicationId, | ||
| clientToken: this.clientToken, | ||
| site: this.site, | ||
| service: this.service, | ||
| env: this.env, | ||
| }) | ||
| }) | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Salesforce Feature Support | ||
|
|
||
| | Feature | Supported | | ||
| | ---------------------- | ------------------------------ | | ||
| | **View Events** | | | ||
| | Initial View | ✅ | | ||
| | Manual Tracking | ✅ | | ||
| | Navigation Timings | ✅ | | ||
| | Web Vitals | ✅ | | ||
| | Automatic Tracking | ✅⚠️ Supported with workaround | | ||
| | Loading Time | ✅⚠️(1) | | ||
| | **Resource Events** | | | ||
| | Fetch Resources | ✅⚠️(2) | | ||
| | XHR Resources | ✅⚠️(2) | | ||
| | Other Resources | ✅ | | ||
| | APM Correlation | ✅⚠️(2) | | ||
| | **Action Events** | | | ||
| | Custom Actions | ✅ | | ||
| | Click Actions | ✅ | | ||
| | Frustration Signals | ✅ | | ||
| | Selectors | ✅⚠️(3) | | ||
| | Action Name | ✅⚠️(2) | | ||
| | Loading Time | ✅⚠️(1) | | ||
| | **Error Events** | | | ||
| | Console Error | ✅ | | ||
| | Custom Errors | ✅ | | ||
| | Runtime Errors | ✅⚠️(4) | | ||
| | `onUnhandledRejection` | ❌ | | ||
| | CSP Violation | ❌ | | ||
| | **Other** | | | ||
| | Vital Events | ✅ | | ||
| | Long Task Events | ✅ | | ||
| | Session Replay | ❌ | | ||
|
|
||
| 1. Loading time depends on page activity detection, which may not work fully in Salesforce Lightning due to shadow DOM restrictions on page lifecycle signals. | ||
| 2. Cross-origin restrictions in the Lightning shell may hide full request URLs; APM correlation headers and action names derived from URLs may be incomplete. | ||
| 3. Due to shadow boundaries, the SDK might receive the component host as `event.target` instead of the actual clicked element. | ||
| 4. Direct synchronous errors can reach the SDK through `window.onerror`, but in the Lightning shell they may be redacted as "Script error." with no original error object, URL, line, or stack available to the SDK. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.