Template
Add PostHog, move Plausible to v4, and drop Sentry session replay
PostHog loads after the page is idle through a same-origin /ingest proxy and follows the signed-in Convex user. Plausible uses the per-site script through a /pa proxy. Sentry keeps errors and traces only. Pages load only the @gib/ui modules they import, and client code reads public env from publicEnv.ts so zod stays out of the browser.
This commit is contained in:
1 parent
818b41fb21
commit
55b253257b
14 files changed
+318
-102
No files matched your search
@@ -1,27 +1,35 @@
|
||||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
||||
import { env } from '@/env';
|
||||
import { startAnalytics } from '@/lib/analytics';
|
||||
import { publicEnv } from '@/publicEnv';
|
||||
import * as Sentry from '@sentry/nextjs';
|
||||
|
||||
// Session replay is left to PostHog, so Sentry carries no replay integration.
|
||||
Sentry.init({
|
||||
dsn: env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
integrations: [
|
||||
Sentry.replayIntegration({
|
||||
maskAllText: false,
|
||||
blockAllMedia: false,
|
||||
}),
|
||||
Sentry.feedbackIntegration({
|
||||
colorScheme: 'system',
|
||||
}),
|
||||
],
|
||||
dsn: publicEnv.NEXT_PUBLIC_SENTRY_DSN,
|
||||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
|
||||
sendDefaultPii: true,
|
||||
sendDefaultPii: false,
|
||||
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
|
||||
tracesSampleRate: 1,
|
||||
// A tenth of page loads is plenty for performance trends and keeps the
|
||||
// self-hosted Sentry light.
|
||||
tracesSampleRate: 0.1,
|
||||
enableLogs: true,
|
||||
// https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration
|
||||
replaysSessionSampleRate: 0.5,
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
debug: false,
|
||||
});
|
||||
|
||||
// The feedback widget is a floating button nobody needs during the first
|
||||
// paint, so its code is split into its own chunk and added once the page has
|
||||
// loaded.
|
||||
const addFeedbackWidget = async () => {
|
||||
const { feedbackIntegration } = await import('@sentry/nextjs');
|
||||
Sentry.addIntegration(feedbackIntegration({ colorScheme: 'system' }));
|
||||
};
|
||||
if (document.readyState === 'complete') void addFeedbackWidget();
|
||||
else
|
||||
window.addEventListener('load', () => void addFeedbackWidget(), {
|
||||
once: true,
|
||||
});
|
||||
|
||||
startAnalytics();
|
||||
|
||||
// `captureRouterTransitionStart` is available from SDK version 9.12.0 onwards
|
||||
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;
|
||||
Reference in new issue
Block a user