Subscribe to THE LATEST

Google offers guidance on generating structured data with JavaScript

Google offers guidance on generating structured data with JavaScript Blog Feature

April 7th, 2020 min read

Google has recently published a new guide for generating structured data with JavaScript.

Today, many website developers and technical SEO gurus lean on JavaScript to create dynamic website content, but some have distanced themselves from dynamically generating structured data simply due to a lack of clarity from Google.

Last year, John Mueller shied away from conversations surrounding structured data. From the sounds of his interviews, structured data didn't have any impact on SEO whatsoever.

But that's where things get a little confusing. Google's "Understanding how structured data works" document hints that structured data helps Google understand page context and crawl sites more efficiently — which should "theoretically" improve ranking signals.

Does structured data impact rankings? According to Search Engine Journal, it seems to have a pretty significant impact.

Either way, these recent Google guidelines will help marketers (and especially developers) understand how to generate structured data in JavaScript and have Google effectively crawl that structured data.

The value of structured data

Let's get the simple stuff out of the way: Structured data does impact ranking when it comes to snippets.

Both JSON-LD and microdata (hint: Google definitely prefers JSON-LD) help your website get into the snippet section (e.g., knowledge graphs, rich cards, carousels, etc.), but outside of those sections, we can't give a definitive answer on its impact on ranking signals. Google hasn't provided any definitive answers.

But you can't get featured on rich snippets without structured data. So, it certainly can improve your CTR and other valuable KPIs.

Studies show that simply appearing on rich snippets can improve CTR by up to 30%.

There's real value in structured data. But for years, no one has been perfectly sure how to generate structured data that wins with Google. Well, until now.

Google's three ways to generate structured data via JavaScript

Google lists three ways to generate structured data:

  1. With Google Tag Manager
  2. With custom JavaScript
  3. With server-side rendering

Using Google Tag Manager

Google Tag Manager lets you manage your structured data without actually diving into any code, so this is by far the simplest option.

There's a big caveat here — many sites are only going to be able to generate structured data via custom JavaScript. But, even when you generate the data in JavaScript, Tag Manager can help you manage it. So this is definitely something that you're going to want to know.

Google lists six steps for generating structured data with Tag Manager

  1. Install Google Tag Manager on your website
  2. Add a customer HTML tag to the container
  3. Paste the desired structured data block into the tag content
  4. Install the container (check 'Install Google Tag Manager' section of the container admin menu to see how)
  5. Publish the container in Google Tag Manager to add the tag to your website
  6. Test it out

Using custom JavaScript

This is how most of you have already been generating structured data.

According to Google, it can already understand and process structured data that's in the DOM when it renders the page. This is great news for most developers who have been leaning on custom JavaScript to generate structured data.

Here's the big pro tip from Google on this: check your results with the Rich Results Test.

All you have to do is enter your URL and Google will tell you if the page is "eligible for rich results." If you see "failure," you probably have a syntax error. Google has a guide on getting that fixed up.

Using server-side rendering

If you're using server-side rendering, Google recommends including the desired structured data in the rendered output. Again, check the results on the Rich Results Test.

Get started using structured data

If your website isn't using generated structured data, you should get on it. Without structured data, you're not going to get in those juicy rich snippets, and you're missing out on some of Google's best features.

One study showed a 677%  increase in organic traffic simply from appearing in rich snippets.

When it comes to technical SEO, structured data should be a crucial component of your game plan. Yes, page speed, rendering, indexation, and all of those other wonderful technical components are also important.

But now we know that Google craves structured data, and it has provided a step-by-step guide to create generated data that makes the Google bots happy. 

THE LATEST from IMPACT
Here Are Some Related Articles You May Find Interesting

Want to Contribute Content to impactbnd.com? Click Here.