Skip to content

Radically Better Results

B Corp Certified
Avatar of Owen Davies

Last month, our co-founder Stephan mentioned that we’ve always had a focus on data innovation and efficiency at Yard, and that delivering the most efficient analytics package was the core of our business as far back as 2008.  

Yard, along with the digital ecosystem, has grown and evolved considerably since then, but we continue to direct a considerable portion of our expertise towards enterprise analytics implementations. What has changed during this time is the approach and method that we adopt to align with evolving best practices and innovation.  

These best practices provide the most efficient, future-proof ways to capture and surface digital data for our clients to make marketing decisions. But how do we do that? 

The value of data layers

Today, best practice for tracking and analytics implementations relies on the implementation of a robust data layer. An efficient method of collecting all data points on each page type from websites and apps.  

When working with a data layer, the implementation of data collection requirements for any analytics or martech tags becomes far more efficient. A data layer requires a small amount of code to retrieve the value required, compared with previous methods of DOM traversal (HTML scraping) to get the same information.  

When grabbing the name of a product on a product page without a data layer in place where the element we need doesn’t have an ID, as an example, we could use this code:

var product_details = document.getElementById("product-details");

var divs = product_details.getElementsByTagName("div");

var price = "";

for (var i=0; i<divs.length; i++) {

if (divs[i].className === "product-name") {

var product_name = divs[i].getElementsByTagName("p")[0].innerHTML;



Compare this to the code required to get the same value if it were in a data layer:

var product_name = digitalData.product_data.product_name;

Whether or not you’re someone who understands exactly what that code does, you can clearly see that the same outcome can be achieved with considerably less code. This increases site performance, reduces page load speeds and provides less chance of erroneous code, which is more time and cost-efficient to implement and test.

Robust efficiency

When there is less code, errors are less likely to occur. This not only provides a more robust data capture method, but a range of ongoing efficiencies from a code maintenance point of view. 

The reliability of data that originates from a data layer is far greater than that of an implementation done by traversing the DOM for values. Some of the key benefits are: 

Page redesigns do not affect the data: When HTML scraping, HTML is used as a reference to collect the required data. If a page is redesigned/rebuilt, then the previously written JavaScript can fall over/not find the element it is looking for. If it is from a data layer, then as long as it is still present, there will be no data loss. 

New pages are automatically tracked: If a new page is released, whether it follows the same structure as previous pages or not, if the requirements are the same, then it will automatically start tracking when it is live. This means no additional work is necessary unless custom tracking for the page is required. Even then, if it is in the data layer, there would be little effort to add these new requirements.  

Typically, we provide a specification that is “universal.” What we mean by this is that the data layer is not Tag Management System (TMS) specific. This means that it can be used by any TMS. 

In summary, adopting the data layer approach to analytics implementations provides: 

  • Increased site performance 

  • Reduced page load speeds 

  • Less chance of erroneous code 

  • Less time to create code resulting in a cost saving for BAU 

  • Page design changes do not impact the code 

  • New pages are automatically tracked 

  • Greater choice of data access points for reporting 

  • A universal data layer type allows a change in tag management system 

Our data Yardies are more than happy to talk data layers and analytics implementations to anyone considering a new solution or improvements to current digital data capture methods for their business. 

In the meantime, we’ll continue to evolve with innovation and leading the way on digital data best practices.

Subscribe for insights & updates straight to your inbox.