1

When using GTM, is it possible to generate a valid schema after the Window Loaded event?

By valid I mean a schema that will use Data Layer variables that are created after the DOM Ready event and be "considered" (don't know if this is the right term) when Google generates SERPs.

Currently a tag generates a schema at Page View but it's mostly empty, since the Data Layer variables aren't created yet.

The website is a single page site.

  • What do you have in your data layer variables? – Stephen Ostermiller Nov 18 '19 at 20:26
  • Information like product name, cost etc. All this is info is received by ajax calls. – YannisP Nov 18 '19 at 20:27
1

While it is technically absolutely possible, you however shouldn't do this. Indeed, Google is able to see stuff, which is loaded until six seconds after onLoad. But structured data is a kind of information Google wants to see immediately.

At times, where JSON-LD wasn't there, Google recognized only structured data (microdata or RDFa), applied only to visible HTML elements. Applying of structured data to unvisible elements was able to trigger a penalty.

Neverthenless there were kinds of structured data, which were become redundant, if applied to visible elements, so this caused usage of microdata with body elements like <meta itemprop="price" content="EUR" /> or <link itemprop="url" href="http://example.com" />

Rising of JSON-LD maked strictly speaking any usage of structured data unvisible - JSON-LD is not visible and not applied to any visible element. But the wish of Google remains: to use JSON-LD in the visible part of page.

Here you can see some responses from Google's John Mueller about the topic.

  • I take it then that JSON-LD needs to be inserted at the <head> or the <body> directly at page load. Will microdata work in my case? – YannisP Nov 19 '19 at 12:22
  • I'm reading throughout the net that Google does read generated JSON-LD after the initial page load. But neither Google's microdata testing app or SERPs show any changes. But then again I think that the testing app doesn't execute any JS – YannisP Nov 19 '19 at 13:06
  • 1
    Googles Rich Result Tool does render and will show if your GTM code can work. It does not support all SD types. One way to test for all is to use the Mobile Friendly Tool to get the rendered html and paste that in the SDTT. The next test is in the GSC reports. The final test is looking for real world results. – Tony McCreath Nov 19 '19 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.