How to add schema markup with Google Tag Manager

To add schema markup using Google Tag Manager (GTM), the key is to create a custom HTML tag that includes the schema data and trigger it to fire on your website’s specific pages.

In this step-by-step guide, let’s go through each step in detail to help you harness the power of schema markup via GTM, providing a significant boost to your online presence and engagement with your audience. Let’s dive in!

Step 1: Set up your Google Tag Manager account

To get started, you need to have a Google Tag Manager account. If you don’t have one yet, sign up for free and follow the prompts to set it up.

Once your account is ready, make sure you have installed GTM on your website by adding the container code to each page of your site.

Step 2: Understand and choose the relevant schema markup

Before diving into implementation, it’s essential to have a solid grasp of what schema markup is and how it can benefit your website’s search engine optimization (SEO).

For each type of content you want to mark up, you’ll need to select the appropriate schema type. Schema.org offers a vast library of schema types that cover a wide range of topics. Starting with the Schema.org documentation to explore available schema types.

Step 3: Create the Schema Markup

If you’re not familiar with writing structured data in JSON-LD format, there are online schema generators that can simplify the process for you. You can use tools like Google’s Structured Data Markup Helper or TechnicalSEO’s Schema Markup Generator to create schema markup.

After generating the basic schema markup, you may need to customize it to suit your specific content. This might involve adding additional properties or information (such as sameAs) that are unique to your products, services, or articles. My favourite go-to tool would be Visual Studio code editor.

Don’t forget to check and validate your schema markup to ensure it is error-free and follows schema.org guidelines with tools like the Google Rich Results Test or Schema Markup Validator.

Step 4: Create new tag in GTM

The next step is to create custom variables in GTM that will hold the schema markup information you just created.

From your Google Tag Manager Workspace dashboard, select “Add a new tag”. In the “Tag Configuration”, choose the “Custom HTML” as the tag type.

It’s crucial to give your tag a descriptive name that will help you identify it later. You can also add a trigger at this stage, which will determine when the tag fires on your website.

Create tag with custom HTML

Paste the code snippet you’ve into the HTML field. Make sure the markup is correctly formatted as JSON-LD. This is the structured data that will be added to your website’s pages.

Paste your code snippet to the HTML field

Step 5: Set up triggers in Google Tag Manager

After creating the custom HTML tag, the next step is to set up triggers in GTM. Triggers tell GTM when and where to fire your tags, so it’s important to set them up correctly.

In this case, you’ll want to create a trigger that fires on the page where you need to implement the schema markup. This will ensure that the corresponding tags are fired only on those specific pages. 

The most common triggers that you can implement include:

  • Page Path Triggers: You can also use the Page Path variable to create triggers based on the structure of your website’s URLs. This is especially useful for websites with a clear hierarchy of categories and pillar pages.
  • Form Submission Events: For websites with forms, you can create triggers that fire when a form is submitted. This is useful for situations where schema markup is related to user-generated content, like reviews or comments.

For example, if you need your schema to fire on all blog posts, you can configure the trigger to fire on a “Page View” when the Page Path contains “/blog/” in the URL.

Set up trigger in Google Tag Manager to fire the schema on specific pages

Step 6: Preview and publish your GTM container

After you’ve created your tags with schema markup, it’s essential to test and preview your container before publishing it. GTM provides a preview mode that allows you to debug and test your container before launching it live on your website.

Use preview mode to ensure that your schema markup tags are firing correctly, and that the schema information is being captured accurately. Once you’re satisfied with your container’s functionality, publish it to your live website to see the schema markup in action.

Step 7: Publish and Monitor

After publishing your schema markup through GTM, it’s important to continue monitoring its performance. Keep track of any changes or updates to your website that may affect the schema implementation and make adjustments as needed.

Additionally, regularly checking your website’s structured data using tools like Google Rich Results Test can help ensure that your schema markup is still valid and appearing correctly in search results.

Conclusion

Adding schema markup to Google Tag Manager can seem challenging, but with our guide, you can make the process simpler and more efficient. 

By following these steps, you’ll be able to semantically annotate your content and provide search engines with the context they need to rank your pages appropriately.

Aubrey Yung

Aubrey Yung

Aubrey is an SEO Consultant with 5+ years of B2B and B2C marketing experience.