Skip to content

Analytics Types ​

File Information ​

  • Path: app/types/analytics.ts
  • Purpose: TypeScript interfaces for analytics tracking and insights
  • Exported From: ~/types (via index.ts)

Overview ​

This file contains TypeScript interfaces for analytics tracking, insights data, and analytics store state. These types are used throughout the application for tracking user behavior and analytics events.

Type Definitions ​

AnalyticsPayload ​

Analytics event payload structure.

typescript
interface AnalyticsPayload {
  workspace_id?: number | string
  collection_id?: number | string
  category_id?: any[]
  asset_id?: any[]
  share_id?: number | string
  event: string
  sub_event: string
  environment: string
}

Properties:

  • workspace_id?: number | string - Workspace identifier
  • collection_id?: number | string - Collection identifier
  • category_id?: any[] - Category identifiers array
  • asset_id?: any[] - Asset identifiers array
  • share_id?: number | string - Share identifier
  • event: string - Event type (e.g., 'asset', 'collage', 'folder')
  • sub_event: string - Sub-event type (e.g., 'viewed', 'downloaded', 'shared')
  • environment: string - Environment identifier (e.g., 'dealer', 'admin')

Usage:

typescript
import type { AnalyticsPayload } from '~/types'

const payload: AnalyticsPayload = {
  asset_id: [123, 456],
  event: 'asset',
  sub_event: 'downloaded',
  environment: 'dealer'
}

BrowserOsResponse ​

Browser and OS information response.

typescript
interface BrowserOsResponse {
  userLocation: string
  userAgent: string
}

Properties:

  • userLocation: string - User's location string
  • userAgent: string - User agent string

Usage:

typescript
import type { BrowserOsResponse } from '~/types'

const browserInfo: BrowserOsResponse = {
  userLocation: 'US',
  userAgent: navigator.userAgent
}

TransactionResponse ​

Transaction response structure.

typescript
interface TransactionResponse {
  data: any
  message?: string
}

Properties:

  • data: any - Transaction data
  • message?: string - Optional response message

Usage:

typescript
import type { TransactionResponse } from '~/types'

const response: TransactionResponse = {
  data: { transaction_id: '123' },
  message: 'Transaction completed'
}

AnalyticsState ​

Analytics store state structure.

typescript
interface AnalyticsState {
  InsightsTransaction: Record<string, any>
  InsightsTransactionShare: Record<string, any>
  userAgentAndLocation: Record<string, any>
}

Properties:

  • InsightsTransaction: Record<string, any> - Transaction insights data
  • InsightsTransactionShare: Record<string, any> - Share transaction insights
  • userAgentAndLocation: Record<string, any> - User agent and location data

Usage:

typescript
import type { AnalyticsState } from '~/types'

const state: AnalyticsState = {
  InsightsTransaction: {},
  InsightsTransactionShare: {},
  userAgentAndLocation: {}
}

These types are used in:

Import Example ​

typescript
import type {
  AnalyticsPayload,
  AnalyticsState,
  BrowserOsResponse,
  TransactionResponse
} from '~/types'

Notes ​

  • All analytics types are exported from ~/types
  • AnalyticsPayload is the main type for tracking events
  • AnalyticsState matches the analytics store state structure
  • Types support flexible data structures with any for extensibility