Skip to content

Commit e2d0f9f

Browse files
feat(capacitor) Add Nuxt snippet (#13726)
1 parent 99ad1f3 commit e2d0f9f

File tree

1 file changed

+68
-0
lines changed
  • docs/platforms/javascript/guides/capacitor

1 file changed

+68
-0
lines changed

docs/platforms/javascript/guides/capacitor/index.mdx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ yarn add @sentry/capacitor @sentry/vue
5555
pnpm add @sentry/capacitor @sentry/vue
5656
```
5757

58+
```bash {tabTitle:Nuxt}
59+
# npm
60+
npm install @sentry/capacitor @sentry/nuxt --save
61+
62+
# yarn
63+
yarn add @sentry/capacitor @sentry/nuxt
64+
65+
# pnpm
66+
pnpm add @sentry/capacitor @sentry/nuxt
67+
```
68+
5869
```bash {tabTitle:Other}
5970
# npm
6071
npm install @sentry/capacitor @sentry/browser --save
@@ -362,6 +373,63 @@ Sentry.init(
362373
);
363374
```
364375

376+
```typescript {tabTitle: Nuxt} {filename: sentry.client.config.ts}
377+
import * as Sentry from "@sentry/capacitor";
378+
import * as SentryNuxt from "@sentry/nuxt";
379+
380+
Sentry.init(
381+
{
382+
dsn: "___PUBLIC_DSN___",
383+
384+
// Adds request headers and IP for users, for more info visit:
385+
// https://docs.sentry.io/platforms/javascript/guides/capacitor/configuration/options/#sendDefaultPii
386+
sendDefaultPii: true,
387+
388+
// Set your release version, such as "[email protected]"
389+
release: "my-project-name@<release-name>",
390+
// Set your dist version, such as "1"
391+
dist: "<dist>",
392+
integrations: [
393+
// ___PRODUCT_OPTION_START___ performance
394+
// Registers and configures the Tracing integration,
395+
// which automatically instruments your application to monitor its
396+
// performance, including custom Angular routing instrumentation
397+
Sentry.browserTracingIntegration(),
398+
// ___PRODUCT_OPTION_END___ performance
399+
// ___PRODUCT_OPTION_START___ session-replay
400+
// Registers the Replay integration,
401+
// which automatically captures Session Replays
402+
Sentry.replayIntegration(),
403+
// ___PRODUCT_OPTION_END___ session-replay
404+
],
405+
// ___PRODUCT_OPTION_START___ performance
406+
407+
// Set tracesSampleRate to 1.0 to capture 100%
408+
// of transactions for tracing.
409+
// We recommend adjusting this value in production
410+
// Learn more at
411+
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
412+
tracesSampleRate: 1.0,
413+
414+
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
415+
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
416+
// ___PRODUCT_OPTION_END___ performance
417+
// ___PRODUCT_OPTION_START___ session-replay
418+
419+
// Capture Replay for 10% of all sessions,
420+
// plus for 100% of sessions with an error
421+
// Learn more at
422+
// https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration
423+
replaysSessionSampleRate: 0.1,
424+
replaysOnErrorSampleRate: 1.0,
425+
// ___PRODUCT_OPTION_END___ session-replay
426+
},
427+
428+
// Forward the init method from @sentry/nuxt
429+
SentryNuxt.init
430+
);
431+
```
432+
365433
You can also use the features available with the Sentry SDK for the framework you use, such as [Angular](/platforms/javascript/guides/angular/).
366434

367435
### Source Maps

0 commit comments

Comments
 (0)