Skip to content

Commit 8b2716d

Browse files
committed
feat: add feedback collection UI with PostHog analytics
1 parent 5da4e3b commit 8b2716d

File tree

3 files changed

+56
-8
lines changed

3 files changed

+56
-8
lines changed

apps/dashboard/src/@/analytics/report.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,3 +547,29 @@ export function reportChainInfraRpcOmissionAgreed(properties: {
547547
}) {
548548
posthog.capture("chain infra checkout rpc omission agreed", properties);
549549
}
550+
551+
// ----------------------------
552+
// FEEDBACK
553+
// ----------------------------
554+
555+
/**
556+
* ### Why do we need to report this event?
557+
* - To track user feedback and sentiment about the product
558+
* - To identify common issues or feature requests
559+
* - To measure user satisfaction and engagement
560+
* - To prioritize product improvements based on user input
561+
*
562+
* ### Who is responsible for this event?
563+
* @gisellechacon
564+
*/
565+
export function reportProductFeedback(properties: {
566+
feedback: string;
567+
feedbackLength: number;
568+
source: "desktop" | "mobile";
569+
}) {
570+
posthog.capture("product feedback submitted", {
571+
feedback: properties.feedback,
572+
feedbackLength: properties.feedbackLength,
573+
source: properties.source,
574+
});
575+
}

apps/dashboard/src/app/(app)/components/Header/SecondaryNav/SecondaryNav.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
import Link from "next/link";
44
import type React from "react";
55
import { useState } from "react";
6+
import { toast } from "sonner";
67
import type { ThirdwebClient } from "thirdweb";
8+
import { reportProductFeedback } from "@/analytics/report";
79
import { NotificationsButton } from "@/components/notifications/notification-button";
810
import { NavLink } from "@/components/ui/NavLink";
911
import type { Account } from "@/hooks/useApi";
@@ -40,10 +42,19 @@ export function SecondaryNavLinks() {
4042

4143
const handleModalSubmit = (e?: React.FormEvent) => {
4244
e?.preventDefault();
43-
// Avoid logging PII in production. Keep minimal diagnostics in dev.
44-
if (process.env.NODE_ENV !== "production") {
45-
console.debug("[feedback] length:", modalFeedback.trim().length);
46-
}
45+
46+
// Report feedback to PostHog
47+
reportProductFeedback({
48+
feedback: modalFeedback,
49+
feedbackLength: modalFeedback.trim().length,
50+
source: "desktop",
51+
});
52+
53+
// Show success notification
54+
toast.success("Feedback submitted successfully!", {
55+
description: "Thank you for your feedback. We'll review it shortly.",
56+
});
57+
4758
setModalFeedback("");
4859
setShowFeedbackDropdown(false);
4960
};

apps/dashboard/src/app/(app)/components/MobileBurgerMenuButton.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import {
1414
import Link from "next/link";
1515
import { useTheme } from "next-themes";
1616
import { useLayoutEffect, useState } from "react";
17+
import { toast } from "sonner";
1718
import type { ThirdwebClient } from "thirdweb";
19+
import { reportProductFeedback } from "@/analytics/report";
1820
import { Button } from "@/components/ui/button";
1921
import { NavLink } from "@/components/ui/NavLink";
2022
import { Separator } from "@/components/ui/separator";
@@ -51,10 +53,19 @@ export function MobileBurgerMenuButton(
5153

5254
const handleModalSubmit = (e?: React.FormEvent) => {
5355
e?.preventDefault();
54-
// Avoid logging PII in production. Keep minimal diagnostics in dev.
55-
if (process.env.NODE_ENV !== "production") {
56-
console.debug("[feedback] length:", modalFeedback.trim().length);
57-
}
56+
57+
// Report feedback to PostHog
58+
reportProductFeedback({
59+
feedback: modalFeedback,
60+
feedbackLength: modalFeedback.trim().length,
61+
source: "mobile",
62+
});
63+
64+
// Show success notification
65+
toast.success("Feedback submitted successfully!", {
66+
description: "Thank you for your feedback. We'll review it shortly.",
67+
});
68+
5869
setModalFeedback("");
5970
setShowFeedbackSection(false);
6071
};

0 commit comments

Comments
 (0)