Free: Assessment Does your website build trust with buyers and bring in revenue?

Score My Website
Close

Free: Assessment

Does your website build trust with buyers and bring in revenue?
Take this free 6 question assessment and learn how your website can start living up to its potential.
Score My Website
Search Engine Optimization  |   Web Design  |   News

Google offers guidance on generating structured data with JavaScript

Dylan Lepak

By Dylan Lepak

Apr 7, 2020

Google offers guidance on generating structured data with JavaScript

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. 

Free: Assessment

Does your website build trust with buyers and bring in revenue?
Take this free 6 question assessment and learn how your website can start living up to its potential.

Related Articles

Content Marketing and AI-Powered Generative Search

September 20, 2023
Vin Gaeta Vin Gaeta

9 SEO Best Practices for Stronger Organic Traffic in 2023

November 18, 2022
Kimberly Marshall Kimberly Marshall

Video SEO: How To Optimize Videos To Drive Traffic to Your Website

May 9, 2022
Kevin Church Kevin Church

37 Eye-opening SEO Statistics To Nail Your 2022 Search Strategy

April 28, 2022
Ramona Sukhraj Ramona Sukhraj

10 Reasons Why Your Website Is Not Ranking In Google

February 10, 2022
Jolie Higazi Jolie Higazi

Google Shares New Tools to Audit Website User Experience

August 12, 2021
Paul D. Grant Paul D. Grant

Google: Website Content Quality More Important Than Quantity

August 10, 2021
Paul D. Grant Paul D. Grant

How Long Tail Keyword Research Can Drive Business

August 9, 2021
Kevin Church Kevin Church

How to Optimize Videos On Your Business Website for Search

July 23, 2021
Liz Murphy Liz Murphy

Google: 'Here's how to prepare for the future private web'

July 16, 2021
Liz Murphy Liz Murphy

Too many internal links in content can confuse Google about site structure

July 9, 2021
Liz Murphy Liz Murphy

Google July 2021 core update rolling out over next 2 weeks

July 2, 2021
Liz Murphy Liz Murphy

Inbound Marketing Help: My Traffic And Leads Are Down. What Can I Do?

June 28, 2021
John Becker John Becker

Finally, Google page experience core update is rolling out

June 18, 2021
Liz Murphy Liz Murphy

What is a Featured Snippet? [Definition + Examples]

June 10, 2021
Kevin Church Kevin Church

Google June 2021 core update live, July core update coming

June 4, 2021
Liz Murphy Liz Murphy

Google's June page experience core update will be mobile first, then desktop

May 21, 2021
Liz Murphy Liz Murphy

Google confirms demise of Q&A search feature, Question Hub lives on

April 26, 2021
Liz Murphy Liz Murphy

Big Google algorithm update moved to June with new performance report

April 21, 2021
Liz Murphy Liz Murphy

No, changing page publish dates won't increase Google search rankings

April 10, 2021
Liz Murphy Liz Murphy

Google: 'zero-click search' claims and data 'misleading'

April 5, 2021
Liz Murphy Liz Murphy

3 quick SEO fixes that will increase your website rankings right away

March 30, 2021
Hannah Woods Hannah Woods

10 Google Analytics metrics you absolutely must track (updated)

March 29, 2021
Magdalena Day Magdalena Day

Meet the new Google My Business review management view

March 20, 2021
Liz Murphy Liz Murphy

Google Ads help: Top 10 reasons your Google Ads campaigns are failing

March 10, 2021
Jason Linde Jason Linde