ソースを参照

Merge pull request #27685 from overleaf/msm-group-audit-log-event

[web] Analytics events for Group Audit Logs

GitOrigin-RevId: 751d4332a2b0f4b33fbe48a5a4c03ba45b2b5c7f
Miguel Serrano 1 年間 前
親
コミット
ba061c8e7f

+ 6 - 0
services/web/frontend/js/features/subscription/components/dashboard/managed-group-subscriptions.tsx

@@ -7,6 +7,7 @@ import { Trans, useTranslation } from 'react-i18next'
 import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
 import { RowLink } from './row-link'
 import { ManagedGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription'
+import { sendMB } from '@/infrastructure/event-tracking'
 
 function ManagedGroupAdministrator({
   subscription,
@@ -130,6 +131,11 @@ export default function ManagedGroupSubscriptions() {
                 heading={t('audit_logs')}
                 subtext={t('view_audit_logs_group_subtext')}
                 icon="list"
+                onClick={() =>
+                  sendMB('group-audit-log-click', {
+                    subscriptionId: subscription._id,
+                  })
+                }
               />
               <RowLink
                 href={`/metrics/groups/${subscription._id}`}

+ 9 - 2
services/web/frontend/js/features/subscription/components/dashboard/row-link.tsx

@@ -5,12 +5,19 @@ type RowLinkProps = {
   heading: string
   subtext: string
   icon: string
+  onClick?: () => void
 }
 
-export function RowLink({ href, heading, subtext, icon }: RowLinkProps) {
+export function RowLink({
+  href,
+  heading,
+  subtext,
+  icon,
+  onClick,
+}: RowLinkProps) {
   return (
     <li className="list-group-item row-link">
-      <a href={href} className="row-link-inner">
+      <a href={href} className="row-link-inner" onClick={onClick}>
         <MaterialIcon type={icon} className="p-2 p-md-3" />
         <div className="flex-grow-1">
           <strong>{heading}</strong>