use addEvent everywhere

This commit is contained in:
Abi Raja 2023-12-10 17:58:41 -05:00
parent adbc459347
commit 64789d1c29
3 changed files with 5 additions and 4 deletions

View File

@ -166,7 +166,7 @@ function App() {
toast.error(
"No parent version set. Contact support or open a Github issue."
);
window.plausible("ParentVersionNull");
addEvent("ParentVersionNull");
return prev;
}

View File

@ -6,6 +6,7 @@ import {
SelectTrigger,
} from "./ui/select";
import { GeneratedCodeConfig } from "../types";
import { addEvent } from "../lib/analytics";
function generateDisplayComponent(config: GeneratedCodeConfig) {
switch (config) {
@ -62,7 +63,7 @@ function OutputSettingsSection({
<Select
value={generatedCodeConfig}
onValueChange={(value: string) => {
window.plausible("OutputSettings", { props: { stack: value } });
addEvent("OutputSettings", { stack: value });
setGeneratedCodeConfig(value as GeneratedCodeConfig);
}}
disabled={shouldDisableUpdates}

View File

@ -1,6 +1,6 @@
export function addEvent(eventName: string) {
export function addEvent(eventName: string, props = {}) {
try {
window.plausible(eventName);
window.plausible(eventName, { props });
} catch (e) {
// silently fail in non-production environments
}