BadgerCoin Marketing Analytics & Multi-Touch Attribution System
Engineered an enterprise-level marketing attribution system with sophisticated multi-touch attribution models, transaction tracking, and comprehensive admin dashboard. Features advanced re-attribution logic, customer journey tracking, and revenue attribution across all marketing channels.
Multi-Touch Attribution Engine
Advanced attribution system supporting first-touch, last-touch, and re-attribution models. Tracks complete customer journeys from anonymous visitor to loyal customer with automatic re-attribution for repeat purchases.
Interactive Analytics Dashboard
React-powered admin dashboard with real-time analytics, campaign performance tracking, conversion funnel analysis, and data visualization using Chart.js for actionable marketing intelligence.
Project Overview
For BadgerCoin, a cryptocurrency e-transfer platform, I architected and implemented a comprehensive marketing analytics and attribution system that provides enterprise-level intelligence on marketing effectiveness. The system tracks comprehensive revenue data across 13+ campaigns and 8+ marketing channels, providing actionable insights for data-driven marketing decisions.
This full-stack solution integrates deeply with the BadgerCoin platform to automatically track user journeys from initial UTM-tagged visit through registration, login, and purchases—both first-time and repeat. The system employs sophisticated attribution models that determine which marketing touchpoints deserve credit for conversions, supporting business decisions about where to invest marketing dollars.
System Capabilities
Technical Architecture
Backend Attribution Engine (Laravel)
Built a sophisticated Laravel service layer that automatically tracks and attributes marketing touchpoints throughout the customer lifecycle. The MarketingTrackingService implements multiple attribution models with intelligent logic for handling complex scenarios like repeat purchases and multi-channel journeys.
- UTM Parameter Tracking: Middleware that captures and persists UTM parameters across sessions using cookies and database storage
- Automatic Attribution: Event-driven tracking for user registration, login, and purchase events with zero manual intervention required
- First-Touch Attribution: Tracks primary acquisition sources with percentage breakdowns across campaigns
- Last-Touch Attribution: Credits the most recent touchpoint for first-time purchases
- Re-Attribution Model: Sophisticated logic that re-attributes repeat purchases to new touchpoints within a 30-day window
- Customer Lifetime Value: Accumulates value to original campaigns when no new touchpoints exist
Data Model & Database Schema
Designed a comprehensive marketing table schema that captures all necessary attribution data while maintaining performance with proper indexing. The model includes user relationships, conversion tracking, and flexible JSON fields for custom action data.
Key Database Fields
- UTM Parameters: source, medium, campaign, term, content for complete campaign tracking
- Session Data: IP address, user agent, session ID, referrer, landing page
- User Journey: user_state (signup, login, first_purchase, repeat_customer)
- Conversion Metrics: converted boolean, converted_at timestamp, conversion_value decimal
- Flexible Tracking: action_type and action_data JSON for extensible event tracking
Frontend Admin Dashboard (React + TypeScript)
Developed a comprehensive admin dashboard using React 18 and TypeScript that provides real-time visibility into marketing performance. The dashboard features interactive data visualizations, campaign performance cards, and detailed user journey analysis.
- Marketing Overview: High-level KPIs showing total campaigns, touchpoints, conversions, revenue, and average revenue per user
- Campaign Analytics: Detailed performance metrics for each campaign with conversion rates and revenue attribution
- Data Visualization: Chart.js integration displaying acquisition channel distribution and conversion rate comparisons
- Campaign Performance Cards: Grid view showing touchpoints, users, conversions, and top acquisition sources per campaign
- User Journey Tracking: Detailed timelines showing complete customer journeys from first touch to purchase
- CSV Export: Full data export capability for further analysis in Excel or other tools
Attribution Models Implemented
First-Touch Attribution
Emphasizes acquisition sources by tracking the first campaign that brought each user. Calculates percentage breakdowns showing which channels are most effective at bringing new users into the funnel.
Use Case: Understanding which marketing channels are best at customer acquisition—crucial for CAC calculations.
Last-Touch Attribution
Credits the most recent marketing touchpoint before a conversion. For first purchases, the system attributes the full conversion value to the last campaign the user interacted with.
Use Case: Identifying which campaigns are most effective at driving immediate conversions and closing sales.
Re-Attribution for Repeat Customers
Advanced model that re-attributes repeat purchases when users interact with new campaigns within 30 days of their last purchase. If no new touchpoints exist, value accumulates to the original campaign.
Use Case: Measuring the effectiveness of retargeting and loyalty campaigns at driving repeat purchases from existing customers.
Customer Lifetime Value Tracking
Accumulates total customer value to campaigns over time, showing which acquisition sources bring the highest-value customers. Includes both first purchase and all subsequent purchases.
Use Case: Long-term ROI analysis to identify which channels bring customers with highest lifetime value, not just highest volume.
Key Features Implemented
Multi-Channel Campaign Tracking
Tracks performance across Google Ads, Facebook, Instagram, Twitter, LinkedIn, YouTube influencers, email marketing, SEO/organic, and affiliate programs with unified attribution.
Automatic Session Persistence
UTM parameters stored in both session and database, tracking users even when they navigate away and return later or across different sessions.
Anonymous-to-Authenticated Linking
Seamlessly connects anonymous visitor sessions to authenticated user accounts, preserving complete journey history from first visit through conversion.
Revenue Attribution & ROI Analysis
Tracks exact dollar amounts attributed to each campaign, enabling precise ROI calculations and data-driven marketing budget decisions.
Conversion Funnel Analysis
Track users through entire funnel from page view → signup → login → first purchase → repeat customer with state-based tracking.
Demo Data & Testing Infrastructure
Comprehensive seeder creating realistic demo scenarios with 28+ touchpoints across 8+ user journeys, perfect for demonstrations and testing.
API Architecture
Designed and implemented RESTful API endpoints that power both the admin dashboard and provide data export capabilities. The API supports filtering, pagination, CSV export, and complex queries for campaign performance analysis.
API Endpoints
- GET /api/marketing: Main data endpoint with pagination, filtering by campaign/source/medium, and expandable user journeys
- GET /api/marketing/campaigns: Campaign analytics with first-touch attribution statistics and conversion metrics
- GET /api/marketing/user/ID/journey: Complete user journey timeline with all touchpoints and conversions
- GET /api/marketing/analytics: Marketing analytics summary with top sources, campaigns, and daily traffic patterns
- GET /api/marketing/first-touch-sources: First-touch attribution breakdown across all acquisition channels
- POST /api/marketing/track: Track marketing touchpoints with UTM parameters and user actions
- POST /api/marketing/conversion: Track conversion events with action type and conversion value
- CSV Export: All GET endpoints support Accept: text/csv header for data export
Technical Challenges & Solutions
Challenge: Attribution Window for Repeat Purchases
Determining when to re-attribute a repeat purchase to a new campaign versus accumulating value to the original acquisition campaign.
Solution: Implemented a 30-day re-attribution window with minimum 1-hour gap between purchases. New touchpoints within the window get credit; otherwise value accumulates to existing campaign, providing both retargeting insights and long-term CAC accuracy.
Challenge: Session Persistence Across Multiple Visits
Users often visit from a marketing campaign, leave, and return later to complete signup/purchase without UTM parameters.
Solution: Dual-layer persistence using both session storage and database. UTM parameters stored on user model at registration with first_utm_* fields and in marketing table for all touchpoints, ensuring attribution even weeks later.
Challenge: Multi-Touch Journey Attribution Accuracy
Users interact with multiple campaigns before converting—determining which touchpoints to credit and how to present the data clearly.
Solution: Implemented multiple attribution models (first-touch, last-touch, re-attribution) simultaneously, allowing business to analyze from different perspectives. Dashboard shows both primary source and top acquisition sources per campaign with percentage breakdowns.
Challenge: Real-Time Dashboard Performance
Computing complex attribution statistics and aggregations in real-time for dashboard display without slow page loads.
Solution: Optimized SQL queries with proper indexing, implemented database-level aggregations, and used Laravel query optimization techniques. Added caching layer for frequently accessed metrics and pagination for large datasets.
Demo Scenarios & Testing
Created comprehensive demo data showcasing real-world marketing scenarios. The seeder generates 8+ complete user journeys representing different attribution models and marketing channels, perfect for demonstrating system capabilities to stakeholders.
Demo User Scenarios
Alice Johnson - Single touchpoint → purchase showing basic paid acquisition
Bob Smith - Video ad → Carousel → Retargeting → Purchase demonstrating last-touch attribution
Grace Lee - Google first purchase + Instagram retargeting re-attributed purchase
Henry Taylor - Twitter acquisition with multiple loyalty purchases showing CLV tracking
Technology Stack
Business Impact & Value
This marketing attribution system provides BadgerCoin with enterprise-level marketing intelligence previously only available to companies using expensive analytics platforms. The system enables data-driven marketing decisions by answering critical business questions:
- Which campaigns drive the most revenue? Not just clicks or impressions, but actual dollar amounts attributed to each campaign
- What's the true customer acquisition cost per channel? Complete attribution from first touch through conversion with revenue data
- Which sources bring high-lifetime-value customers? Track long-term customer value beyond just initial purchase
- How do customers interact with multiple touchpoints? Complete journey visualization showing the path to conversion
- When should we re-attribute repeat purchases? Intelligent re-attribution logic that balances retargeting insights with CAC accuracy
- What's the ROI of different marketing investments? Direct revenue attribution enables precise ROI calculations per channel
Lessons Learned
Building an enterprise-level marketing attribution system from scratch provided deep insights into both the technical and business challenges of marketing analytics. Key learnings include the importance of flexible attribution models, the complexity of session persistence across multiple visits, and the value of comprehensive demo data for stakeholder presentations.
- Attribution Complexity: No single attribution model fits all business questions—supporting multiple models enables different analytical perspectives
- Data Persistence Strategy: Multi-layer persistence (session + database + user model) crucial for accurate long-term attribution
- Performance at Scale: Proper database indexing and query optimization essential for real-time dashboard performance
- Business Value Communication: Demo scenarios with realistic data crucial for demonstrating system value to non-technical stakeholders
- API Design for Analytics: Flexible filtering, pagination, and CSV export capabilities make the system valuable beyond just the dashboard
Interested in Learning More?
This project showcases my expertise in full-stack development, complex business logic implementation, and data-driven analytics systems.