In a hangout, one SEO professional asked John Mueller about structured data and using it with Google Tag Manager.
Their question was: Is adding Schema markup with Google Tag Manager good or bad for SEO, and does it affect ranking?
John answered that, first of all, you absolutely can add structured data with Google Tag Manager. This is an option.
Google Tag Manager is a simple piece of JavaScript that you add to your pages, and then it does something on the server side, and it can modify your pages slightly using JavaScript.
For the most part, Google is able to process this normally, and the structured data that you generate like this, it can be countered, just like any other structured data on your web pages.
From Google’s perspective, structured data, at least the types that are documented, are primarily used to help generate rich results.
Rich results are the types of “fancy” search results that have a bit more information, and more color and detail surrounding your pages.
If you add your structured data using Tag Manager, this is not a problem.
From a practical point of view, however, John prefers to have the structured data directly on the page or directly on the server, so you know exactly what is happening with this code.
This makes it a bit easier to debug things, and it makes it easier to test things. Trying out Tag Manager is perfectly legitimate, John says, and it’s an easy way to try things out.
But, in the long run, John recommends that you add structured data to your site directly, rather than using an external tool like Tag Manager.
This happens at approximately the 12:30 mark in the video.
John Mueller Hangout Transcript
John (Question)
Okay, so let’s see: Adding schema markup with Google Tag Manager, is that good or bad for SEO? Does it affect ranking?
John (Answer)
So first of all, you can add structured data with Google Tag Manager, that’s definitely an option. Google Tag Manager is a simple piece of JavaScript you add to your pages, and then it does something on the server side, and it can modify your pages slightly using JavaScript. For the most part, we’re able to process this normally, and the structured data that you generate like this, that can be countered, just like any other kind of structured data on your webpages.
And from our point of view, structured data, at least the types that we have documented, is primary—primarily used to help generate rich results, we call them, which are kind of like these fancy search results with a little bit more information, a little bit more color or detail around your pages. And if you add your structured data with the Tag Manager, that’s, that’s perfectly fine. From a practical point of view, I prefer to have the structured data directly on the page or directly on your server, so that you know exactly what is happening.
It makes it a little bit easier to debug things, it makes it easier to test things. So trying it out with Tag Manager from my point of view, I think is perfectly legitimate, it’s an easy way to try things out. But for the long run, I would try to make sure that your structured data is on your site directly, just to make sure that it’s easier to process for anyone who comes by to process your structured data. And it’s easier for you to track and debug and maintain over time as well, so that you don’t have to check all of these different separate sources.