Using Javascript or GTM for Structured Data is not a bad thing


Recently there were some comments from Google that made its way to Search Engine Journal describing the preference for rendering Schema Markup JSON-LD server side. The recommendation is that publishers should place the JSON-LD on the server side within the HTML. This is sound advice and something we agree with.

However, the write-up and interpretation are more drastic than reality. It overlooks the slow release time and iterations of backend IT software as well as the increased dependency on other parties to get the work done and the impact to the business of adopting schema markup.

In some cases, the application doesn’t support the changes requested or is notoriously difficult to change. The interpretation of the article of John Mueller’s comments say that we should not use GTM because of the limitations.  I say that if you are like us at Schema App, embrace the complexity, understand web technologies and consider the business impact, you shouldn’t jump to the conclusion that Javascript and Tag Managers are bad.

In our conversations with other members of the Google team, adoption of structured data has been a high priority for them. This makes sense as they try to understand content, delighting their customers who are searching for an answer.  Restricting the ways of which businesses can adopt goes against their goal to drive adoption, and therefore also doesn’t make sense.

What we take away from John Mueller’s article is that it is preferred to have schema markup server side (and cheaper for their crawlers), but not the only way of deploying structured data.

Should we use Javascript or Server side to add schema markup?

Server-side schema rendering is preferred but Javascript is a good choice for Google crawling and when resources or time is limited. When possible, we also recommend to include schema markup in server-side integrations because it’s more widely supported as its less complex/expensive for crawlers. In some web applications, there may be add-ons or plugins that help to do this. Sometimes developing that support can be expensive or take months to implement. GTM or Javascript methods can be done rapidly and provide schema markup to Google. It is only in circumstances when the developer doesn’t know how to diagnose an issue with Javascript rendered content that we get blanket statements about its viability.

Does using Google Tag Manager change the answer?

No, GTM is a fine method of adding schema markup. It too needs to be written and understood in the context of Google’s rendering capability. Write the code using ECMAScript 5 without any dependent libraries and you’ll probably have no issues. If you do, I’d start reviewing other libraries that are incompatible and it’s at this point you may have bigger issues with site crawl-ability anyway.

Javascript has been working consistently since 2016

Schema App’s first implementation of schema markup with Javascript has been working consistently since early 2016 and since then we have done hundreds of deployments using this technology. Assuming you know the limitations of crawlers and given the opportunity to Javascript affords, the question is more about how can you do it right.

We also prefer to get markup server side. That is why we’ve created our add-ons for WordPress, Shopify, BigCommerce, and Drupal. But the reality is that the barriers and time to get those add-ons setup, can drastically slow down the return of having structured data.

What technologies drive the crawlers?

In 2015 Google stated that they are “generally able to render and understand your web pages like a modern browser”. Also in 2015 Chrome v41 was released, this is still the current version supported by Googlebot. From our perspective at Schema App, we write our Javascript to be compatible with the that of Chrome v41 from early 2015. To be safe, for adding schema markup to pages we use ECMAScript 5. The problem with the latest Javascript frameworks is they were released after Chrome v41 and therefore haven’t been included in Googlebot to run those new functions. For example, the next version of Javascript, ECMAScript 6 was released in June 2015, three months after Chrome v41 was out. Developers using new frameworks and functionality of Javascript since then should not expect it to work.

The good news is that we know what version it supports and with tools like that allow you to pick an OS, Browser and version to do live interactive cross-browser testing you can quickly diagnose what’s working or not. As part of our development process for Schema App Javascript, we check to see that it works with Chrome v41.  As long as you are doing your due diligence and know that your scripts run in Chrome v41, then your Javascript will render and schema markup will be picked up. To John Mueller’s point, adding schema with Javascript is more brittle and won’t be as widely consumed by other crawlers, like Bing that doesn’t yet support Javascript rendering.

Structured Data Testing Tool Javascript Support

Furthermore, the different Structured Data Testing Tools offer differing Javascript support. It seems like Search Console rendering matches that of the Rich Results tool, however the Structured Data Testing Tool (SDTT) is not always in sync with Search Console. We’ve had a few occasions where Javascript added schema would not show in SDTT but would show in the other two tools.

While there is a whole industry sector of companies that make crawlers and many of them now support Javascript enabled crawling. For example, Screaming Frog, Apify, 80Legs, Scrapinghub, are all offers that I’ve experimented with. For our own internal crawler with javascript, we built several iterations and built the functionality in-house to help reduce the cost and add flexibility. But it is expensive to add support for Javascript rendering, and that is the crux of the adoption that John was pointing out. However, he could have clarified that for other services because Google has been doing this reliably for several years. Developers who aren’t getting things rendered on SDTT either through Javascript or GTM should be checking for functionality that is not available in Chrome v41. An alternate test would be to use Rich Results Testing Tool to see rendered content for another view from Google.

In conclusion, we recommend you adopt structured data. If you can put it server side, awesome, do it. If not, then using Tag Manager is better than not adopting it at all.

, , , ,
Previous Post
Schema Markup News Feb 26th, 2019
Next Post
Schema Markup News March 5th, 2019