SEO - Search Engine Optimization

Using Google Tag Manager to Dynamically Generate Schema/JSON-LD Tags

Last Updated: March 3, 2017

[sc name=”GoogleLinkAds”]

Posted by serpschris[Estimated read time: 7 minutes] One of the biggest takeaways from SearchFest in Portland earlier this year was the rapidly rising importance of semantic search and structured data — in particular And while implementing Schema used to require a lot of changes to your site’s markup, the JSON-LD format has created a great alternative to adding microdata to a page with minimal code. Check out Mike Arnesen’s deck from his SearchFest talk, “Understanding & Facilitating Semantic Search,” for a great overview on using structured data. What was even more exciting was the idea that you could use Google Tag Manager to insert JSON-LD into a page, allowing you to add Schema markup to your site without having to touch the site’s code directly (in other words, no back and forth with the IT department). Trouble is, while it seemed like Tag Manager would let you insert a JSON-LD snippet on the page no problem, it didn’t appear to be possible to use other Tag Manager features to dynamically generate that snippet. Tag Manager lets you create variables by extracting content from the page using either CSS selectors or some basic JavaScript. These variables can then be used dynamically in your tags (check out Mike’s post on semantic analysis for a good example). So if we wanted to grab that page URL and pass it dynamically to the JSON-LD snippet, we might have tried something like this: But that doesn’t work. Bummer. Meaning that if you wanted to…

Article Source: Using Google Tag Manager to Dynamically Generate Schema/JSON-LD Tags

[sc name=”GoogleLinkAds”]

About the author / 

S K Routray

S K Routray is a computer science graduate and Co founder at He worked as a Online Marketing lead at many MNC Companies. He has passion for writing on SEO techniques, Social Media Marketing and digital marketing techniques. If he wasn’t an online marketer, he'd take his love for food and become a great chef cum hotel entrepreneur. Join NAS Writers team to write for NAS.

[sc name="searchbox"]
[sc name="responsiveads"]

Email Subscriptions

Enter your email address:

Delivered by FeedBurner

Follow us on Twitter