Skip to main content

Markov Model for Online Multi-Channel Attribution

Project description



What is multi-touch attribution?

Multi-touch attribution is a method of marketing measurement that considers all touchpoints on the customer journey and allocates a certain amount of credit to each channel. This allows marketers to understand the value that each touchpoint contributes to driving a conversion. For instance, suppose a consumer is contemplating the purchase of a new smartphone. After conducting some research, they come across ads. Initially, they encounter a display ad, which they overlook. Subsequently, they notice a native ad on their Instagram feed, capturing their attention and redirecting them to a website. Finally, they receive a promotional offer via email, complete with a discount code that motivates them to make the purchase.

Each of these ads represents a touchpoint in the buyer's journey. With multi-touch attribution, marketers can examine the impact of the native ad and the email campaign, attributing the sale to these specific efforts. Meanwhile, they can recognize that the display ad was ineffective and make adjustments accordingly.

There are various multi-touch attribution models available to marketers, analyzing user-level data such as clicks and impressions to understand the influence of these events on the ultimate goal. These models vary in their evaluation of ad effectiveness, offering marketers diverse perspectives to shape their strategies.

Multi-touch attribution models

Multi-touch attribution models aim to assign credit to different touchpoints in the customer journey. There are two families of attribution models: heuristic models and probabilistic models.

1. Multi-Touch Attribution Heuristic Models:

Heuristic models follow predefined rules to allocate credit to various touchpoints. These rules are often based on assumptions or industry best practices. Simplicity: Heuristic models are generally simpler and easier to implement. They use straightforward rules to distribute credit, making them more accessible for marketers who may not have extensive statistical expertise. Transparency: These models provide clear and understandable rules for assigning credit, offering transparency in the decision-making process. Examples of Heuristic Models are:

  • First touch Attribution: Attributes all credit to the first touchpoint in the customer journey, emphasizing the initial interaction's role in driving the conversion.

  • Last touch Attribution: Attributes all credit to the last touchpoint in the customer journey, highlighting the final interaction as the most influential in the conversion process.

  • Linear Attribution: Distributes credit equally to all touchpoints

2. Probabilistic Attribution Models:

Probabilistic models use statistical techniques and algorithms to analyze data and determine the probability of each touchpoint contributing to the conversion. Complexity: These models are often more complex than heuristic models, as they involve analyzing large datasets and considering various factors to determine credit allocation. Customization: Probabilistic models can be customized based on specific business requirements and nuances, allowing for a more tailored and accurate representation of the customer journey. Examples of Probabilistic Models:

  • Markov Chain Models: Analyzes the sequence of touchpoints to determine the transition probabilities between them.

  • Algorithmic Models: Utilizes machine learning algorithms to predict the likelihood of each touchpoint influencing a conversion.

Key Considerations:

  • Flexibility: Probabilistic models are often more flexible and adaptive to different business scenarios, while heuristic models may be less flexible but easier to implement.
  • Accuracy: Probabilistic models are generally considered more accurate because they are data-driven and can adapt to changes in consumer behavior over time.
  • Resource Requirements: Implementing and maintaining probabilistic models may require more resources, both in terms of data infrastructure and expertise, compared to heuristic models.

In summary, while heuristic models rely on predefined rules for credit allocation, probabilistic models leverage data-driven approaches and statistical techniques to provide a more nuanced and adaptable understanding of the customer journey. The choice between the two depends on factors such as the complexity of the business, the availability of data, and the desired level of accuracy and customization.

ChannelAttribution

ChannelAttribution is a Python and R library that employs a k-order Markov representation to identify structural correlations in customer journey data. Additionally, the library incorporates three heuristic algorithms (first-touch, last-touch, and linear-touch approaches) to tackle the same problem. These algorithms are implemented in C++ and are well-suited for handling large-scale problems involving hundreds or thousands of channels.

Installation

Python

NOTE: Only Python3 is supported! Note! Only Python3 is supported! Installation on Windows requires Microsoft Visual C++ 14.0 or greater.

From PyPi

pip install --upgrade setuptools
pip install Cython
pip install ChannelAttribution

Usage

In the following example we will show how Python library ChannelAttribution can be used to perform multi-touch attribution using heuristic models and Markov model.

First of all we need to load ChannelAttribution and data containing customer journeys:

import numpy as np
import pandas as pd
from ChannelAttribution import *
import plotly.io as pio

Data = pd.read_csv("https://channelattribution.io/csv/Data.csv",sep=";")

Now we can performe attribution with heuristic models:

H=heuristic_models(Data,"path","total_conversions",var_value="total_conversion_value")

We can also performe attribution with Markov model:

M=markov_model(Data, "path", "total_conversions", var_value="total_conversion_value")

Now we can merge attributed conversion for each method:

R=pd.merge(H,M,on="channel_name",how="inner")
R1=R[["channel_name","first_touch_conversions","last_touch_conversions",\
"linear_touch_conversions","total_conversions"]]
R1.columns=["channel_name","first_touch","last_touch","linear_touch","markov_model"]
R1=pd.melt(R1, id_vars="channel_name")

data = [dict(
  type = "histogram",
  histfunc="sum",
  x = R1.channel_name,
  y = R1.value,
  transforms = [dict(
    type = "groupby",
    groups = R1.variable,
  )],
)]

and plot them

fig = dict({"data":data})
pio.show(fig,validate=False)

We can also get the same plot in terms of attributed conversion value:

R2=R[["channel_name","first_touch_value","last_touch_value",\
"linear_touch_value","total_conversion_value"]]
R2.columns=["channel_name","first_touch","last_touch","linear_touch","markov_model"]

R2=pd.melt(R2, id_vars="channel_name")

data = [dict(
  type = "histogram",
  histfunc="sum",
  x = R2.channel_name,
  y = R2.value,
  transforms = [dict(
    type = "groupby",
    groups = R2.variable,
  )],
)]


Transaction level attribution problem

Transaction level attribution is problematic using Markov models. Markov model can be considered a "global" approach because it makes attribution considering all the paths together. Instead heuristic models are "local" approaches because they make attribution considering one path at the time and then global attribution for each channel is obtained through aggregation. Using Markov model one can not go from global to local attribution in a unique way. Because Markov model returns the aggregate result and you can not go from this aggregation to single path attribution.

Why Markov model is a global approach? Markov model aggregates real paths to build a Markov graph, a graphical representation of a transition matrix. Markov graph is a mathematical representation of the dynamics between channels. Markov model generates millions of random paths from Markov graph. Random paths are used to calculate importance weights (removal effects) for each channel. At the end of the process importance weights are normalized and multiplied by total conversions (the overall conversions observed for all the paths considered) to make attribution for each channel. Thus Makov model is global because first it aggregates paths to build transition matrix and then it works with simulate paths “forgetting” each single real path.

For this reason, the choice of the right measure to perform transaction-level attribution is crucial and removal effects should not be used as shown in this article.

ChannelAttribution Pro

If you are interested in transaction level attribution and additional features related to attribution and budget allocation have a look to ChannelAttribution Pro.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ChannelAttribution-2.1.7.tar.gz (744.8 kB view details)

Uploaded Source

File details

Details for the file ChannelAttribution-2.1.7.tar.gz.

File metadata

  • Download URL: ChannelAttribution-2.1.7.tar.gz
  • Upload date:
  • Size: 744.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/59.5.0 requests-toolbelt/0.8.0 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for ChannelAttribution-2.1.7.tar.gz
Algorithm Hash digest
SHA256 9588f9407108ac73b67aa08feaf744482a0cd20a78a58961301efa70afa32967
MD5 90a19bc1f1ad3a0b94a6b70362620953
BLAKE2b-256 7e7ea7393957bea8823ef20d61fc1c4787e7cf684ecbf1372f78ea4349ae8ed7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page