Using Google Tag Manager to Add Schema (Structured Data)

Roughly a 3 minute read from Shree

07 Jul 2015

Using Google Tag Manager to Add Schema (Structured Data)

Previously you had to markup the code on the site or use the structured data highlighter in Google Search Console (formerly Webmaster Tools), which are both fine solutions but sometimes developer resource is limited and the highlighter isn’t as accurate as you’d like it to be. Enter Tag Manager.

I’m sure Tag Manager isn’t new to you, being the digital marketing powerhouse that you are, but just in case you haven't had time to cross it off your to-do list yet, here’s the elevator pitch from Google:

“Google Tag Manager gives you the power to create and update tags for your website and mobile apps, any time you want, at the speed of your business.”

Don’t forget Google has been executing JavaScript for a while now which means it can render any HTML you put within your Tag Manager container. This means we can use JSON-LD and Tag Manager to markup our data! Hooray!

I’ll walk you through how to display Organization schema on all your pages but remember these principles can be applied to product pages, contact us pages etc. Note: This example uses Google Tag Manager V2.

Create your JSON-LD markup

The code we use on the Engage site is below, just change the name, url, logo and social media URLs.

<script type="application/ld+json">
{ 
  "@context" : "http://schema.org",
  "@type" : "Organization",
  "name" : "Engage",
  "url" : "http://engageinteractive.co.uk/",
  "logo": "http://engageinteractive.co.uk/assets/img/icons/favicon-196.png",
  "sameAs" : [
    "https://www.facebook.com/engageinteractive.co.uk",
    "https://twitter.com/engagetweet",
    "https://instagram.com/engageinteractive",
    "https://plus.google.com/114608695743946009215"
   ] 
}
</script>

Create the tag in GTM

Login to Tag Manager and select the container for the site you want to add schema for. Next create a new tag.

Edit the name of the tag to something identifiable, select Custom HTML Tag as the tag type and click Continue

Paste in the code you edited earlier, click Continue. We want the tag to fire on all pages so click on All Pages and then Create Tag.

Publish and test

Since the best way to test is by using Google’s testing tool we’ll need to skip the usual preview stage and publish it straight away. Click Publish in the top right hand corner of your container homepage and then click Publish Now.

Head over to the Structured Testing Tool, click Fetch URL and enter your website’s URL, hit Fetch & Validate and type in your site address and if everything is working should see something like this in the Results pane.

And that's it, you're done. Remember, you can apply this technique to other areas of the site. If you have any questions just send us a message on facebook or twitter!

Further Reading

Shree

Shree loves all things digital, spending his professional time on search and analytics. With experience tailoring campaigns for some of the UK’s biggest brands, he loves taking on new challenges in the ever changing world of SEO.

Hey there old timer!

Our website uses some new fangled technology which we’re afraid your current web browser doesn’t support.

There’s loads of choice out there nowadays and it’s easy to upgrade. Just click the link below for more information!

Upgrade my browser

I.T. guy wont budge?

No problem! Give us a call on 0113 457 4090, we’re happy to help.