Skip to content

Commit 6ae5651

Browse files
committed
chore: limit playground analytics to just share urls
1 parent 70bb0be commit 6ae5651

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

web/src/Playground.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ function Playground() {
8282
history.pushState(null, "", currentUrl.toString());
8383
posthog.capture("overlay.speakeasy.com:share", {
8484
openapi: JSON.parse(info),
85-
currentUrl: currentUrl.toString(),
8685
});
8786
} else {
8887
setError("Failed to create share URL");
@@ -115,12 +114,8 @@ function Playground() {
115114

116115
const changed = await ApplyOverlay(original, result, false);
117116
const info = await GetInfo(original, false);
118-
const bestURL = new URL(window.location.href);
119-
bestURL.searchParams.set("s", hash);
120-
bestURL.hash = "";
121117
posthog.capture("overlay.speakeasy.com:load-shared", {
122118
openapi: JSON.parse(info),
123-
currentUrl: bestURL.toString(),
124119
});
125120

126121
setChanged(changed);

web/src/components/Editor.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export function Editor(props: EditorComponentProps) {
6767
() => ({
6868
readOnly: props.readonly,
6969
minimap: { enabled: false },
70+
automaticLayout: true,
7071
}),
7172
[props.readonly],
7273
);

web/src/main.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ import posthog from "posthog-js";
77
if (process.env.PUBLIC_POSTHOG_API_KEY) {
88
posthog.init(process.env.PUBLIC_POSTHOG_API_KEY, {
99
api_host: "https://metrics.speakeasy.com",
10-
person_profiles: "identified_only",
1110
disable_session_recording: true,
1211
autocapture: false,
12+
before_send: function (event) {
13+
if (event?.properties?.$current_url) {
14+
const url = new URL(event.properties.$current_url);
15+
url.hash = "";
16+
event.properties.$current_url = url.toString();
17+
}
18+
return event;
19+
},
1320
});
14-
15-
posthog.capture("$pageview");
1621
}
1722

1823
ReactDOM.createRoot(document.getElementById("root")!).render(

0 commit comments

Comments
 (0)