Skip to content

Commit

Permalink
chore(issue-details): Add analytics for activity comments (#80565)
Browse files Browse the repository at this point in the history
  • Loading branch information
roggenkemper authored Nov 12, 2024
1 parent fad8f84 commit f6f8a6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions static/app/utils/analytics/issueAnalyticsEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export type IssueEventParameters = {
'issue-details.replay-cta-dismiss': {type: string};
'issue.search_sidebar_clicked': {};
'issue.shared_publicly': {};
'issue_details.activity_created': {};
'issue_details.activity_deleted': {};
'issue_details.copy_event_link_clicked': GroupEventParams;
'issue_details.escalating_feedback_received': {
group_id: string;
Expand Down Expand Up @@ -458,5 +460,7 @@ export const issueEventMap: Record<IssueEventKey, string | null> = {
'Issue Details: Sourcemap Wizard Learn More',
'issue_details.set_priority': 'Issue Details: Set Priority',
'issue_details.section_fold': 'Issue Details: Section Fold',
'issue_details.activity_created': 'Issue Details: Activity Created',
'issue_details.activity_deleted': 'Issue Details: Activity Deleted',
'whats_new.link_clicked': "What's New: Link Clicked",
};
7 changes: 5 additions & 2 deletions static/app/views/issueDetails/streamline/activitySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {Group, GroupActivity} from 'sentry/types/group';
import {GroupActivityType} from 'sentry/types/group';
import type {Team} from 'sentry/types/organization';
import type {User} from 'sentry/types/user';
import {trackAnalytics} from 'sentry/utils/analytics';
import {uniqueId} from 'sentry/utils/guid';
import useOrganization from 'sentry/utils/useOrganization';
import {useTeamsById} from 'sentry/utils/useTeamsById';
Expand Down Expand Up @@ -127,12 +128,13 @@ export default function StreamlinedActivitySection({group}: {group: Group}) {
addErrorMessage(t('Failed to delete comment'));
},
onSuccess: () => {
trackAnalytics('issue_details.activity_deleted', {organization});
addSuccessMessage(t('Comment removed'));
},
}
);
},
[group.activity, mutators, group.id]
[group.activity, mutators, group.id, organization]
);

const handleCreate = useCallback(
Expand All @@ -146,11 +148,12 @@ export default function StreamlinedActivitySection({group}: {group: Group}) {
},
onSuccess: data => {
GroupStore.addActivity(group.id, data);
trackAnalytics('issue_details.activity_created', {organization});
addSuccessMessage(t('Comment posted'));
},
});
},
[group.activity, mutators, group.id]
[group.activity, mutators, group.id, organization]
);

return (
Expand Down

0 comments on commit f6f8a6c

Please sign in to comment.