feat: add channel dimension to GA4 AI usage tracking

Distinguish claw402, blockrun, and native direct API calls in telemetry.
This commit is contained in:
tinkle-community
2026-03-16 15:19:49 +08:00
parent b8bc91f7a0
commit d5fbe445e1
3 changed files with 17 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ type AIUsageEvent struct {
TraderID string
ModelProvider string // openai, deepseek, anthropic, etc.
ModelName string // gpt-4o, deepseek-chat, claude-3, etc.
Channel string // payment channel: "claw402", "blockrun", or "native"
InputTokens int
OutputTokens int
}
@@ -214,6 +215,7 @@ func TrackAIUsage(event AIUsageEvent) {
Params: map[string]interface{}{
"model_provider": event.ModelProvider,
"model_name": event.ModelName,
"channel": event.Channel,
"input_tokens": event.InputTokens,
"output_tokens": event.OutputTokens,
"total_tokens": event.InputTokens + event.OutputTokens,