Skip to Content

Step 1: trackUserAction

⏱ 3 min

trackUserAction() records audit events. Examples below use the global transcodes after the CDN script. With npm, import { trackUserAction } from '@bigstrider/transcodes-sdk' after init({ projectId }).


trackUserAction()

transcodes.trackUserAction( event: { tag: string; severity?: 'low' | 'medium' | 'high'; status?: boolean; error?: string; metadata?: Record<string, unknown>; }, options?: { requireAuth?: boolean; webhookNotification?: boolean; } ): Promise<void>

Event Parameters

ParameterTypeRequiredDescription
tagstringYesTag identifying the action (e.g., user:login)
severity'low' | 'medium' | 'high'NoSeverity level. Default: 'low'
statusbooleanNoSuccess/failure. Default: true
errorstringNoError message when status: false
metadataRecord<string, unknown>NoAdditional metadata (e.g., { method: 'passkey' })

Options

ParameterTypeDescription
requireAuthbooleanIf true, opens login modal when user not authenticated
webhookNotificationbooleanSend Slack webhook regardless of severity

Basic Examples

// Success event await transcodes.trackUserAction({ tag: 'document:create', status: true, metadata: { documentId: 'doc_123' }, }); // Failed event with error await transcodes.trackUserAction({ tag: 'payment:process', severity: 'high', status: false, error: 'Payment gateway timeout', metadata: { amount: 99.99 }, }); // With webhook alert await transcodes.trackUserAction( { tag: 'sensitive:action', severity: 'high', status: true }, { webhookNotification: true } );

What’s Next

Last updated on