If you are an SEO you constantly struggle to measure the impact of your strategy in the most precise and irrefutable way; Causal Impact, a methodology originally introduced by Google, helps you exactly with this. In this blog post I will share a Colab notebook that will help you, starting from data coming downloaded from the Google Search Console, to run a Causal Impact Analysis. The data you will find in Colab is related to a LocalBusiness markup optimization task.
What is Causal Impact Analysis?
It’s a statistical analysis that builds a Bayesian structural time series model that helps you isolate the impact of a single change being made on a digital platform.
Let’s say you have decided to improve the structured data markup of a local business and you want to know how this particular change has actually made impacts on traffic that we see coming from Google.
This sounds simple because you could just compare the measures before adding the new markup and after the change. But, it’s actually hard to measure in the real world because there are so many attributes that could influence the end results (e.g. clicks from Google). The so called “noise” makes it hard to say – yes, this actually has created a positive impact.
Google had the same problem and Kay Brodersen and the team at Google built this algorithm called Causal Impact to address this very challenge and open-sourced it as an R package. In the code I provide you here I am using a library called pycausalimpact developed by William Fuks 🙌
Let’s look at the code
1. Install libraries
2. Download data from Google Search Console and publish it using Google Sheets
3. Plot data
Here we only want to make sure we’re getting the right data into the analysis.
4. Configure pre and post periods
Here you will need to be careful and configure the dates before (pre_period) and after (post_period) the change.
Keep in mind that CI will create a prediction by analyzing the data in the pre_period and it will subtract the prediction from the post_period to see the actual impact.
4. Run the analysis and get the response
With a few simple instructions you will get:
- the graphical response as well as
- the detailed summary of your experiment in written form.