Erik Driessen

How to Automate Google Analytics Data With APIs in 5 Steps

Erik Driessen, Head of Digital Analytics at Greenhouse, shares how to automate Google Analytics data with APIs in 5 easy steps

Erik Driessen
Erik Driessen
Erik Driessen

How to Automate Google Analytics Data With APIs in 5 Steps

Erik Driessen, Head of Digital Analytics at Greenhouse, shares how to automate Google Analytics data with APIs in 5 easy steps

By
Erik Driessen
Erik Driessen
Erik Driessen

How to Automate Google Analytics Data With APIs in 5 Steps

Erik Driessen, Head of Digital Analytics at Greenhouse, shares how to automate Google Analytics data with APIs in 5 easy steps

By
Erik Driessen
Erik Driessen

How to Automate Google Analytics Data With APIs in 5 Steps

Erik Driessen, Head of Digital Analytics at Greenhouse, shares how to automate Google Analytics data with APIs in 5 easy steps

By
Erik Driessen

Tired of repetitive analytics tasks? Automation can help. Erik Driessen, Business Analyst at Belastingdienst, shares his actionable steps to automate Google Analytics using APIs.

Let’s be honest: we don’t like doing the same thing twice, or even worse, over and over again. Luckily we live in a world where automation is easier than ever. The big vendors we work within online marketing offer APIs. And these APIs allow you to build your own projects on top of their systems. It’s really awesome, and I would like to share how we automate Google Analytics data with APIs within my team at Greenhouse.

Why you should leverage APIs to automate

A big part of the work of the analyst is making analysis on data. And this often results in advice for decision making (or at least it should). I like to think of these decisions as 'if this then that' (IFTTT) decisions. These can be as simple as ‘I see a flatline, I really need to look into that’, or as complex as ‘I need to optimize a full-funnel media plan for the upcoming campaign year’. With APIs, many of these IFTTT decisions can and should be automated.

5 steps for automating Google Analytics data:

1. Start simple

I approach ideas like a startup. The first question I ask myself is: what is the bare minimum I need to build to validate my idea. I consider both the technical implications of this question and the business impact. In my example, we wanted to build a notification system to monitor data. Technically, we need something to get data from a web analytics system. And businesswise, the easiest check to make is a flatline check. Checking up on every KPI every day is not a good investment of time. Automating these checks is fairly easy, and could improve our data quality. It’s easy to set up because it does not include percentual drops or anomaly detection. It’s just a simple check. Zero is bad, not zero is good.

So the first version of our product would be a flatline monitor.

2. Technical evolutions

We normally start with a demo of the system. In this case, the demo was a local Python project. The project gets data from Google Analytics through the API. When there are zero data, it sends a notification to Slack. The notification mentions the digital analyst responsible for that Google Analytics setup. This project was our proof of concept.

Next up was a test run in the cloud. We don’t want to have run this project manually every day. The project should run automatically. So we tweaked the project to make it work in the cloud (in our case in AWS Lambda). This took a bit of learning, and after the first successful test run there, we continued.

Our final step was about ease of use. We wanted everyone in the team (not just colleagues that know how to program in Python) to benefit from this system. So instead of modifying our project every time we wanted to add a new client, we connected to a Google Sheet. The sheet contains all data checks we want to perform every day.  A row contains all the required information (e.g., Google Analytics view ID, dimensions and metrics to use, optional filters, what channel to send the slack message to, etc.). Our product was now ready to use for any colleague that knows how to add a row to a spreadsheet (and read our manual).

So the first version of our product would be a flatline monitor.

3. Build on it

With our MVP operational, we can start expanding the product. There are multiple directions to go in. We could make a more advanced monitor, for example by adopting anomaly detection. Or we can build other types of checks. We could check if steps in a funnel (e.g. cart add, checkout, and purchase) have logical data (more cart adds than checkouts, more checkouts than purchases). Or monitor A/B test data (is the custom dimension we use for reporting coming in when a test is running).

I’m a big fan of measurement in automation. We measure our automation projects with the measurement protocol. In the case of a notification system, this allows us to share how many automated checks the system has completed.

4. Measure it

I’m a big fan of measurement in automation. We measure our automation projects with the measurement protocol. In the case of a notification system, this allows us to share how many automated checks the system has completed. It currently has completed over 22.000 data checks for us.

5.  Start automating

Automation is a powerful thing. It’s easier than ever with APIs and cloud solutions. It’s even easier if you start out with a small MVP to prove that the idea that you have works. After that, automate the whole process, so you don’t have to do anything when it’s up and running. And after that, expand on your solution.

What will you automate?

About Erik Driessen:

Erik Driessen is a data analyst with 9 years of experience in digital marketing. He changed his focus to business analytics in the public sector in 2020. He is a Business Analyst at Belastingdienst, formerly Head of Digital Analytics at the Dutch brand & performance agency Greenhouse.

newsletter

Get the latest marketing analytics insights straight to your inbox

No-nonsense marketing and analytics best practices from industry leaders, straight to your inbox.