Automated testing of data layer implementation

We recently wrote about our colleague Marek Čech and Honza Kadleček talking about monitoring a data layer at MeasureCamp Brno.

Why are we addressing this?

We don’t like wasting the skills of handy analysts. If you feel it the same, and still don’t want to manually go through and check the correctness of the data layer implemented by developers, complicatedly browse events in the debug window of Google Tag Manager or GA / GTM debugger, then keep reading. Because we have a brief introduction of our approach for you, presenting the issues of validation of implemented data layer, which will show you how to get rid of most of these routines by using free tools.

Principle of solution

The philosophy of our approach is very simple. Some alternative solutions require tens of hours of programming or a lot of paid services, addons or tools. Our solution can be deployed, with a little dexterity, in an hour. No complicated technical implementations, you always work with your data from the data layer, and you do not pay for anything.

What will you need for that?

1. Tracker – a way of sending data from the web

For this method, we use Google Tag Manager, in which we deploy simple JavaScript, and use Custom Image Tag.

2. Collector – a way of receiving data

Pro tuto část využíváme velmi jednoduché a dostupné Google nástroje a to Google SpreadSheets a Google Apps Script. For this part, we use Google tools that are very simple and affordable, namely Google SpreadSheets and Google Apps Script.

3. Storage – space for storing the data

Since we have all the data in Google SpreadSheets, we don’t have to deal with anything complicated in this step either.

4. Parser – preparing data for evaluation

Probably the most complicated part of the whole solution – parsing JSON objects using Google Apps Script within SpreadSheets. SpreadSheets by itself does not support JSON parsing, so you need to play around a bit here. We use the method of so-called flattening the JSON object. JSON Schema can also be used for JSON validation, and we are preparing it for future versions of the tool.

5. Resolver – data evaluation

Lastly, we only need to define the implementation and evaluate the collected data. Everything is simply given in columns. Each column represents one variable from the data layer, and its values are validated by regular expressions.

How to properly prepare and evaluate data for validating the implementation? Find out in the second half of the article, written by our colleague Marek and Honza from Analytixer.

Scroll to Top