Skip to content

Commit 7ff02eb

Browse files
committed
sanatize current_url and ip properties in all posthog events
1 parent 10de798 commit 7ff02eb

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/app/posthogProvider.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@ if (typeof window !== 'undefined') {
99
api_host: "/ingest",
1010
ui_host: NEXT_PUBLIC_POSTHOG_UI_HOST,
1111
person_profiles: 'identified_only',
12-
capture_pageview: false, // Disable automatic pageview capture, as we capture manually
12+
capture_pageview: false, // Disable automatic pageview capture
13+
autocapture: false, // Disable automatic event capture
14+
sanitize_properties: (properties: Record<string, any>, _event: string) => {
15+
if (properties['$current_url']) {
16+
properties['$current_url'] = null;
17+
}
18+
if (properties['$ip']) {
19+
properties['$ip'] = "null";
20+
}
21+
22+
23+
return properties;
24+
}
1325
});
1426
} else {
1527
console.log("PostHog telemetry disabled");

0 commit comments

Comments
 (0)