Skip to content

Sanitize posthog data and add more info in README #4

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

Merged
merged 9 commits into from
Sep 19, 2024
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ The zoekt binaries and web dependencies are placed into `bin` and `node_modules`

## Disabling Telemetry

By default, Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). You can disable this by setting the environment variable `SOURCEBOT_TELEMETRY_DISABLED` to `1` in the docker run command:
By default, Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). We [sanatize all events](https://github.com/TaqlaAI/sourcebot/blob/main/src/app/posthogProvider.tsx) to ensure that no information about your code base leaves your machine. We don't include any information about your codebase in [any of the events we send](https://github.com/search?q=repo%3ATaqlaAI%2Fsourcebot++captureEvent&type=code). We send these events purely to track how many people our using Sourcebot and to ensure its health through query metadata (ex. search time, crashes, etc).

You can disable this by setting the environment variable `SOURCEBOT_TELEMETRY_DISABLED` to `1` in the docker run command:
```sh
docker run -e SOURCEBOT_TELEMETRY_DISABLED=1 ...stuff... ghcr.io/taqlaai/sourcebot:main
```
Expand Down
5 changes: 0 additions & 5 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import dynamic from "next/dynamic";

const inter = Inter({ subsets: ["latin"] });

const PostHogPageView = dynamic(() => import('./posthogPageView'), {
ssr: false,
})

export const metadata: Metadata = {
title: "Sourcebot",
description: "Sourcebot",
Expand All @@ -31,7 +27,6 @@ export default function RootLayout({
>
<body className={inter.className}>
<PHProvider>
<PostHogPageView />
<ThemeProvider
attribute="class"
defaultTheme="system"
Expand Down
28 changes: 0 additions & 28 deletions src/app/posthogPageView.tsx

This file was deleted.

14 changes: 13 additions & 1 deletion src/app/posthogProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ if (typeof window !== 'undefined') {
api_host: "/ingest",
ui_host: NEXT_PUBLIC_POSTHOG_UI_HOST,
person_profiles: 'identified_only',
capture_pageview: false, // Disable automatic pageview capture, as we capture manually
capture_pageview: false, // Disable automatic pageview capture
autocapture: false, // Disable automatic event capture
sanitize_properties: (properties: Record<string, any>, _event: string) => {
if (properties['$current_url']) {
properties['$current_url'] = null;
}
if (properties['$ip']) {
properties['$ip'] = "null";
}


return properties;
}
});
} else {
console.log("PostHog telemetry disabled");
Expand Down
Loading