How pirsch-analytics/pirsch works
Main Components
a. Tracker Package (/pkg/tracker)
• Represents the data collection layer
• Handles user agent parsing, IP processing, and geolocation
• Manages session handling
• Contains referrer processing
• Should be shown as the entry point for analytics data
b. Analyzer Package (/pkg/analyzer)
• Represents the analytics processing layer
• Handles various types of analysis:
• Demographics
• Device information
• Events
• Funnels
• Page views
• Sessions
• UTM parameters
• Visitors
c. Database Layer (/pkg/db)
• ClickHouse database integration
• Schema management
• Data storage and retrieval
[Client/Website] → [Tracker Layer] → [Analyzer Layer] → [Database Layer]
Detailed Component Breakdown
For each major component, include these subcomponents:
Tracker Layer:
• IP Processing (pkg/tracker/ip)
• Geolocation (pkg/tracker/geodb)
• User Agent Parser (pkg/tracker/ua)
• Session Management (pkg/tracker/session)
• Referrer Processing (pkg/tracker/referrer)
• Channel Processing (pkg/tracker/channel)
Analyzer Layer:
• Visitor Analytics
• Event Processing
• Funnel Analysis
• Page Analytics
• Session Analysis
• Filter System
• Query Builder
Database Layer:
• ClickHouse Connection
• Migration System
• Data Store Interface
Important Flows to Highlight
• Fingerprint Generation Flow:
• [IP + UserAgent + Date + Salt] → [Fingerprint Hash]
• Data Processing Pipeline:
• [Raw Request] → [Preprocessing] → [Analysis] → [Storage]
Technical Details
Notes about:
• ClickHouse as the database
• Redis/Memory cache options for sessions
• GeoIP2 database integration
• Referrer processing rules
• Migration system
Remember to highlight the system's unique selling points:
• Server-side tracking
• Privacy-first design
• No cookies required
• Ad-blocker resistance (when used server-side)
This will create a comprehensive system design that accurately represents Pirsch Analytics' architecture while emphasizing its privacy-focused nature and technical capabilities.