Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

915 B
Raw Blame
/* Copyright 2026 BoxLite AI. SPDX-License-Identifier: AGPL-3.0 */
import { Logger } from '@nestjs/common'
import type { SignupSource } from '../../../shared/signup-attribution'

export const signupAttributionEvent = 'signup_attributed'
const eventName = 'signup.attribution'
const logger = new Logger('SignupAttribution')

type Outcome =
  | {
      outcome: 'received'
      'signup.source': string
      'signup.source_type': SignupSource['kind']
      'signup.medium'?: string
      'signup.campaign'?: string
    }
  | { outcome: 'skipped'; reason: string }
  | { outcome: 'sending' }
  | { outcome: 'delivered'; http_status: number }

export function logSignupAttribution(result: Outcome): void {
  logger.log(eventName + ' ' + result.outcome, { 'event.name': eventName, ...result })
}

export function logSignupAttributionSkip(reason: string): void {
  logSignupAttribution({ outcome: 'skipped', reason })
}