Donate Ethereum to this address
If you find the blog useful and would like to show some support, a little donation of Ethereum would help to keep this site alive. Appreciate it!
Data Layer is a crucial component for any Web Analytics implementation.
It helps web developers to organize the data before passing them to the relevant channels (tag management system, database, etc).
Implementing a Data Layer is simple and effortless, and you might already have something similar in place but just don’t know it yet.
In this article, we will explain in-depth what a Data Layer is, how we can use it and what do we need to look out for.
If you’re new to analytics, we have some articles to get you started:
1. What is a Data Layer?
Data Layer is a data structure which holds all information that we want to pass from our websites to other applications.
Before we go any further, here’s a sample Data Layer.
2. Why do we need Data Layer?
Without a Data Layer, we define data as and when we need to pass them over to another application. Functionality-wise, there is nothing wrong with this approach.
But as the need to pass data around increases, it can be a very messy affair. Before long, you will be having trouble keeping track of the data used, and worse, standardizing the data.
Having a proper data structure allows us to have a clear overview on all the data used and also ease data management.
Data Layer is application-agnostic, which means it can be used by any tool that benefits from having a structured data storage.
This removes the need to re-invent the Data Layer if you were to switch from an analytics tool to another.
Hence, for a one-time effort, you will have a permanent place to store all the structured data, that can be accessed by any relevant application of your choice.
3. What goes into a Data Layer?
For a start, you can reference W3C standards.
Take a look at the data structure below:
Inside digitalData, we have many sub-categories for other data. The most common ones across all analytics projects are:
Depending on the business nature, tagging requirements can differ slightly.
In addition to the sub-categories listed above, we personally recommend the following too:
- Forms such as application forms, contact-us forms, etc
- Tools such as branch locator, financial service calculator, etc
- Clicks such as button clicks, link clicks, etc
- Video attributes
Customization of the Data Layer is up to us and our preferences. There’s no right or wrong, as long as we structure and categorize our data properly in a disciplined manner.
4. Additional tips
You are ready to create your own Data Layer.
But before you leave, here are some tips we have for you:
Store granular data
For example, we want to capture user address, which is made up of many smaller pieces of data.
In an address, assume we have the following:
- Block number
- Street name
- Zip code
Do we store all these information in a single:
Or do we separate them out into:
The right answer is to separate them out.
We can easily combine the granular data to form the full address, but we cannot easily split the entire string into individual pieces of data down the road.
So keep in mind, always store data in granular form.
Consistent naming convention
“Naming” and “naming” might look the same to us, but to most analytics tool, they are 2 completely different pieces of data.
We want our Data Layer to remain as simple as possible, both in readability and maintenance.
Below are some best practices to help us develop our own naming convention standards:
Do not use special characters
Some analytics tools cannot handle special characters(@, $, #, &, etc).
Also, do not use language-specific characters, such as chinese, japanese, etc.
So the next time you think about populating a value like “$1.50”, do yourself a favor and use “1.50” instead.
Stick to lowercase
As mentioned earlier, most analytics tools treat “Hello” and “hello” as 2 separate pieces of data.
Therefore, the best way is to ensure all data are in lowercase.
Adobe Analytics (DTM) actually has an option to force values captured to lowercase.
No redundant whitespaces
Like lowercase, a value with extra whitespace/s is treated as a separate value.
As we can see in the screenshot above, just below the option “Force lowercase value“, there’s an option in Adobe Analytics (DTM) to “Scrub whitespace and linebreaks using cleanText”.
For an e-commerce website, we can expect tons of product data.
It can be tempting for developers to scrap the webpages for product values, especially the name.
A single product can appear on many different webpages, such as home page, product page, campaign page, etc.
And on each of this different pages, the name of the same product might differ slightly:
- Home page
- Fabuex Washing Powder
- Product page
- Fabuex Washing Powder – Soft edition
- Campaign page
- Fabuex Washing Powder – Your Trusted Brand
The problem here is, these 3 values are treated as separate data in most analytics tool.
What you would get in your report will be 3 lines of data, which in fact, belongs to the same product Fabuex Washing Powder.
Therefore, it is extremely important for data standardiazation to avoid such a scenario.
If done right, Data Layer will make your analytics journey much easier.
Setting up analytics is only the beginning. Troubleshooting is where it gets tedious and challenging.
With a proper Data Layer, troubleshooting will be much simpler.
If you do not have a Data Layer yet, go ahead and build one now!