Skip to content
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

fix: Mobile onboarding feature snippets #12956

Merged
merged 10 commits into from
Mar 7, 2025
73 changes: 40 additions & 33 deletions docs/platforms/apple/common/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ To capture all errors, initialize the SDK as soon as possible, such as in your `

<PlatformSection notSupported={["apple.tvos", "apple.watchos", "apple.visionos"]}>

```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12", "profiling": "14-24"}}
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28"}}
import Sentry

func application(_ application: UIApplication,
Expand All @@ -97,13 +97,13 @@ func application(_ application: UIApplication,
options.dsn = "___PUBLIC_DSN___"
options.debug = true // Enabled debug when first installing is always helpful

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0

// Adds IP for users.
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
options.sendDefaultPii = true

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
}

// Manually call startProfiler and stopProfiler to profile any code that runs in between.
Expand All @@ -121,7 +121,7 @@ func application(_ application: UIApplication,
}
```

```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11", "profiling": "13-23"}}
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "17-27"}}
@import Sentry;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
Expand All @@ -130,13 +130,13 @@ func application(_ application: UIApplication,
options.dsn = @"___PUBLIC_DSN___";
options.debug = YES; // Enabled debug when first installing is always helpful

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = @1.0;

// Adds IP for users.
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
options.sendDefaultPii = YES

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = @1.0;
}];

// Manually call startProfiler and stopProfiler to profile any code that runs in between.
Expand All @@ -154,7 +154,7 @@ func application(_ application: UIApplication,
}
```

```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "9-12", "profiling": "13-16"}}
```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28"}}
import Sentry

@main
Expand All @@ -164,26 +164,33 @@ struct SwiftUIApp: App {
options.dsn = "___PUBLIC_DSN___"
options.debug = true // Enabled debug when first installing is always helpful

// Adds IP for users.
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
options.sendDefaultPii = true

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
}

// Sample rate for profiling, applied on top of TracesSampleRate.
// We recommend adjusting this value in production.
options.profilesSampleRate = 1.0
// Manually call startProfiler and stopProfiler to profile any code that runs in between.
SentrySDK.startProfiler()

// Adds IP for users.
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
options.sendDefaultPii = true
}
//
// ...anything here will be profiled...
//

// Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
// your application until the process exits, the app goes to the background, or stopProfiling is called.
SentrySDK.stopProfiler()
}
}
```
</PlatformSection>

<PlatformSection notSupported={["apple.ios", "apple.macos"]}>

```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12"}}
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16"}}
import Sentry

func application(_ application: UIApplication,
Expand All @@ -193,20 +200,20 @@ func application(_ application: UIApplication,
options.dsn = "___PUBLIC_DSN___"
options.debug = true // Enabled debug when first installing is always helpful

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0

// Adds IP for users.
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
options.sendDefaultPii = true

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
}

return true
}
```

```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11"}}
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15"}}
@import Sentry;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
Expand All @@ -215,20 +222,20 @@ func application(_ application: UIApplication,
options.dsn = @"___PUBLIC_DSN___";
options.debug = YES; // Enabled debug when first installing is always helpful

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = @1.0;

// Adds IP for users.
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
options.sendDefaultPii = YES

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = @1.0;
}];

return YES;
}
```

```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "9-12"}}
```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16"}}
import Sentry

@main
Expand All @@ -238,13 +245,13 @@ struct SwiftUIApp: App {
options.dsn = "___PUBLIC_DSN___"
options.debug = true // Enabled debug when first installing is always helpful

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0

// Adds IP for users.
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
options.sendDefaultPii = true

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions docs/platforms/dart/guides/flutter/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ brew install getsentry/tools/sentry-wizard && sentry-wizard -i flutter
npx @sentry/wizard@latest -i flutter
```

[Sentry Wizard](https://github.com/getsentry/sentry-wizard) will patch your project accordingly, though you can [set up manually](/platforms/dart/guides/flutter/manual-setup/) if you prefer. You only need to patch the project once. Then you can add the patched files to your version control system.

[Sentry Wizard](https://github.com/getsentry/sentry-wizard) will patch your project accordingly, though you can [set up manually](/platforms/dart/guides/flutter/manual-setup/) if you prefer. You only need to patch the project once. Then you can add the patched files to your version control system.

<Expandable title="The following tasks will be performed by the Sentry Wizard">

Expand All @@ -62,24 +61,24 @@ npx @sentry/wizard@latest -i flutter

Configuration should happen as early as possible in your application's lifecycle.

```dart {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}}
```dart {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}}
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
// The sampling rate for profiling is relative to tracesSampleRate
// Setting to 1.0 will profile 100% of sampled transactions:
// Note: Profiling alpha is available for iOS and macOS since SDK version 7.12.0
options.profilesSampleRate = 1.0;
// Adds request headers and IP for users,
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
options.sendDefaultPii = true;
},
appRunner: () => runApp(
SentryWidget(
Expand All @@ -93,7 +92,7 @@ Future<void> main() async {
}
```

```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "16-18", "profiling": "19-22"}}
```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "19-21", "profiling": "22-25"}}
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Expand All @@ -109,6 +108,9 @@ Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
Expand Down
13 changes: 8 additions & 5 deletions docs/platforms/dart/guides/flutter/manual-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ dependencies:

Configuration should happen as early as possible in your application's lifecycle.

```dart {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}}
```dart {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}}
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
// The sampling rate for profiling is relative to tracesSampleRate
// Setting to 1.0 will profile 100% of sampled transactions:
// Note: Profiling alpha is available for iOS and macOS since SDK version 7.12.0
options.profilesSampleRate = 1.0;
// Adds request headers and IP for users,
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
options.sendDefaultPii = true;
},
appRunner: () => runApp(
SentryWidget(
Expand All @@ -58,7 +58,7 @@ Future<void> main() async {
}
```

```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "16-18", "profiling": "19-22"}}
```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "19-21", "profiling": "22-25"}}
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Expand All @@ -74,6 +74,9 @@ Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// visit: https://docs.sentry.io/platforms/dart/guides//data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
Expand Down
10 changes: 5 additions & 5 deletions docs/platforms/dart/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori

<Alert>

Sentry provides a dedicated [Flutter SDK](/platforms/dart/guides/flutter) as well.
Sentry provides a dedicated [Flutter SDK](/platforms/dart/guides/flutter) as well.

</Alert>

Expand All @@ -51,18 +51,18 @@ dependencies:
To capture all errors, initialize the Sentry Dart SDK as soon as possible.


```dart {"onboardingOptions": {"performance": "6-8"}}
```dart {"onboardingOptions": {"performance": "9-11"}}
import 'package:sentry/sentry.dart';

Future<void> main() async {
await Sentry.init((options) {
options.dsn = '___PUBLIC_DSN___';
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
// Adds request headers and IP for users,
// visit: https://docs.sentry.io/platforms/dart/data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
});

// you can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and
Expand Down
8 changes: 4 additions & 4 deletions docs/platforms/react-native/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ If you're using Expo, [read our docs](/platforms/react-native/manual-setup/expo/

To capture all errors, initialize the Sentry React Native SDK as soon as possible.

```javascript {filename:App.js} {"onboardingOptions": {"performance": "5-9", "profiling": "10-12"}}
```javascript {filename:App.js} {"onboardingOptions": {"performance": "8-12", "profiling": "13-15"}}
import * as Sentry from "@sentry/react-native";

Sentry.init({
dsn: "___PUBLIC_DSN___",
// Adds more context data to events (IP address, cookies, user, etc.)
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
sendDefaultPii: true,
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
// Learn more at
Expand All @@ -77,9 +80,6 @@ Sentry.init({
// profilesSampleRate is relative to tracesSampleRate.
// Here, we'll capture profiles for 100% of transactions.
profilesSampleRate: 1.0,
// Adds more context data to events (IP address, cookies, user, etc.)
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
sendDefaultPii: true,
});
```

Expand Down
8 changes: 4 additions & 4 deletions docs/platforms/react-native/manual-setup/expo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ pnpm add @sentry/react-native

Import the `@sentry/react-native` package and call `init` with your DSN:

```javascript {tabTitle:App.js or app/_layout.js} {"onboardingOptions": {"performance": "6-10", "profiling": "11-13"}}
```javascript {tabTitle:App.js or app/_layout.js} {"onboardingOptions": {"performance": "9-13", "profiling": "14-16"}}
import { Text, View } from "react-native";
import * as Sentry from "@sentry/react-native";

Sentry.init({
dsn: "___PUBLIC_DSN___",
// Adds more context data to events (IP address, cookies, user, etc.)
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
sendDefaultPii: true,
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
// Learn more at
Expand All @@ -80,9 +83,6 @@ Sentry.init({
// profilesSampleRate is relative to tracesSampleRate.
// Here, we'll capture profiles for 100% of transactions.
profilesSampleRate: 1.0,
// Adds more context data to events (IP address, cookies, user, etc.)
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
sendDefaultPii: true,
});

function App() {
Expand Down
Loading