What is data layer?
When it comes to running a website or an app, we all need some information about our users to enhance their experience at our website (or app). For this purpose, we use analytics and tag management tools, which collect this information in the form of actionable data.
That’s not the only bugbear here. What if the HTML of our website undergoes some changes? For example, let’s say the button ID of a button accidentally got altered by the developer. Lol what a stupid developer! But shit happens and to err is only human.
The solution? Data Layer, duh.
To solve the problems mentioned above, some cool technical creatures came up with the concept of a Data Layer. It is a layer between the HTML and the Tag Management System (or any data collecting tool) which collects data from the HTML, and passes it to the Tag Management System or other data collection tools. It holds all the data we want to pass from our website to our linked applications.
In technical terms, HTML is called the Experience Layer and the Tag Manager resides at the Application Layer. So the flow of data is from Experience Layer to Data Layer to Application Layer.
To be honest, I also feel criminal to make a very important tool like data layer look like it’s nothing. Or am I cool? Cool or criminal? Maybe I’m angelic to help you understand it easily. O:)
An array is a data structure containing multiple elements. To define, for example, an array named A, we follow either of the following syntaxes –
var A = new Array();
A = ;
datalayer = ;
So our data layer has been created. Here ‘datalayer’ is just a name. You can give any name to your data layer, even though there are some default names specified by different Tag Management Systems, and it’s recommended that you go with the defaults. Google Tag manager calls it dataLayer, Tagman uses tm_params, Tealium calls it utag_data and Qubit calls it universal_variable.
Inside the data layer, is a single object. And since we include objects within a pair of curly braces, this is how the structure of a data layer looks –
datalayer = [
Everything included within these curly braces forms a single object. Here is an example structure of a data layer.
How does a Data Layer help
I – Specific and refined data
A data layer only holds the data needed and specified by a business or an application. For this reason, it is also considered to be a refined list of business requirements.
II – Data layer speeds up the process of deployment of tags.
III – Data layer helps you get the most out of a Tag Management System
The Data layer is one of the key concepts in the world of Tag Managers. The tools work best when deployed using the data layer, as it ensures maximum flexibility, portability, and ease of implementation.
IV- Data layer allows the Analytics and Digital Marketing team to conveniently make changes on the website.
Best Practices in Data Layer’s Implementation
- Business Objective Document
Writing down the requirements and objectives of an organisation is the first step in creating a data layer. This practice gives a vision and a clearer understanding of what information the data layer must collect and how.
Each team within an organisation has its own set of goals to achieve, which collectively help the organisation to achieve its basic goal. Since every goal requires distinct data, distinct data layers must be created. Each data layer will collect data that is specific to a particular goal. Hence, we recommend separate data layers for Analytics, Marketing and other tools.
Keep the names of your data layer and variables simple and readable. One way to do this is by using lowercase and underscores instead of camel casing. For example, use ‘page_id’ instead of ‘pageID’. The names must also be relevant and descriptive.
Example Data Layer
Suppose an online store comprising thousands of women’s bags, needs to know their most popular products. So the goal here – To find out the type of products being loved the most.
The ‘type’ here could be dark colored handbags under 1499 bucks, or luxury wallets that cost over 2999 bucks. Hence, our data layer must record some crucial attributes such as product category, price range, physical attributes, along with the product name of course.
A data layer for the same (holding some values) must look like –
datalayer = [
'product_name' : 'Black Fringed Wallet'
'product_category' : 'Wallets'
'color' : 'Black'
'price' : 899
Notice that the goal is fully met by making sure that only the data specific to the company’s requirements is collected. Insights formed on the basis of this data will help the company understand the preferences of its customers. If most of the visitors viewed bags which are dark colored backpacks priced between 1399 and 1899 bucks, the company can come to conclusion on what’s trending the most.
Also notice that the names of variables are simple and fully understandable.
Similarly, another data layer for the same company could track purchase-related data, in order to know which type of products are bought the most. Multiple data layers can be (and must be) created to achieve the various goals of the company.
How we can help
Contact us here.
Found it informative? Leave a comment! You can also give us a thumbs up by sharing it with your community. Also did you know that you can light up our day by subscribing to our blog? Subscribe here –