Data layers in under five minutes
Phil Craig explains everything you need to know about data layers but was afraid to ask.
What is a data layer?
It’s kind of like a Vienetta, actually no it’s not, it’s just the word ‘layer’ reminds me of Vienettas. Anyway, I’ll mop away my drool and continue.
In most cases, a data layer is a structure of your web pages data. In our world, it would be data that we wish to pass to a tag management tool. The great thing about a data layer, is that it can be implemented and remain basically unchanged even if you move from one tag management system (TMS) to another. So once it’s in, it’s there to stay – like that mouse in my student accommodation. Since I am most familiar with Google Tag Manager, I will use that solution in any examples.
Why are we passing data from the data layer to the tag manager?
Tag management systems love a data layer, where everything is in one place like a Chinese buffet. Digital analysts love them just as much (and probably like ‘all you can eat’ buffets even more), as it makes our life all the more simple.
However, if all this information is already in the data layer, then it is all the easier for us.
Also, sometimes, data we wish to collect isn’t available in the markup and would require extra developer knowledge to collect it without a data layer.
What does a data layer look like?
This script would sit within the head of each page and enable communication with the TMS, which would be GTM in this case. The data layer variables are completely customisable to your business and website needs. Things like ‘pageCategory’ variables means the analytics doesn’t rely on URL structure. You could have a page that has nothing in the URL to establish itself as a blog, but could pass this in the data layer.
Why implement a Data Layer?
I think the main advantages are:
- Ease of initial TMS set up
- Speeds up deployment of tags
- Data collection accuracy
- Relieves web developers of constant small changes.
Other key advantages are efficient project management, budgeting and resource allocation. For example, without the data layer, the digital analyst may have to delve into the realm of a developer to capture what is needed.
As mentioned earlier, most TMS experts will be able to collect the majority of data they need from the markup, but it is unlikely they will be as efficient as a developer who wrote the initial code.
Data layer and enhanced ecommerce tracking go together like Lennon and McCartney. If you have the need for ecommerce tracking on your site, I wouldn’t really consider any other type of implementation. Tracking impressions, brands, purchases, drop offs etc. are made all the easier.
The data layer can be as simple or as complex as you like. At the end of the day, it may or may not suit your analytics implementation. The hardest part is identifying what you need to pass to it.
It’s sometimes hard to sell the idea to the business if you have already set up your TMS without one. This is why in many cases, you’ll implement a data layer whenever you are creating a new site.
However, it’s never too late to implement one on your existing site, as going forward you’ll always have a robust data structure. The initial work spent will save numerous hours of technical support with your analysts and developers down the line.