Skip to content

How to customize your Multi-Channel Attribution in Google Analytics using Python

  • by

How do you attribute your eCommerce/website conversion to your marketing channels? Given the growing number of platforms you can use to reach your customers or audiences, digital marketers must be able to clearly evaluate which marketing mix combinations work best.

This article will show how to customize your Google Analytics Multi-Channel Attribution report using Python. It provides detailed information, from extracting assisted conversion data in Google sheets to transforming final report in Python notebook.

However, before we begin let’s have a quick refresher on what is Multi-Channel Attribution and identity its use case. 

What is Multi-Channel Attribution report?

As I mentioned above, it is about how you attribute sales or conversions on your website to your marketing channels. It is the process of identifying what channel sources/medium that led to a desired action or outcome. An outcome can be a lead through web forms, email subscriptions or a sale from your eCommerce website.

Multi-Channel Attribution report also answer questions like, among my channel sources or marketing campaigns which one deserves a credit for a given sale?

Let’s use an example about a customer buying a Christmas tree online. 

A prospective customer search on google “buy Christmas tree online promotions”. The customer found your link on search results, clicked the link and landed on your page. After reading the information, the customer decided to bookmarked your page.

The next day, same customer visited your page through bookmarks and decided to signup on your promotions page. A week after, he received your email campaign promotions, clicked the link and proceeded to buy the Christmas tree.

In this case, the customer have visited your page three times through multiple channel sources. The question is, is it fair to just attribute 100% of the sale to your email campaign? Does the first two channels played an important role to contribute to the sale?

This is where Multi-Channel Attribution becomes handy.If you haven’t used them before, the attribution models inside the Google analytics report is the best place to start your attribution journey.

Why use it?

With attribution modeling, digital marketing teams will have a better view of each customer journey, from the first time they see the advertisement to the end of the desired outcome (inquiry submission, subscriptions or sales).

By looking at the attribution report, it helps you decide smarter budget allocation across channels and optimize conversion rates for your website or eCommerce. Before starting your attribution journey in Google analytics ensure that you set up the following requisites. 

  • Establish a UTM framework and a UTM generator for your team.
  • Enable eCommerce set-up in your Google analytics (for eCommerce sites).
  • For lead generation website, make sure you have set up goals in Google Analytics .

Below are the available models that you can use in Google Analytics:

Last Google Ads Click, First interaction, Linear, Time Decay, Position Based and Data Driven.

You can find their definitions here:

https://support.google.com/analytics/answer/1662518?hl=en

What Multi-Channel attribution modeling should I use?

There is no right or wrong answer but you must develop a deep understanding about your company or business and how it makes money.

Understanding your customer life cycle and growing your product knowledge is also vital so you can apply the rightful model for your business. 

Subscribe to my mailing list

* indicates required

One good example is for property or real estate business. This is a high value service or product trade. In the case of marketing, the first few marketing channels will play a significant role to nurture potential customers and qualify the leads. Therefore Position Based or Linear model offers a good balance between the value each channel brings to your conversions.

In the case of retail with seven days or less purchase period, Time Decay or Last Click will make more sense. This is because customers are triggered by promotions or discounts which means it is very irrelevant to take into account too many marketing channels. Only the relevant channels should make the cut and be analyzed.

Another advantage of Customizing Multi-Channel Attribution report is, it helps to fix double counting of eCommerce transactions in Google Analytics. This rarely happens and will depend on your tracking method.

multi channel attribution analysis dashboard in Google Analytics

In rare cases, it happens when you generate a receipt page for your customer. It is common that the page can be revisited via cache or browsing history. When this happens it triggers another page view on the receipt page which results to inflation of your eCommerce sales. Overtime this will create errors on your reports if not fixed.

Extracting the Multi Channel Attribution Google Analytics report to Google sheets

Before we perform multi channel attribution analysis using python we have to extract our data set from Google sheets.

Open google sheets and select Add-ons on the toolbar menu. Select Google Analytics and click Create new report.

multi channel attribution analysis dashboard in Google Sheets

In the configuration path report fill in your preferred look back window and end date. For metrics put mcf:totalConversions, For dimension put mcf:sourceMediumPath, mcf:transactionID. Put your preferred row limit and put mcf for report type.

multi channel attribution google analytics metrics API

Click Run reports.

multi channel attribution google analytics API using SuperMetricss

There you can see the multi-channel conversion path report. The report shows the different channels the customer went through to complete the transaction in the last seven days. Technically you should only see one transaction per ID, however due to double page view of the Thank You page the number of transactions inflates.

multi channel attribution google analytics report extracted on Google Sheets

Now we are ready to process our own attribution report using Python, download the report as excel file. 

multi channel attribution analysis from Google Analytics export to offline spreadsheet

Uploading and transforming data in Python (Data analysis using Python)

Open your python notebook and import the file from your local drive

channel attribution python using Python Jupyter Notebook

Group your channel sources according to your preferred channel grouping. Normally, this step is not necessary provided that you strictly follow UTM parameters for each channel. 

channel attribution python data cleansing

attribution modeling in python channel grouping

For this example I will use last click model since by default, this is the most common model used by digital marketing teams.

attribution modeling in python attributing conversions by channels

I have also explored First click and Linear model for quick comparison. See image below:

attribution modeling in python - comparing different models

Broadly, there are multiple ways to do this in Excel or Google spreadsheet but I prefer to use Python for business analytics to automate this report for time efficiency. This allows me to spend my time for data analysis and growth. 

How do you attribute your eCommerce/website conversion to your marketing channels?