Batch update metrics with multiple events or rebuild historical data
updateMetric
function allows you to update metrics with multiple events at once, perfect for importing historical data, rebuilding metrics, or processing batched events.
string
: The entity type being trackedstring
: The action being measuredstring
: The specific entity IDTrackableEvent[]
: Array of events to processnumber
: Initial count before events (default: 0)number
: Initial value before events (default: 0)boolean
: Delete existing data before update (default: true)clean
is true, deletes all existing data for the entityupdateMetric
uses Firestore batch operations for efficiency: