Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

1.3 KB
Raw Blame
import { TimeBucket } from '~/lib/constants'
import { V2Filter } from '~/api/v2/types'

interface Filter {
  column: string
  filter: string
  isExclusive: boolean
  // When true, this filter uses substring match (contains/not contains) instead of equality
  isContains?: boolean
}

export enum ProjectViewCustomEventMetaValueType {
  STRING = 'string',
  INTEGER = 'integer',
  FLOAT = 'float',
}

export interface ProjectViewCustomEvent {
  id: string
  customEventName: string
  metaKey?: string
  metaValue?: string
  metricKey: string
  metaValueType: ProjectViewCustomEventMetaValueType
}

export interface ProjectView {
  id: string
  name: string
  filters?: (Filter | V2Filter)[]
  customEvents?: ProjectViewCustomEvent[]
}

interface Param {
  name: string
  count: number
}

type Params = Record<string, Param[]>

export type Customs = Record<string, number>

type Properties = Record<string, number>

interface Metric {
  sum: number
  avg: number
}

interface TrafficMeta {
  key: string
  current: Metric
  previous: Metric
}

export interface TrafficLogResponse {
  params?: Params
  chart: {
    x: string[]
    visits: number[]
    uniques: number[]
    sdur: number[]
    bounces?: number[]
    concurrency?: number[]
  }
  customs: Customs
  properties: Properties
  appliedFilters?: Filter[]
  timeBucket?: TimeBucket[]
  meta?: TrafficMeta[]
}