This article walks you through GA Effect, a web application that helps you identify whether events happening on your Google Analytics data are statistically significant or just pure chance; in other words, it separates signal from noise.
I will focus here on how to use GA Effect and interpret the results, but if you are interested in building your own online statistics dashboard using R, take a look at my previous post, where I explain how this application was built.
You may recognise the situation: you've implemented some SEO improvements 3 months ago and you're now checking if and by how much your revenue has improved since then. You log in to Google Analytics, but instead of a huge peak of SEO traffic, you are instead greeted with a slight hump. You think it may be due to your efforts, but can't definitely say. The marketing team is saying the increase is due to a display campaign they did 6 weeks ago that influenced your brand search, but you think otherwise, and you need to prove it to justify releasing budget for more SEO work.
Or how about this: you're in charge of a travel website, and your country has just won the Eurovision song contest. Everyone is saying this is great news for the country's tourism and you should see an increase in bookings. Could you judge if this is the case, or is any increase you see that year just due to seasonal variation? Maybe its just the weak currency?
What both these scenarios have in common is a certain event happening, which may or may not have had a positive effect. Wouldn't it be nice to know for sure that the event was significant, backed up by more than just instinct or opinion? That way you could be more data-driven regarding future investments. Further, if you do find that event to be significant, it would be nice to have an idea of how much it moved the needle, so you can judge its overall value and ROI.
The situations discussed above are great examples of what GA Effect attempts to answer using a Bayesian structural time-series method. It provides a Yes or No answer to the question "Is this event significant?" The tool also gives a metric value to those events.
GA Effect is coded in R and takes advantage of the CausalImpact package released in 2014 by Googler Kay H. Brodersen. The package uses Bayesian structural time-series to build an estimate of what your metrics would look like if no event happened, and then compares that with what actually happened (image below from official package page). If the model is correct, then by comparing the differences between its estimate and reality, you can get an educated guess of the event's value.
If you were looking to do similar analyses without Bayesian time-series, a sensible approach would be to take the average value before the event, and compare it with the average afterwards. The CausalImpact model builds on top of that by using Bayesian statistics to give you a better guess at those averages, as well as accounting for season and time.
The statistical significance tests are set to 95% confidence level. That is to say, if you do find significance, an experiment run 100 times is expected to see the impact 95 times. This means that if all your assumptions are correct, you can be a lot more confident in that event's effect. Bear in mind several assumptions need to hold for this to be the case, which we discuss later - not following those assumptions may give you incorrect results.
The two examples discussed previously were used to test the app, along with a few others. Below I will discuss in detail how GA Effect was used to analyze the impact of SEO changes on a website.
It is important to keep in mind that you should always have a question in mind before using the app. This may seem obvious, but don't simply go "shopping" for significant events, regardless of their meaning. Plan it like you plan an experiment - pick a hypothesis, judge what you would expect to see if the hypothesis was true, then use the app to test that hypothesis. So, here is the hypotheses we will look at below:
Did changing the title tags impact this website's SEO traffic, and if so by how much?
Below are the steps you will need to follow in order to check whether the hypotheses above is statistically significant or not.
1. Go to https://mark.shinyapps.io/ga-effect/ and authenticate with a Google account that has access to the correct Google Analytics View.
2. Pick your View from the selection list.
3. Select a date range. Tips on picking a good date range are below, but a rule of thumb is 7:3 ratio of pre-event:post-event.
4. Pick your segment. This will show all your custom segments, but for now we will pick "Organic Traffic" as we want to see SEO impact.
5. Pick your metric. We will just choose sessions, as conversions such as revenue or goal could be affected by your website's conversion rate performance. You should now see a plot of your selections in the middle of the screen - it shows date and your metrics plotted just as you would see in Google Analytics reports itself. The plot is interactive - try click-dragging to zoom in for fine detail, to help choose when your event was.
6. You will also see a vertical line labelled "Event" in the screenshot. Move the line to when the SEO changes occurred, this date will be used to calculate the statistics.
7. The screenshot above shows the setup. In our case, the SEO changes went live on the August 01, 2014, so that date has been chosen in the field beneath the graph.
8. Most datasets also have a seasonality, especially e-commerce websites. Two are supported in this version, Weekly and Monthly. Other seasons such as Annual may be added in the future. We're choosing weekly as we can see weekends are quieter than weekdays.
9. Once you're happy, click over to the Results page in the top left hand corner.
10. The app will think a bit, then show you the results, as seen in the screenshot below.
Here is an explanation of the results shown in the screenshot above:
Underneath the plots is the raw output of the CausalImpact model, so you can examine the details. It includes a nice written report that tries to give some insight into the results, plots that the upper graphs were based upon, and a table of the statistics computed.
That's pretty much it. You can redo the process by going back to the Setup page or Start Again to re-authenticate. Note also that there is a notification log top right, so you can keep track of what you have been doing.
This is just one application, not necessarily the most interesting to you. Give it a go and check the most relevant applications to your website using your own data.
Just blindly trusting statistics is dangerous, and although GA Effect can be a powerful tool, don't put faith in its results without putting care into its model assumptions. There are several assumptions that CausalImpact makes:
GA Effect is really just a wrapper around the CausalImpact R package, and only touches the surface of what it can achieve. For instance, only one metric is used for predictions, when multiple can be used (say Google trends for a brand term in the SEO example). You can also provide custom seasonality, and customise the model itself via its underlying bsts package.
The GA Effect app itself wouldn't be possible without the incredible work of the RStudio team, with products such as Shiny, shinyapps.io and dygraphs making the app as it is. Last but not least the GA connection is courtesy of the rga() package by Bror Skardhamar.
If you've not used R before now, its a great time to start as all these people and more are working hard to make it more accessible every day. Once you're hooked, you'll never open an Excel sheet again :) I write about R and Web Analytics and how it helps with my daily work at my blog, so join me there to follow my progress and hopefully help with yours.
Subscribe To Our Newsletter For Monthly Updates