The W3C Data Layer - Part I

02 Aug 2015 » Data Layer

This is the first post of a series of posts, in which I am going to describe the W3C data layer. A few months ago, I explained why it was a good idea to have a data layer. In this series, I am going to dive into the details of one particular data layer implementation: the W3C standard. For those of you who do not know what the W3C does, it is the international body that creates the standards that we use everyday on the web: HTML, CSS, Ajax… Although there are other options for data layers, like JSON-LD, I personally prefer the W3C standard; after all, this body has created some of the most important standards in the Internet.

The first thing I suggest is that you download the W3C data layer standard: http://www.w3.org/2013/12/ceddl-201312.pdf. It is completely free. Have a look at it. You will notice the amount of well known companies that contributed to this standard, including Adobe, my employer. In total, 56+ organisations and 102 individuals have collaborated in the creation of it. So, if you choose to follow this document, you can be confident that you are not on your own.

You might have also noticed the recency of this document: it is less than two years old (at the time of writing). This is probably why many Web analysts have never heard of the concept of data layer. That being said, the word is spreading quickly and it is starting to become the norm, rather than the exception. In fact, a few of my customers, that are undergoing a major redevelopment of their websites, are including a data layer, which they did not have before.

I hope that, by now, you are fully convinced of the need of a data layer and the benefits of going with the W3C standard. Your should also start spreading the word within your organisation. I have found that this step can be important, as any new addition to the website will face some resistance. It must also be remembered that this data layer is not exclusive for Web analytics; other Web marketing tools, like Web optimisers and DMPs will greatly benefit from a data layer.

Probably, the development team is going to be the most difficult to convince. They might have a different approach or think of the effort it will take, but my experience shows that, once they understand it, they will support this concept.

Start defining your data layer

Once you have everybody aligned, you should create a document with the contents of your particular implementation of data layer. Remember to include in the documenting process all on-line marketing teams: Web analytics, optimisers, advertisers… I was recently involved in the creation of a data layer for a customer and it took 5 weeks until it was finished. This is probably an edge case, but you should be aware that this stage might take longer than initially expected.

In a future post I will explain what is the content of the data layer. For now, I suggest you review section 6 of the W3C data layer document, to see what you can expect to include in the data layer. There are a couple of examples in section 7.

Location of the data layer

Before starting the development, the location of the data layer must be agreed with all parties involved. Ideally, it should be at the beginning of the <head> section of the HTML document. The reason is that it can then be used by any other JavaScript code. If this top-most location cannot be achieved, it should be located before loading any tool that needs will read the data layer. For example, if you are using a tag manager or a DMP like Adobe Audience Manager, the data layer should be placed above all of these tools.

There is finally one additional technical problem with placing the data layer at the top. Page-level information is usually retrieved from the CMS and can easily be cached and set in the HTML. However, depending on the CMS, there is some information, like user-level information, which is not available on page load and it requires an AJAX call. As a consequence, it is possible that the code that needs this data executes before the data is available. For example, the Web analytics code might be capturing the log-in status and will need the user-level information when executing. This problem needs to be solved on a case-by-case basis.

 

In future posts I will describe in greater detail other aspects of the W3C data layer:

  • Each of the JavaScript object
  • Integration with DTM

[UPDATE 16/08/2022] I do not recommend the W3C Customer Experience Digital Data Layer (CEEDL) any more. See my post on the EDDL



Related Posts