{"id":24011,"library":"marketing-attribution-models","title":"marketing-attribution-models","description":"A library for marketing attribution modeling, providing implementations of popular attribution methods such as first-click, last-click, linear, time-decay, position-based, and Markov chain models. Current version 1.0.11, with an active maintenance cadence on GitHub. Requires Python >=3.5.","status":"active","version":"1.0.11","language":"python","source_language":"en","source_url":"https://github.com/DP6/Marketing-Attribution-Models","tags":["marketing","attribution","markov-chain","heuristic"],"install":[{"cmd":"pip install marketing-attribution-models","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for data manipulation and DataFrame operations","package":"pandas","optional":false},{"reason":"Used for numerical computations","package":"numpy","optional":false},{"reason":"Used for plotting attribution results","package":"matplotlib","optional":true}],"imports":[{"note":"The correct top-level package is marketing_attribution_models, not mam.","wrong":"from mam import AttributionModel","symbol":"AttributionModel","correct":"from marketing_attribution_models import AttributionModel"},{"note":"The module name is plural (models) and uses underscore.","wrong":"from marketing_attribution import HeuristicAttribution","symbol":"HeuristicAttribution","correct":"from marketing_attribution_models import HeuristicAttribution"},{"note":"The Markov chain class is directly available from the top-level package.","wrong":"from marketing_attribution_models.markov import MarkovChainAttribution","symbol":"MarkovChainAttribution","correct":"from marketing_attribution_models import MarkovChainAttribution"}],"quickstart":{"code":"import pandas as pd\nfrom marketing_attribution_models import HeuristicAttribution\n\n# Sample journey data\njourneys = pd.DataFrame({\n    'path': ['A > B > C', 'A > C > B'],\n    'conversion': [1, 0],\n    'revenue': [100, 0]\n})\n\nmodel = HeuristicAttribution(method='linear')\nresult = model.attribution(journeys)\nprint(result)","lang":"python","description":"Create a HeuristicAttribution model with the 'linear' method and fit it to sample journey data."},"warnings":[{"fix":"Use 'first-click' instead of 'first_click' as the method argument.","message":"In v1.0.9, the method 'first_click' was renamed to 'first-click' to conform with other method names. Code using 'first_click' will break.","severity":"breaking","affected_versions":">=1.0.9"},{"fix":"Read the CSV into a DataFrame with pd.read_csv before calling attribution.","message":"The 'attribution' method on HeuristicAttribution and MarkovChainAttribution now requires a DataFrame instead of a CSV file path. Passing a file path is deprecated.","severity":"deprecated","affected_versions":">=1.0.9"},{"fix":"Ensure the path column uses ' > ' as the separator between touchpoints.","message":"The 'path' column must use ' > ' (space-greater than-space) as separator. Other delimiters like '>>' or '->' will cause incorrect parsing.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use the hyphenated form: 'first-click', 'last-click', 'linear', 'time-decay', 'position-based'","cause":"Using an outdated method name like 'first_click' or 'position_based'","error":"ValueError: method must be one of ['first-click', 'last-click', 'linear', 'time-decay', 'position-based']"},{"fix":"Ensure you pass a DataFrame to the attribution method, e.g., model.attribution(journeys)","cause":"Calling attribution() without passing a DataFrame or path","error":"TypeError: attribution() missing 1 required positional argument: 'journeys'"},{"fix":"Use 'from marketing_attribution_models import AttributionModel' (note the underscore after 'marketing')","cause":"Attempting to import from 'mam' or wrong casing","error":"AttributeError: module 'marketing_attribution_models' has no attribute 'AttributionModel'"},{"fix":"Rename the column to 'path' using df.rename(columns={'old_name': 'path'}, inplace=True)","cause":"Column name in DataFrame is not exactly 'path'","error":"KeyError: 'path'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}