MAHMOUD ABDELNABY
Reporting · CLI SCRIPT · 2

Cooperative Game Theory Shapley Multi-Touch Attribution Engine

Distribute marketing credit fairly using Cooperative Game Theory. Compare Shapley attribution against First-Touch and Last-Touch with zero dependencies.

Problem it addresses

Build a standalone Python multi-touch attribution engine (shapley_attribution.py): 1) Implements exact Shapley value calculation from user touchpoint journey strings (e.g., 'Google > Facebook > Email > Conversion'), 2) Compares Shapley credit against First-Touch, Last-Touch, Linear, and Time-Decay models, 3) Exports an interactive HTML comparison table and bar chart, 4) Includes 1,000 synthetic multi-channel touchpoint journeys.

Who it is for

PRO operating in high-growth e-commerce, digital publishing, and direct-response marketing across Saudi Arabia, UAE, and Egypt.

What is inside

Key files listed in the README repository architecture:

  • docs/mathematical-foundations.md
  • examples/touchpoint_journeys.csv
  • LICENSE
  • README.md
  • reports/attribution_comparison.html
  • reports/attribution_weights.html
  • sample_data/touchpoint_journeys.csv
  • src/shapley_attribution.py
  • tests/test_attribution.py
  • tests/test_shapley.py

How to evaluate and use it

  1. Read the README first and confirm that the documented problem matches your use case.
  2. Inspect the listed files to find the data, tools, templates, and tests relevant to your task.
  3. Follow the repository’s Quick Start and check prerequisites before running commands.
  4. Compare outputs with documented examples and review limitations before using them in a decision or client workflow.

Quick Start from the README: python -m unittest discover -s tests · python src/shapley_attribution.py --help

Scope and limitations

  • Combinatorial Complexity ($2^N$): Computes exact Shapley marginal contributions for up to 10 distinct marketing channels; uses Monte Carlo sampling for larger sets.
  • First-Touch & Last-Touch Bias Elimination: Fairly distributes revenue credit to middle-funnel touchpoints (e.g. email, content) undervalued by default ad platform reports.
  • Path Deduplication: Sequences repeated visits from identical channels within short timeframes (e.g. 1 hour) into single consolidated interactions.

This page summarizes the available documentation; it does not establish performance or business results. Verify data and prerequisites before use.

Related repositories