|
| 1 | +```javascript {tabTitle: JavaScript} |
| 2 | +import * as Sentry from "@sentry/browser"; |
| 3 | +import { HttpClient as HttpClientIntegration } from "@sentry/integrations"; |
| 4 | + |
| 5 | +Sentry.init({ |
| 6 | + dsn: "___PUBLIC_DSN___", |
| 7 | + integrations: [ |
| 8 | + new HttpClientIntegration({ |
| 9 | + // This array can contain tuples of `[begin, end]` (both inclusive), |
| 10 | + // single status codes, or a combination of both. |
| 11 | + // default: [[500, 599]] |
| 12 | + failedRequestStatusCodes: [[500, 505], 507], |
| 13 | + |
| 14 | + // This array can contain Regexes, strings, or a combination of both. |
| 15 | + // default: [/.*/] |
| 16 | + failedRequestTargets: [ |
| 17 | + "http://example.com/api/test", |
| 18 | + /(staging\.)?mypage\.com/, |
| 19 | + ], |
| 20 | + }), |
| 21 | + ], |
| 22 | + |
| 23 | + // This option is required for capturing headers and cookies. |
| 24 | + sendDefaultPii: true, |
| 25 | +}); |
| 26 | +``` |
| 27 | + |
| 28 | +```javascript {tabTitle: CDN} |
| 29 | +<script |
| 30 | + src="https://browser.sentry-cdn.com/{{ packages.version('sentry.javascript.browser') }}/bundle.min.js" |
| 31 | + integrity="sha384-{{ packages.checksum('sentry.javascript.browser', 'bundle.min.js', 'sha384-base64') }}" |
| 32 | + crossorigin="anonymous" |
| 33 | +></script> |
| 34 | + |
| 35 | +<script |
| 36 | + src="https://browser.sentry-cdn.com/{{ packages.version('sentry.javascript.browser') }}/httpclient.min.js" |
| 37 | + integrity="sha384-{{ packages.checksum('sentry.javascript.browser', 'httpclient.min.js', 'sha384-base64') }}" |
| 38 | + crossorigin="anonymous" |
| 39 | +></script> |
| 40 | + |
| 41 | +Sentry.init({ |
| 42 | + dsn: "___PUBLIC_DSN___", |
| 43 | + integrations: [ |
| 44 | + new HttpClientIntegration({ |
| 45 | + // This array can contain tuples of `[begin, end]` (both inclusive), |
| 46 | + // single status codes, or a combination of both. |
| 47 | + // default: [[500, 599]] |
| 48 | + failedRequestStatusCodes: [[500, 505], 507], |
| 49 | + |
| 50 | + // This array can contain Regexes, strings, or a combination of both. |
| 51 | + // default: [/.*/] |
| 52 | + failedRequestTargets: [ |
| 53 | + "http://example.com/api/test", |
| 54 | + /(staging\.)?mypage\.com/, |
| 55 | + ], |
| 56 | + }), |
| 57 | + ], |
| 58 | + |
| 59 | + // This option is required for capturing headers and cookies. |
| 60 | + sendDefaultPii: true, |
| 61 | +}); |
| 62 | +``` |
0 commit comments