Skip to main content

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
Default Value: '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: The interaction_insight_summary table contains ALL four attribution models pre-calculated: File: interaction_insight/management/commands/ProcessInsightSummary.py:86-148 This means: Changing the attribution setting does NOT require reprocessing data. The system just needs to query a different column.

3. How Views Use the Setting

Most views correctly read and apply the setting: File: interaction_insight/views.py:62-74
File: interaction_insight/selectors.py:1890-1897 (OrderDetailsSource)
Then queries:

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_priority from 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
Impact:
  • Completely ignores mediasource_click_priority setting
  • Always uses “Any Click” attribution
  • User cannot override this behavior
  • Leads to inflated revenue numbers (e.g., 298Kvs298K vs 255K actual)
Why this is problematic:
  1. No dropdown to change attribution
  2. Doesn’t respect system setting
  3. Shows overcounted revenue by default
  4. 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
What DOESN’T happen:
  • 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:
  1. Backend stores setting (mediasource_click_priority in DB)
  2. Most views read setting (lines 62-74, 2565-2570, 3431-3436, 4099-4104)
  3. Revenue Comparison hardcodes value (line 8307)
  4. No consistency enforcement across views

Proposed Fixes

Fix 1: Remove Hardcoded Attribution in Revenue Comparison

File: interaction_insight/views.py:8307 Current (WRONG):
Proposed Fix:
This would:
  • 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

Conclusion

Why changing the setting doesn’t update data:
  1. Data is already calculated - All attribution models exist in the database
  2. Most views work correctly - They read the setting and query the right column
  3. Revenue Comparison is broken - It hardcodes “Any Click” and ignores the setting
  4. No user feedback - System doesn’t indicate which pages respect the setting
Bottom Line: The setting infrastructure works, but Revenue Comparison bypasses it entirely. Fix line 8307 and the system will work as intended.
  • See REVENUE_COMPARISON_HARDCODED_ISSUE.md for detailed analysis of the Revenue Comparison hardcoded issue
  • See REVENUE_TRACKING_ANALYSIS.md for broader revenue tracking issues