Monday, December 23, 2024

Google Warns On Using JavaScript For Structured Data With Merchant Center

Must read

In the Google Merchant Center structured data documentation, it says that you should add structured data to the HTML source and that it “can’t be generated after a page has been loaded using JavaScript.” This does not mean Google cannot process the structured data on the page if generated using JavaScript, but rather that it makes it harder for Google to do so.

Here is a screenshot of that line:

Gmc Structured Data Js Warning

Jarno van Driel posted about this on LinkedIn and said, “Google Search Central documentation explains how to add structured data markup via JavaScript, yet Google Merchant Center documentation mentions markup shouldn’t be added after a page has been loaded.” He asked, Which of the docs is correct?

Ryan Levering from Google chimed in and said technically both are right and Google needs to adjust the wording on the doc. He said, “We are working at finding the right wording to explain this discrepancy currently.” He also warned “against running off and re-implementing your websites,” if it works now, leave it.

He then goes on to explain that Google Merchant Center crawlers can and do process structured data when generated with JavaScript but they have seen quality and inconsistency issues with these implementations, so they recommend you do not use it.

He wrote:

It’s not that GMC crawler can’t ever render JS, but rather that there are more often quality problems with the rendering and discrepancies when sites do things like have one price on raw HTML load and then update that with a strikethrough price on render. It gets tricky when the markup is loaded one way on page load and then changed or rendered on top via JS.

So if the HTML source rendered and said one thing and then the JavaScript changes that later, it can confuse Google in some cases.

In terms of the documentation, he said, “I think it was easier to write in GMC to just say that it should be in the original page load and we’re re-examining that phrasing now. In general if you have that ability that’s likely going to be more consistent with all our systems, but it would be untrue to say that you can never do this.”

Four years ago, Google came up with its structured data using JavaScript documentation – as a reminder.

Forum discussion at LinkedIn.

Latest article