-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(js): update Browser JS quick start guide #15343
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
Open
inventarSarah
wants to merge
3
commits into
master
Choose a base branch
from
smi/quick-start/browserJS
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <PlatformContent includePath="getting-started-prerequisites" /> | ||
|
|
||
| ## Step 1: Install | ||
|
|
||
| Choose the features you want to configure, and this guide will show you how: | ||
|
|
||
| <OnboardingOptionButtons | ||
| options={[ | ||
| "error-monitoring", | ||
| "performance", | ||
| "session-replay", | ||
| "user-feedback", | ||
| "logs", | ||
| ]} | ||
| /> | ||
|
|
||
| <PlatformContent includePath="getting-started-features-expandable" /> | ||
|
|
||
| ### Install the Sentry SDK | ||
|
|
||
| <PlatformContent includePath="getting-started-install" /> | ||
|
|
||
| ## Step 2: Configure | ||
|
|
||
| ### Initialize the Sentry SDK | ||
|
|
||
| <PlatformContent includePath="getting-started-config" /> | ||
|
|
||
| ## Step 3: Add Readable Stack Traces With Source Maps (Optional) | ||
|
|
||
| <PlatformContent includePath="getting-started-sourcemaps-short-version" /> | ||
|
|
||
| ## Step 4: Avoid Ad Blockers With Tunneling (Optional) | ||
|
|
||
| <PlatformContent includePath="getting-started-tunneling" /> | ||
|
|
||
| ## Step 5: Verify Your Setup | ||
|
|
||
| <PlatformContent includePath="getting-started-verify" /> | ||
|
|
||
| ### View Captured Data in Sentry | ||
|
|
||
| Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). | ||
|
|
||
| <PlatformContent includePath="getting-started-verify-locate-data" /> | ||
|
|
||
| At this point, you should have integrated Sentry into your JavaScript application and should already be sending data to your Sentry project. | ||
|
|
||
| Now's a good time to customize your setup and look into more advanced topics. Our next recommended steps for you are: | ||
|
|
||
| - Extend Sentry to your backend using one of our [SDKs](/) | ||
| - Learn how to [manually capture errors](/platforms/javascript/usage/) | ||
| - Continue to [customize your configuration](/platforms/javascript/configuration/) | ||
| - Get familiar with [Sentry's product features](/product) like tracing, insights, and alerts | ||
|
|
||
| <Expandable permalink={false} title="Are you having problems setting up the SDK?"> | ||
|
|
||
| - Find various support topics in <PlatformLink to="/troubleshooting">troubleshooting</PlatformLink> | ||
| - [Get support](https://sentry.zendesk.com/hc/en-us/) | ||
|
|
||
| </Expandable> |
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 |
|---|---|---|
| @@ -1,11 +1,46 @@ | ||
| ```javascript | ||
| setTimeout(() => { | ||
| throw new Error("Sentry Test Error"); | ||
| }); | ||
| Let's test your setup and confirm that data reaches your Sentry project. | ||
|
|
||
| ### Issues | ||
|
|
||
| To verify that Sentry captures errors and creates issues in your Sentry project, add a button that throws an error when clicked: | ||
|
|
||
| ```html | ||
| <script> | ||
| function triggerError() { | ||
| throw new Error("Sentry Test Error"); | ||
| } | ||
| </script> | ||
|
|
||
| <button onclick="triggerError()">Break the World</button> | ||
| ``` | ||
|
|
||
| <Alert> | ||
| <OnboardingOption optionId="performance" hideForThisOption> | ||
| Open the page in a browser and click the button to throw an error. | ||
| </OnboardingOption> | ||
|
|
||
| <PlatformContent includePath="getting-started-browser-sandbox-warning" /> | ||
|
|
||
| <OnboardingOption optionId="performance"> | ||
| ### Tracing | ||
| To test your tracing configuration, update the previous code to simulate a longer operation and start a trace: | ||
|
|
||
| ```html | ||
| <script> | ||
| function triggerError() { | ||
| await Sentry.startSpan( | ||
| { name: "Example Frontend Span", op: "test" }, | ||
| async () => { | ||
| await new Promise(resolve => setTimeout(resolve, 200)); | ||
|
|
||
| throw new Error("Sentry Test Error"); | ||
| }, | ||
| ); | ||
| } | ||
| </script> | ||
|
|
||
| <button onclick="triggerError()">Break the World</button> | ||
| ``` | ||
|
|
||
| Errors triggered from within Browser DevTools are sandboxed and won't trigger an error handler. Place the snippet directly in your code instead. | ||
| Open the page in a browser and click the button to throw an error and create a trace. | ||
|
|
||
| </Alert> | ||
| </OnboardingOption> |
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.