Created by Saijo George
This is one of my side projects that will help you convert your Structured data markup in JSON-LD format to a Google Tag Manager friendly version that Google’s Structured Data Testing Tool can pick up and validate. This tool will work on all mobile and desktop devices, if you run into any issues please get in touch with me on Twitter or LinkedIn.
JSON-LD Schema Markup Not Working?
Is your schema markup not appearing in Google’s Structured Data Testing Tool? Are you deploying structured data markup using Google Tag Manager? Here is what is going wrong.
SEOs were actively implementing Structured data on websites with Google Tag Manager, it was quite easy to deploy Structured data markup using JSON-LD through Google Tag Manager. It lets you quickly add your JSON-LD markup to all pages or selective pages in a few simple steps but all that changed around May 2018 when Google stopped validating JSON-LD when it’s served through Tag Manager.
But thankfully Simo Ahava quickly came up with a fix. This tool will help you do that in a few clicks.
How to clean up your JSON-LD Schema to work with Google Tag Manager?
Follow these simple steps to get your JSON-LD structured data markup to work with Google Tag Manager and validate with Google’s Structured Data Testing Tool.
- 1. Paste the JSON-LD code into the JSON-LD input section.
- 2. Click on Generate Tag Manager Code.
- 3. Click on Copy Tag Manager Code.
- 4. Paste the code in Tag Manager.
- 5. Publish it.
- 6. Test if the results validate on Google Structured Data Testing Tool.
Should I choose Prettified OR Minified version?
The tool will give you two version of the Google Tag Manager friendly code. Either one should work but the minified version has a small advantage when it comes to the performance of your website. That is what I would recommend you use.
Google does NOT recommend Using Tag Manager to Implement Schema Markup.
John Mueller from Google advises against using Google Tag Manager to deploy Structured Data and mentions that the ideal solution is to add the structured data directly into the HTML. So ideally process it server side and pass it via HTML instead of relying on a client-side solution like Javascript.
While this is not the ideal solution, as SEOs we know that we are not always in ideal situations and at times our best bet is to deploy it through a solution like Google Tag Manager. You could also look at deploying it via a Edge Computing Solution like Cloudflare Workers.
How can I generate JSON-LD code for my site?
There are a lot of structured data tools out there, one of my favourite ones is this one from Merkle. You can validate that code on Google Structured Data Testing Tool.