Skip to content

chore(feedback): Analytics for error rendering feedback item #78978

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 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ export default function FeedbackItemLoader() {
const projectSlug = useCurrentFeedbackProject();
useSentryAppComponentsData({projectId: projectSlug});

useEffect(() => {
if (issueResult.isError) {
trackAnalytics('feedback.feedback-item-not-found', {organization, feedbackId});
}
}, [organization, issueResult.isError, feedbackId]);

useEffect(() => {
if (issueData) {
trackAnalytics('feedback.feedback-item-rendered', {organization});
}
}, [organization, issueData]);
}, [issueData, organization]);

// There is a case where we are done loading, but we're fetching updates
// This happens when the user has seen a feedback, clicks around a bit, then
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/feedback/useFetchFeedbackData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function useFetchFeedbackData({feedbackId}: Props) {
// Until that is fixed, we're going to run `markAsRead` after the issue is
// initially fetched in order to speedup initial fetch and avoid race conditions.
useEffect(() => {
if (issueResult.isFetched && !issueData?.hasSeen) {
if (issueResult.isFetched && issueData && !issueData.hasSeen) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

markAsRead(true);
}
}, [issueResult.isFetched]); // eslint-disable-line react-hooks/exhaustive-deps
Expand Down
2 changes: 2 additions & 0 deletions static/app/utils/analytics/feedbackAnalyticsEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type FeedbackEventParameters = {
'feedback.details-integration-issue-clicked': {
integration_key: string;
};
'feedback.feedback-item-not-found': {feedbackId: string};
'feedback.feedback-item-rendered': {};
'feedback.index-setup-viewed': {};
'feedback.list-item-selected': {};
Expand All @@ -17,6 +18,7 @@ export type FeedbackEventParameters = {
export type FeedbackEventKey = keyof FeedbackEventParameters;

export const feedbackEventMap: Record<FeedbackEventKey, string | null> = {
'feedback.feedback-item-not-found': 'Feedback item not found',
'feedback.feedback-item-rendered': 'Loaded and rendered a feedback item',
'feedback.index-setup-viewed': 'Viewed Feedback Onboarding Setup',
'feedback.list-item-selected': 'Selected Item in Feedback List',
Expand Down
Loading