Default Attribution Model Setting - How It Works & Why It Fails
Overview
The Default Attribution setting in System Settings is stored in the database but inconsistently applied across different views, leading to confusion when users change the setting and don’t see data updates.How It’s Supposed to Work
1. Storage Location
File:useraccount/models.py:70
'Any Click' (set in models.py:99)
Display Names:
- “Any Click”
- “First Click”
- “Last Click”
- “Equal Weight”
- “View Through Attribution”
2. The Data Is Already Calculated
This is the key insight: Theinteraction_insight_summary table contains ALL four attribution models pre-calculated:
File: interaction_insight/management/commands/ProcessInsightSummary.py:86-148
| Column Name | Attribution Model |
|---|---|
any_click_revenue | Every touchpoint gets 100% credit |
first_click_revenue | First touchpoint only |
last_click_revenue | Last touchpoint only |
linear_click_revenue | Split evenly across touchpoints |
3. How Views Use the Setting
Most views correctly read and apply the setting: File:interaction_insight/views.py:62-74
interaction_insight/selectors.py:1890-1897 (OrderDetailsSource)
Where It Works Correctly
These views DO respect the default attribution setting:1. MOAT (Mother of All Tables)
File:interaction_insight/views.py:2565-2570
- ✅ Reads
mediasource_click_priorityfrom database - ✅ Uses it as default if user hasn’t manually selected
- ✅ Allows user override via dropdown
2. Campaign Performance
File:interaction_insight/views.py:3431-3436
- ✅ Reads setting
- ✅ Applies to queries
- ✅ User can override
3. Ad Performance
File:interaction_insight/views.py:4099-4104
- ✅ Reads setting
- ✅ Applies to queries
- ✅ User can override
4. Email Reports
File:customemail/management/commands/selectors.py:27-38
- ✅ Reads setting
- ✅ Dynamically builds SQL with correct column name
Where It FAILS
Revenue Comparison Page (PRIMARY ISSUE)
File:interaction_insight/views.py:8307
- Completely ignores
mediasource_click_prioritysetting - Always uses “Any Click” attribution
- User cannot override this behavior
- Leads to inflated revenue numbers (e.g., 255K actual)
- No dropdown to change attribution
- Doesn’t respect system setting
- Shows overcounted revenue by default
- Confuses users comparing to other reports
Why Changing the Setting Appears to Do Nothing
When you update the attribution setting: ✅ What DOES happen:- Setting is saved to database immediately
- MOAT, Campaign Performance, Ad Performance pages use new setting on next load
- Email reports use new setting
- Revenue Comparison page ignores it (hardcoded)
- No frontend notification of change
- No automatic page refresh
- Some cached queries may persist for a short time
How the Setting SHOULD Work
Current Implementation (Broken)
Correct Implementation
Technical Root Cause
The disconnect:- Backend stores setting (
mediasource_click_priorityin DB) - Most views read setting (lines 62-74, 2565-2570, 3431-3436, 4099-4104)
- Revenue Comparison hardcodes value (line 8307)
- No consistency enforcement across views
Proposed Fixes
Fix 1: Remove Hardcoded Attribution in Revenue Comparison
File:interaction_insight/views.py:8307
Current (WRONG):
- Respect user’s system setting
- Still allow URL parameter override
- Make Revenue Comparison consistent with other pages
Fix 2: Add Attribution Dropdown to Revenue Comparison
Currently Revenue Comparison has no UI control for attribution. Add:Fix 3: Add Setting Change Notification
When user updates default attribution in System Settings:Summary Table
| View / Report | Respects Setting? | Has Dropdown? | Notes |
|---|---|---|---|
| MOAT | ✅ YES | ✅ YES | Works perfectly |
| Campaign Performance | ✅ YES | ✅ YES | Works perfectly |
| Ad Performance | ✅ YES | ✅ YES | Works perfectly |
| Revenue Comparison | ❌ NO | ❌ NO | BROKEN - Hardcoded |
| Email Reports | ✅ YES | N/A | Works perfectly |
| Executive Summary | ✅ YES | ❌ NO | Uses setting, no override |
Conclusion
Why changing the setting doesn’t update data:- ✅ Data is already calculated - All attribution models exist in the database
- ✅ Most views work correctly - They read the setting and query the right column
- ❌ Revenue Comparison is broken - It hardcodes “Any Click” and ignores the setting
- ❌ No user feedback - System doesn’t indicate which pages respect the setting
Related Documentation
- See
REVENUE_COMPARISON_HARDCODED_ISSUE.mdfor detailed analysis of the Revenue Comparison hardcoded issue - See
REVENUE_TRACKING_ANALYSIS.mdfor broader revenue tracking issues
.png?fit=max&auto=format&n=Frm2GFbmok4D-yJA&q=85&s=93c3ebd47542af65d1cd06d8563a7f6e)