Convert LD+JSON Schema to Javascript to use in Google Tag Manager

The Solution to the LD+JSON GTM “schema not showing” Problem

For those of us who were used to pasting LD+JSON schema into a script tag in Google Tag Manager, we awoke one day to find out that this approach no longer worked.  Regardless of the reason why, you can still add your schema markup to GTM, but you have to wrap in in a Javascript function.

Remember, once you have the function, you still have to add it to GTM as a custom html tag.

The video below details how you do it (it’s easy), and below that is the code for you to copy to use:

var data ={


var script = document.createElement('script');
script.type = 'application/ld+json';
script.innerHTML = JSON.stringify( data );

Hat-tip to @simoahava for his advice on the tag manager product forum!

Join “The Dental Web Development and SEO Group” on Facebook!

Use this group to ask your questions about dental web development, dental SEO, Google My Business, Google Maps, Google Analytics, etc. I will try to answer as many questions as possible, and it is my hope that members of the group will help each other out with questions, as well!