Marketer’s guide to Markov and Shapley Multi-Channel Attribution models

Ankit Bagga
7 min readJan 21, 2024

When it comes to multi-channel attribution models, the 2 most common models are Markov and Shapley models. While there are plenty of blogs talking about these models along with the Python libraries to implement them, it was a struggle to find resources that talk about these models, not to a data scientist but a marketer. The following article covers the basics of implementing Markov and Shapley attribution models to evaluate the true impact of your marketing channels. Think of these models as advanced ways to figure out which of your marketing efforts are really pulling their weight in bringing customers to make a purchase.

Markov Chains

Imagine you’re watching a game where a player moves from one point to another, and each point is a step closer to the finish line (a purchase). In marketing terms, each point is like a customer interacting with a different marketing channel (like an ad on Facebook, a search on Google, or an email campaign).

  • What We Do: We track the journey of customers through these points (channels) and see how likely they are to move from one to another until they make a purchase.
  • How It Helps: By understanding these movements, we can see which points (channels) are most influential in guiding the customer to the finish line. If removing a point (channel) makes the journey to the finish line less likely, we know that point is pretty important.

Shapley Value

The Shapley value comes from a concept where a group of friends (channels) work together to win a game (drive a sale), and we want to figure out who contributed the most to the win.

  • What We Do: We look at all the ways these friends could have teamed up (all the possible customer journeys through different channels) and see how successful they were in each combination.
  • How It Helps: This helps us understand the true value of each friend (channel) in winning the game (making a sale), by averaging out their performance across all the different scenarios. It’s like figuring out which player in a sports team contributes the most to winning games, regardless of the game plan.

Implementing These Models for Marketing

  • Track the Customer Journey: Start by collecting data on how customers interact with your marketing channels before making a purchase. This includes every ad click, email open, or social media interaction.
  • Identify Key Channels: List out all the different marketing channels you use (like email, social media, paid ads) and any combinations you think are important.
  • Analyze the Impact: For Markov chains, calculate how often people move from one channel to another and how these movements relate to purchases. Tools like Google Analytics can offer insights into the customer path, which can be a good starting point for this analysis.
  • For the Shapley value, try to understand how each channel contributes to the final purchase when it works alone and when it works with other channels. You might need some help from a data analyst or a tool designed for attribution modeling to calculate this.

Let’s simplify this further with an example of a hypothetical marketing campaign and recommendations for tools that can help simplify the attribution process. Our goal is to understand the impact of each marketing channel on driving sales, using both Markov chains and Shapley values, in a way that’s easy for a marketer without a deep data science background to grasp.

Imagine you’re running a campaign to sell a new type of running shoe. Your marketing channels are:

  • Social Media Ads (Facebook, Instagram)
  • Email Marketing
  • Search Engine Ads (Google Ads)
  • Influencer Partnerships

Customers often interact with several of these channels before making a purchase. For example, someone might see an Instagram ad, click on a Google ad a few days later, and finally make a purchase after receiving a promotional email.

Simplified Attribution Analysis

Markov Chains Approach:

  • Step 1: Collect data on how customers move from one channel to another. For simplicity, let’s say 100 customers made a purchase, and you track back their steps.
  • Step 2: Notice patterns like many customers who start with Instagram ads tend to click on Google ads before making a purchase.
  • Step 3: Calculate the importance of each channel by imagining what happens if a channel was removed. If removing Instagram from the journey significantly drops purchases, it indicates Instagram is a valuable channel in this journey.

Shapley Value Approach:

  • Step 1: From the same data, list all the unique paths customers took to make a purchase.
  • Step 2: For each path, mix up the order of channels and calculate what each addition contributes to the likelihood of a purchase. This can be complex, so using a simplified approach, think about how often a channel appears in paths that lead to purchase.
  • Step 3: Determine the average contribution of each channel across all permutations. Channels that consistently add more value to mixed paths are considered more influential.

Tools to Simplify the Process

For marketers, diving into raw calculations might be daunting, but several tools can help:

  • Google Analytics: Offers basic path analysis and can be a starting point for understanding customer journeys.
  • Attribution Tools: Platforms like Adjust, AppsFlyer, and offer more sophisticated attribution modeling features that can automate much of the analysis work. They can provide insights similar to Markov chains and Shapley values without needing to manually calculate everything.
  • Custom Dashboards: Tools like Tableau or Microsoft Power BI can be used to visualize customer paths and interactions with channels. While they require setup, they offer powerful ways to see the impact of different channels on customer behavior visually.

Practical Tips

  • Start Small: Begin with a simple analysis focusing on a few key channels and straightforward customer paths. This can still yield actionable insights.
  • Seek Collaboration: Work with your data team to set up the initial data tracking and analysis framework. Once set up, ongoing analysis can be more automated and less technical.
  • Iterate and Learn: Use initial findings to test changes in your marketing strategy, then measure the impact and adjust again. Attribution is an ongoing process, not a one-time calculation.

Setting Up Attribution Tools

1. Google Analytics (GA):

  • Setup: If you haven’t already, integrate Google Analytics with your website. Ensure you’ve enabled eCommerce tracking for sales data.
  • Customer Journeys: Use the ‘Multi-Channel Funnels’ and ‘Attribution’ reports in GA to get insights into how different marketing channels contribute to conversions. These reports can show you the paths customers take and how different channels interact.
  • Actionable Insight: Look for patterns in the top conversion paths. If you notice that a significant number of conversions involve a specific sequence of channels, consider investing more in those channels or optimizing the transition between them.

In GAv4 you will find all customer paths in the raw BigQuery export.

2. Attribution Platform (e.g., Adjust, AppsFlyer):

  • Setup: These platforms require integration with your app or website. Follow the platform’s integration guide to set up tracking for each marketing channel.
  • Analyzing Data: Use the platform’s dashboard to view the attribution modeling reports. These platforms often offer models that closely resemble Markov chain and Shapley value calculations.
  • Actionable Insight: Identify which channels have the highest impact on conversions. These platforms can also help you understand the incremental impact of each channel, which is crucial for allocating your marketing budget effectively.

3. Visualization Tools (e.g., Tableau, Power BI):

  • Setup: Connect these tools to your data sources (Google Analytics, CRM, etc.). You might need to export data from your analytics platforms and import it into the visualization tool.
  • Custom Dashboards: Build dashboards to visualize the customer journey and channel performance. You can create visualizations that show the frequency of different paths to conversion and the performance of individual channels.
  • Actionable Insight: Use the visualizations to identify trends and outliers. For example, if certain channels consistently appear in the most successful paths to conversion, those are likely your most valuable channels.

Interpreting Results for Actionable Insights

Identify Your Most Valuable Channels:

  • Look for channels that appear frequently in conversion paths, especially those that often precede conversions. These are your high-impact channels and deserve more investment.

Understand the Role of Each Channel:

  • Some channels may be more effective at initiating customer interest (top of the funnel), while others are better at closing sales (bottom of the funnel). Tailor your strategy accordingly, focusing on awareness or conversion as needed.

Optimize the Path to Conversion:

  • If you notice that certain channel sequences are more effective, consider how you can encourage customers to follow these paths. This might involve targeted campaigns that move customers from one channel to the next more smoothly.

Test and Refine:

  • Use your insights to experiment with different marketing strategies. For example, if the analysis suggests an underutilized channel could be valuable, allocate more budget there and monitor the impact.

Collaborate with Your Data Team:

  • Regularly review the attribution analysis with your data team to refine the model and interpretation. Attribution models can become more accurate and insightful with more data and adjustments.

Attribution modeling is a powerful approach to understanding the complex impact of your marketing efforts. By leveraging the right tools and focusing on actionable insights, you can make more informed decisions that drive better outcomes for your marketing campaigns. Remember, the goal is continuous improvement — start simple, learn from the data, and iterate on your strategies.