Enhancing Marketing Attribution Through Predictive Visualization With Markov Chain

Enhancing Marketing Attribution Through Predictive Visualization With Markov Chain

For those engaged in high-level multi-channel marketing, the goal is to extract the absolute maximum from their budgets. Even single-digit improvements in conversion rates can provide a competitive advantage in fiercely contested markets.

In addition to the well-known heuristic multi-touch attribution models and data-driven models, which sometimes feel like magic boxes due to their machine learning approaches, more and more companies are taking attribution into their own hands, placing their trust in the Markov Chain.

In the following, I'll provide an overview of resources and examples to guide you in creating your own initial Markov Chain with Python. This will help you visualize the effectiveness of interaction points such as Google Ads, Email, or Linkedin.

What is The Markov Chain?

In simple terms, a Markov chain is a mathematical model that describes a system's transitions between different states. The crucial Markov property states that the probability of moving to a future state depends only on the current state, not on the sequence of past events. This concept involves states, transitions, and transition probabilities: https://www.avayant.com/post/building-an-attribution-model-with-markov-chains

Decoding The Dance of Customer Interactions

For Conversion Optimization, Markov chains are essential in understanding and predicting customer journeys through various marketing channels. The model analyzes the likelihood of a customer moving from one interaction state to another based solely on their current interaction, not considering the history of previous interactions. This approach helps decode the intricate dance between marketing channels, providing insights into the sequence of customer encounters and their impact on conversions.

Markov chains operate on probabilities, creating a compelling story of customer interactions and revealing the enchanting choreography of how different channels work together to lead customers to conversion.

Other Attribution Model

  • First Click or First Touch Attribution Models: Credits the first interaction for conversions; ideal for top-of-funnel marketing, longer purchase cycles, and campaigns introducing customers to the brand.
  • Last Click or Last Touch Attribution Models: Attributes conversion credit solely to the last interaction; suitable for initial attribution analysis, short purchase cycles, and campaigns relying on paid ads for new customers.
  • Time Decay Attribution Models: Assigns more credit to touchpoints closer in time to the conversion; Useful for multiple marketing channels and longer purchase cycles, recognizing recent interactions' higher impact.
  • Linear Attribution Models: Shares credit evenly across all touchpoints; Suitable for diverse channels, complex purchase cycles, and when there's no preference for specific touchpoints.
  • Position-Based or U-shaped Attribution Models: Flexible model giving more weight to the first and last touchpoints; Recommended for a sophisticated approach, diverse channels, and higher ad spend, allowing manual weighting.
  • Shapely Attribution Model: Utilizes shape parameters to adjust the weight of each touchpoint; examines the shape and timing of interactions
  • Data-Driven Attribution Models: Utilizes advanced algorithms or machine learning for credit assignment; appropriate for complex marketing channel mixes, neutral opinions on relative value, and higher ad spend, relying on data analysis to determine touchpoint value.

Why do we Prefer Markov Chain?

Markov chains have their focus on the dynamic order of customer interactions. Unlike many other models that rely on static rules, Markov chains operate on the probability of one interaction influencing the next, solely based on the current interaction. This allows for a nuanced understanding of how various marketing channels work together in sequence, providing insights into the evolving probabilities of customer journeys and their impact on conversions.

The model's reliance on probabilities makes it a powerful tool for decoding the intricate dance between interactions and optimizing the path to conversion.

Resources For Implementing Markov Chain

To employ the Markov Chain for marketing attribution (without relying on tracking codes or APIs to be handed over to any third-party service), a consistent dataset with user interaction points is required, spanning from the initial interaction to conversion or interaction termination. Assuming the setup is correct, platforms such as Google Analytics or Matomo can provide such data. Some companies take it a step further by integrating a Data Warehouse, ensuring independence from Data-Driven Attribution models, which increasingly incorporate Machine Learning, often appearing as a black box to marketers.

1. Python Implementation of Markov Chain

For those eager to delve into Python for implementation, I highly recommend the following outstanding article. It utilizes well-known libraries such as pandas, numpy, seaborn, and collections to illustrate the entire process of a simple marketing attribution Markov Chain. Copying the article can be found here: https://medium.com/@akanksha.etc302/python-implementation-of-markov-chain-attribution-model-0924687e4037

Let's have a look on the transition states.

2. PoC: First-Order Markov Chain

A simpler approach involves using the "markov_model_attribution" library, serving more as a proof-of-concept. It leverages a fractional attribution model, employing a first-order Markov chain to reallocate conversions. You can find it here: https://github.com/jerednel/markov-chain-attribution

Please note: The library is unfortunately poorly maintained and requires a downgrade of the utilized resources.

Generating a first-order Markov chain.

3. Comparing Heuristic With Probabilistic Models in Python

Alternatively, I recommend this approach, also accompanied by relevant source code. The ChannelAttribution library is used to compare and visualize various Heuristic Multi-Touch and Probabilistic Attribution models. You can find it here: https://pypi.org/project/ChannelAttribution/

Note: I have thoroughly tested it and discovered a minor caveat – it requires the Microsoft Visual C++ 14.0 Framework or higher.

Comparing heuristic multi-touch and probabilistic attribution models.

Visualizing The Markov Chain

In the final step, we aim to visualize the developed Markov Chain. To do this, we'll start by installing the markovchain Library from the console: (https://github.com/NaysanSaran/markov-chain

pip install markovchain        

Next, we populate a multi-dimensional array, which already reflects the conversion rates of different interaction points, with hypothetical values from Channels like Google, YouTube (YT), or LinkedIn. Before we start, we have to import the markovchain Library - and other required libraries like numpy and matplotlib.

import matplotlib.patches as mpatches 
from matplotlib.collections import PatchCollection
import matplotlib.pyplot as plt
import numpy as np
from markovchain import MarkovChain as mc

P = np.array([
    [0.7, 0.1, 0.0, 0.1, 0.1, 0.0, 0.0], 
    [0.5, 0.3, 0.0, 0.1, 0.1, 0.0, 0.0],
    [0.5, 0.1, 0.0, 0.0, 0.1, 0.3, 0.0],
    [0.3, 0.2, 0.0, 0.1, 0.3, 0.0, 0.1], 
    [0.2, 0.0, 0.0, 0.4, 0.2, 0.2, 0.0],
    [0.5, 0.1, 0.0, 0.1, 0.2, 0.1, 0.0], 
    [0.4, 0.1, 0.0, 0.2, 0.2, 0.1, 0.0], 
])

attribution = mc(P, ['Conversion', 'Google', 'Line', 'YT', 'SEO', 'LinkedIn', 'TikTok'])        

Then, using the draw-method, we generate a simple, easily readable 7-State Markov Chain.

attribution.draw("markov_chain.png")        
Typical 7-State Markov Chain generated with the markovchain's draw method.

Conclusion

Utilizing the Markov Chain for marketing attribution can particularly add value when dealing with substantial advertising budgets and numerous interaction points, surpassing outdated heuristic models and aiding in enhancing conversion rates. The resources showcased in this article provide an initial avenue for exploration.

要查看或添加评论,请登录

Bj?rn Thomsen的更多文章

社区洞察