1

I am setting up structured data for a website and am wondering about the benefits and drawbacks of using the Google Tag Manager vs putting script tags in the head.

  • I'm building the site with HUGO so I'm not worried about too many script tags.
  • Every page will only get the JSON-LD I want it to have. Would I still get benefit from the tag manager?
  • Do I understand correctly that there is a drawback in using Google Tag Manager in that other search engines then won't get any structured data?

Thanks!

2

With GTM, a bot needs to render your pages to see your Structured Data (SD). This means most bots will not see it. Best is to test with any search engine or system you care about.

If you use Google Merchant Centre, it does not render and will not see any SD in GTM or created via JavaScript.

If you are trying to test with the Structured Data Testing Tool, it may work, it may not. It does not do true rendering. Test with the Rich Results Tester or Google Search Console which does render like Googlebot. I suspect most other testing tools will not pick it up.

I think Bing says they do support some JavaScript now. You would have to test.

Googlebot does render, but Googlers have several times recommended that you avoid using GTM to add structured data. One reason is that a page is not always instantly rendered (they are faster now), so there may be some time where Google is not aware of your SD. It also complicates things, meaning its harder to test and there are more ways to make it fail.

I'd avoid using GTM for SD unless you have a strong need to use it.

|improve this answer|||||

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.