Appearance
Analytics Types ​
File Information ​
- Path:
app/types/analytics.ts - Purpose: TypeScript interfaces for analytics tracking and insights
- Exported From:
~/types(viaindex.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 identifiercollection_id?: number | string- Collection identifiercategory_id?: any[]- Category identifiers arrayasset_id?: any[]- Asset identifiers arrayshare_id?: number | string- Share identifierevent: 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 stringuserAgent: 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 datamessage?: 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 dataInsightsTransactionShare: Record<string, any>- Share transaction insightsuserAgentAndLocation: Record<string, any>- User agent and location data
Usage:
typescript
import type { AnalyticsState } from '~/types'
const state: AnalyticsState = {
InsightsTransaction: {},
InsightsTransactionShare: {},
userAgentAndLocation: {}
}Related Types ​
These types are used in:
- Analytics Store - Analytics store state
- useAnalytics Composable - Analytics composable
Import Example ​
typescript
import type {
AnalyticsPayload,
AnalyticsState,
BrowserOsResponse,
TransactionResponse
} from '~/types'Notes ​
- All analytics types are exported from
~/types AnalyticsPayloadis the main type for tracking eventsAnalyticsStatematches the analytics store state structure- Types support flexible data structures with
anyfor extensibility